github-actions[bot] commented on code in PR #67139:
URL: https://github.com/apache/doris/pull/67139#discussion_r3855793484


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/backup/CloudRestoreJob.java:
##########
@@ -241,10 +241,13 @@ public void doCreateReplicas() {
             }
             // set storage vault for new restoring table
             if (((CloudEnv) Env.getCurrentEnv()).getEnableStorageVault()) {
+                if (Strings.isNullOrEmpty(storageVaultId)) {
+                    storageVaultId = 
Env.getCurrentEnv().getStorageVaultMgr().getVaultIdByName(storageVaultName);

Review Comment:
   [P1] Do not treat the asynchronous vault cache as authoritative
   
   For an empty restore there is no create-tablets response to validate the 
vault, so this lookup is the only source of the ID. After restart/master 
promotion, `storageVaultId` is transient and the vault map starts empty; 
`BackupHandler` can resume jobs before `CloudInstanceStatusChecker` populates 
it, turning a valid restore into a permanent cancellation. The map can also be 
stale: the checker leaves old entries when Meta Service reports zero vaults, so 
deleting the last vault can let this code persist a deleted nonempty ID. Please 
resolve/revalidate the vault from an authoritative source at empty-table 
creation time, treating transient unavailability as retry/defer and definitive 
absence as failure before registration; merely serializing the earlier cached 
ID would not handle deletion.



##########
fe/fe-core/src/main/java/org/apache/doris/cloud/backup/CloudRestoreJob.java:
##########
@@ -494,6 +497,11 @@ private void handleMetaObject(MetaSeriviceOperation 
operation) throws DdlExcepti
 
     private void handleOlapTableMeta(MetaSeriviceOperation operation, 
OlapTable olapTable,
                                      Collection<Partition> partitions) throws 
DdlException {
+        if (partitions.isEmpty()) {
+            LOG.info("cloud restore job skip {} partitions, dbId: {}, 
tableName: {}, vault name: {}",
+                    operation, dbId, olapTable.getName(), storageVaultName);
+            return;

Review Comment:
   [P1] Do not register an unpartitioned table without its implicit partition
   
   The new test exercises a `SinglePartitionInfo` table, removes its only 
partition, and this return lets the restore register that zero-partition table 
successfully. It is then permanently unusable: inserts fail with 
`ERR_EMPTY_PARTITION_IN_TABLE`, while `ADD PARTITION` is rejected for 
unpartitioned tables. The index-only lifecycle needed for valid empty 
RANGE/LIST tables does not repair this case. Please either reject exclusion of 
an unpartitioned table's sole implicit partition, or recreate an empty implicit 
partition/tablets so the restored table remains writable, and cover that 
outcome end to end.



##########
fe/fe-core/src/main/java/org/apache/doris/cloud/backup/CloudRestoreJob.java:
##########
@@ -494,6 +497,11 @@ private void handleMetaObject(MetaSeriviceOperation 
operation) throws DdlExcepti
 
     private void handleOlapTableMeta(MetaSeriviceOperation operation, 
OlapTable olapTable,
                                      Collection<Partition> partitions) throws 
DdlException {
+        if (partitions.isEmpty()) {

Review Comment:
   [P1] Preserve the index lifecycle for an empty restored table
   
   This avoids the invalid empty-partition RPCs, but it also skips the 
index-only lifecycle used by normal empty Cloud table creation. That path still 
calls prepare/commit materialized-index; commit-index creates the versioned 
index mappings and initializes the table version. A later ADD PARTITION only 
commits partition keys, so it does not repair the missing index mappings. The 
orphan recycler then sees no index-inverted key for the table and can delete 
the newly added partition and table-version metadata. Please use a replay-safe 
index PREPARE/COMMIT lifecycle for zero partitions, including cleanup of 
prepared/committed transient IDs on cancellation or PENDING replay, instead of 
suppressing all Meta Service work.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to