Skip to content

[Enhancement] (restore) restore table or partition with the same replication_num as before the backup #11941

@nextdreamblue

Description

@nextdreamblue

Search before asking

  • I had searched in the issues and found no similar issues.

Description

right now, if i restore a table, i must set "replication_num"="1" or other replication num or default 3 replication, and i will get a table with all parititions which have same replication_num.

if a table have different replication num, if backup and restore it, i can not get a table which every partition with the same replication num as before the backup.

for example:
every partition of a table do not have same replication_num:
MySQL [tmp]> show partitions from part_p;
+-------------+---------------+----------------+---------------------+--------+--------------+------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+
| PartitionId | PartitionName | VisibleVersion | VisibleVersionTime | State | PartitionKey | Range | DistributionKey | Buckets | ReplicationNum | StorageMedium | CooldownTime | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize | IsInMemory | ReplicaAllocation |
+-------------+---------------+----------------+---------------------+--------+--------------+------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+
| 16004 | p1 | 2 | 2022-08-20 17:14:51 | NORMAL | p_partkey | [types: [INT]; keys: [-2147483648]; ..types: [INT]; keys: [1013157]; ) | p_partkey | 3 | 1 | HDD | 9999-12-31 23:59:59 | | NULL | 8.634 MB | false | tag.location.default: 1 |
| 16005 | p2 | 2 | 2022-08-20 17:14:51 | NORMAL | p_partkey | [types: [INT]; keys: [1013157]; ..types: [INT]; keys: [1113157]; ) | p_partkey | 3 | 2 | HDD | 9999-12-31 23:59:59 | | NULL | 2.175 MB | false | tag.location.default: 2 |
| 16006 | p3 | 2 | 2022-08-20 17:14:51 | NORMAL | p_partkey | [types: [INT]; keys: [1113157]; ..types: [INT]; keys: [1213157]; ) | p_partkey | 3 | 3 | HDD | 9999-12-31 23:59:59 | | NULL | 3.265 MB | false | tag.location.default: 3 |
| 16007 | p4 | 2 | 2022-08-20 17:14:51 | NORMAL | p_partkey | [types: [INT]; keys: [1213157]; ..types: [INT]; keys: [2147483647]; ) | p_partkey | 3 | 1 | HDD | 9999-12-31 23:59:59 | | NULL | 1.810 MB | false | tag.location.default: 1 |
+-------------+---------------+----------------+---------------------+--------+--------------+------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+
4 rows in set (0.00 sec)

this table have some partitions which have different replication num.

i backup this table and restore it, i can not get same table with same partitions with the same replication num as before the backup.

Solution

add restore new property 'reserve_replica', which means you can get a table with same partitions with the same replication num as before the backup.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions