You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2021/04/30 17:29:42 UTC

[kudu] 05/05: [backup] Ensure listed backups are sorted by table

This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit c7ede99d71ef9343f2ccdd57c147d0895223b1b7
Author: Grant Henke <gr...@apache.org>
AuthorDate: Fri Apr 30 09:45:50 2021 -0500

    [backup] Ensure listed backups are sorted by table
    
    Recently we saw a weird failure in the tests that list all the
    backup graphs (instead of providing exact names) where
    the order was descending instead of ascending. This patch
    forces the backup graphs to be sorted to ensure the listing
    order stays consistent.
    
    Change-Id: Icad68f7a3d399c1a5fc302e6328143d4b01227a0
    Reviewed-on: http://gerrit.cloudera.org:8080/17375
    Tested-by: Grant Henke <gr...@apache.org>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 .../src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala
index 8303da9..0fe39d5 100644
--- a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala
+++ b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala
@@ -43,7 +43,8 @@ object KuduBackupLister {
     val io: BackupIO = new BackupIO(new Configuration(), options.rootPath)
     val backupGraphs =
       if (sortedTables.isEmpty)
-        io.readAllBackupGraphs()
+        // Sort by table name for a consistent ordering.
+        io.readAllBackupGraphs().sortBy(_.backupBase.metadata.getTableName)
       else
         io.readBackupGraphsByTableName(sortedTables)