DieterDP-ng commented on code in PR #7662:
URL: https://github.com/apache/hbase/pull/7662#discussion_r2716778080


##########
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java:
##########
@@ -647,26 +635,32 @@ public Map<TableName, List<BackupInfo>> 
getBackupHistoryForTableSet(Set<TableNam
   }
 
   /**
-   * Get all backup infos passing the given filters (ordered by ascending 
backup id)
+   * Get all backup information passing the given filters, ordered by 
descending backupId. I.e. from
+   * newest to oldest.
    */
-  public List<BackupInfo> getBackupInfos(BackupInfo.Filter... toInclude) 
throws IOException {
-    return getBackupInfos(Integer.MAX_VALUE, toInclude);
+  public List<BackupInfo> getBackupHistory(BackupInfo.Filter... toInclude) 
throws IOException {
+    return getBackupHistory(true, Integer.MAX_VALUE, toInclude);
   }
 
   /**
-   * Get the first n backup infos passing the given filters (ordered by 
ascending backup id)
+   * Retrieves the first n entries of the sorted, filtered list of backup 
infos.
+   * @param newToOld sort by descending backupId if true (i.e. newest to 
oldest), or by ascending
+   *                 backupId (i.e. oldest to newest) if false
+   * @param n        number of entries to return
    */
-  public List<BackupInfo> getBackupInfos(int n, BackupInfo.Filter... 
toInclude) throws IOException {
+  public List<BackupInfo> getBackupHistory(boolean newToOld, int n, 
BackupInfo.Filter... toInclude)

Review Comment:
   Strictly speaking, because the BackupInfos are stored using BackupIds as 
key, the ordering promised in this method will break over 261 years, when the 
epoch `9999999999` becomes `10000000000`. This is a side effect of backupIds 
not being 0-padded when stored.
   
   I.e., the scan would return out-of-order results:
   
   - `backup_10000000000`
   - `backup_9999999998`
   - `backup_9999999999`
   
   But I guess that's acceptable.



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