Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](docs)replica operation statment #1980

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
{
"title": "ADMIN SET REPLICA STATUS",
"language": "en"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->


## Description

This statement is used to set the status of a specified replica. Currently, it is only used for manually setting certain replica statuses to `BAD`, `DROP`, or `OK`, allowing the system to automatically repair these replicas.

## Syntax

```sql
ADMIN SET REPLICA STATUS
PROPERTIES ("<tablet_id>"="<value1>","<backend_id>"="<value2>","<status>"="<value3>")
bingquanzhao marked this conversation as resolved.
Show resolved Hide resolved
```

## Required Parameters

**1. `<tablet_id>`**

The ID of the tablet whose replica status needs to be set.

**2. `<backend_id>`**

The ID of the BE node where the replica is located.

**3. `<status>`**

Currently, only the values "drop", "bad", and "ok" are supported.
If the specified replica does not exist or is already in a bad state, the operation will be ignored.

**Notes**:

- Setting a replica to BAD status

A replica marked as BAD cannot be read or written. However, setting a replica to BAD may not always take effect. If the replica’s actual data is correct, and the BE reports the replica status as OK, the FE will automatically restore the replica back to OK. This operation may immediately delete the replica, so proceed with caution.


- Setting a replica to DROP status

A replica marked as DROP can still be read and written. The system will first add a healthy replica on another machine before deleting the DROP replica. Compared to BAD, setting a replica to DROP is a safer operation.


## Access Control Requirements

The user executing this SQL command must have at least the following privileges:

| Privilege | Object | Notes |
|:-----------|:---------|:---------------------------------------------------------------------------------------------------------------------------------|
| Admin_priv | Database | Required to execute administrative operations on the database, including managing tables, partitions, and system-level commands. |


## Examples

- Set the replica of tablet 10003 on BE 10001 to bad

```sql
ADMIN SET REPLICA STATUS PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "status" = "bad");
```

- Set the replica of tablet 10003 on BE 10001 to drop

```sql
ADMIN SET REPLICA STATUS PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "status" = "drop");
```

- Set the replica of tablet 10003 on BE 10001 to ok

```sql
ADMIN SET REPLICA STATUS PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "status" = "ok");
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
{
"title": "ADMIN SET REPLICA VERSION",
"language": "en"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->



## Description

This statement is used to manually set the version, last successful version, and last failed version of a specified replica. It is primarily used for recovering replicas from an abnormal state when an issue occurs in the system.

## Syntax

```sql
ADMIN SET REPLICA VERSION PROPERTIES ("<key>"="<value>" [,...])
```

## Required Parameters

**1. `<tablet_id>`**

The ID of the tablet whose replica version needs to be modified.

**2. `<backend_id>`**

The ID of the BE node where the replica is located.


## Optional Parameters

**1. `<version>`**

Sets the version of the replica.

**2. `<last_success_version>`**

Sets the last successful version of the replica.

**3. `<last_failed_version>`**

Sets the last failed version of the replica.
bingquanzhao marked this conversation as resolved.
Show resolved Hide resolved


**Notes**

- If the specified replica does not exist, the operation will be ignored.
-
- Modifying these values may cause subsequent data read and write failures, leading to data inconsistency. Please proceed with caution!

- Record the original values before making modifications. After making changes, verify table read and write operations. If they fail, revert to the original values. However, reverting may also fail.

- Do not perform this operation on a tablet that is currently writing data!


## Access Control Requirements

The user executing this SQL command must have at least the following privileges:

| Privilege | Object | Notes |
|:-----------|:---------|:---------------------------------------------------------------------------------------------------------------------------------|
| Admin_priv | Database | Required to execute administrative operations on the database, including managing tables, partitions, and system-level commands. |

## Examples

- Clear the failed status flag for the replica of tablet 10003 on BE 10001

```sql
ADMIN SET REPLICA VERSION PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "last_failed_version" = "-1");
```

- Set the replica version of tablet 10003 on BE 10001 to 1004

```sql
ADMIN SET REPLICA VERSION PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "version" = "1004");
```

This file was deleted.

This file was deleted.

Loading