@Override
    public int compareTo(BackupImage other) {
      String thisBackupId = this.getBackupId();
      String otherBackupId = other.getBackupId();
      int index1 = thisBackupId.lastIndexOf("_");
      int index2 = otherBackupId.lastIndexOf("_");
      String name1 = thisBackupId.substring(0, index1);
      String name2 = otherBackupId.substring(0, index2);
      if (name1.equals(name2)) {
        Long thisTS = Long.valueOf(thisBackupId.substring(index1 + 1));
        Long otherTS = Long.valueOf(otherBackupId.substring(index2 + 1));
        return thisTS.compareTo(otherTS);
      } else {
        return name1.compareTo(name2);
      }
    }
This method deliberately does not include the backup root dir on the produced proto. This is
because we don't want to persist the root dir on the backup itself, so that backups can still
be used after they have moved locations. A restore's operator will always provide the root
dir.
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java