anmolnar commented on PR #8845:
URL: https://github.com/apache/hbase/pull/8845#issuecomment-6985157161

   > 🤖 **AI-assisted review** — drafted by Claude on behalf of @anmolnar.
   
   A few remaining items:
   
   #### 1. Writing the marker after the lock is released can recreate a deleted 
backup directory
   With the marker now written after `finishBackupSession()` / 
`finishBackupExclusiveOperation()`, a delete or merge from another client can 
take the lock and remove `<backupId>/` before the write. `fs.create()` creates 
missing parents, so we'd end up with an otherwise-empty backup directory 
containing only `.backup.complete`. An external consumer would treat that as a 
complete backup with no data.
   
   The window is tiny, but the fix is cheap. Keep the new ordering, and create 
the marker with `fs.createNonRecursive(...)` (supported by HDFS, local, and 
S3A) so the write fails when the parent is gone. The existing catch already 
logs and moves on, which is the right outcome.
   
   #### 2. Table removal now hides the whole backup from cross-cluster PITR
   Deleting the marker in `removeTableFromBackupImage` is the safe choice, and 
the Javadoc covers it. A consequence worth stating explicitly for #8835: a 
backup with one removed table becomes invisible to external consumers, 
including the tables that are still present.
   
   Minor: the marker is deleted *after* `sysTable.updateBackupInfo(info)`. If 
the delete throws, the system table already lists fewer tables while the data 
and marker are still on disk. Moving the marker deletion before the 
system-table update would match the "deleted first" rule in the Javadoc.
   
   #### 3. The two `cleanupTargetDir`s handle a failed marker delete differently
   `TableBackupClient` logs and continues deleting data. `BackupUtils` aborts. 
Both seem defensible: for a failed backup the data is partial anyway, and for a 
deliberate delete aborting keeps marker and data together. Two follow-ups:
   - Can you confirm that callers of `BackupUtils.cleanupTargetDir` don't go on 
to delete the backup directory or its system-table row after that exception is 
swallowed? Otherwise the "both remain, which is consistent" comment doesn't 
hold.
   - A one-line comment in `TableBackupClient` on why it continues would help 
the next reader.
   
   #### 4. Tests for the new paths
   - **Merge repair writes the marker.** The interesting case is a merge that 
fails after the tmp directory is deleted, then repair, then the marker exists. 
`TestIncrementalBackupMergeWithFailures` has the scaffolding but doesn't assert 
the marker after repair.
   - **`removeTableFromBackupImage` removes the marker** while the backup stays 
COMPLETE.
   - In the "Repair is required" branch of 
`TestIncrementalBackupMergeWithFailures`, the no-marker assertion only holds 
for failure stages after the rename. If any stage fails after 
`updateProcessedTablesForMerge` but before the rename, the original directory 
and marker are still there. Please double-check that it passes for every stage.


-- 
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]

Reply via email to