kgeisz commented on code in PR #7150:
URL: https://github.com/apache/hbase/pull/7150#discussion_r2220525340
##########
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/AbstractPitrRestoreHandler.java:
##########
@@ -259,6 +262,31 @@ private PitrBackupMetadata getValidBackup(TableName
sTableName, TableName tTable
return null;
}
+ /**
+ * Checks if any bulk load operation occurred for the specified table post
last successful backup
+ * and before restore time.
+ * @param conn Active HBase connection
+ * @param sTableName Table for which to check bulk load history
+ * @param backup Last successful backup before the target recovery time
+ * @param endTime Target recovery time
+ * @throws IOException if a bulkload entry is found in between backup time
and endtime
+ */
+ private void checkBulkLoadAfterBackup(Connection conn, TableName sTableName,
+ PitrBackupMetadata backup, long endTime) throws IOException {
+ try (BackupSystemTable backupSystemTable = new BackupSystemTable(conn)) {
+ List<BulkLoad> bulkLoads =
backupSystemTable.readBulkloadRows(List.of(sTableName));
+ for (BulkLoad load : bulkLoads) {
+ long lastBackupTs = (backup.getType() == BackupType.FULL)
+ ? backup.getStartTs()
+ : backup.getIncrCommittedWalTs();
+ if (lastBackupTs < load.getTimestamp() && load.getTimestamp() <
endTime) {
+ throw new IOException("Bulk load operation detected after last
successful backup for "
+ + "table: " + sTableName);
Review Comment:
Do you think this error message should be a little more descriptive? It is
saying why there is an error, but it doesn't necessarily tell the user what
they should be doing instead to prevent this error.
My understanding is the user is supposed to perform a full or incremental
backup after doing a bulkload. To me, this function is detecting that a
bulkload has occurred since the last backup, and it is correctly throwing an
error. However, the message isn't telling the user they should do another
backup after bulkloading in order to get around this error.
--
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]