taklwu commented on code in PR #8845:
URL: https://github.com/apache/hbase/pull/8845#discussion_r4592339078


##########
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupMergeJob.java:
##########


Review Comment:
   Merged-away backups keep their markers if their directory delete fails. 
`deleteBackupImages` removes system-table rows first, then directories, and 
only logs a WARN if a directory delete fails. That leaves an old incremental 
backup directory with a valid marker, even though its data now lives in the 
merged backup. Deleting the marker first, or relying on repair 
(checkRemoveBackupImages), avoids this.



##########
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/TableBackupClient.java:
##########


Review Comment:
   Cleanup removes the marker after the data, not before.
   
   TableBackupClient.cleanupTargetDir deletes table directories first and the 
marker last (lines 200–226). If a table delete throws, the method jumps to the 
catch and the marker is left behind.
   
   BackupUtils.cleanupTargetDir, used by backup delete, deletes table 
directories one by one and the backup directory, with its marker, last (lines 
543–559). A crash or IOException in between, which is only logged, leaves a 
marker on a backup with tables missing. That's a false positive, which is the 
one thing external consumers can't detect.
   
   The rule should be: write the marker last, delete it first.



##########
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/TableBackupClient.java:
##########


Review Comment:
   Marker written before the lock is released, so a short false-positive window.
   
   If finishBackupSession() (which releases the backup lock) throws, 
FullTableBackupClient.execute catches it and calls failBackup. That marks the 
backup FAILED, and cleanupTargetDir deletes the table data and the marker. A 
consumer polling for the marker may already have started reading. Writing the 
marker after finishBackupSession() fixes this.



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