HBASE-26169 Fix MapReduceBackupCopyJob.BackupDistCp.getKey() concatenates strings

This commit is contained in:
xingrufei 2021-08-05 11:59:05 +08:00
parent da950b9be2
commit 060af59802
1 changed files with 3 additions and 3 deletions

View File

@ -331,12 +331,12 @@ public class MapReduceBackupCopyJob implements BackupCopyJob {
private Text getKey(Path path) {
int level = conf.getInt(NUMBER_OF_LEVELS_TO_PRESERVE_KEY, 1);
int count = 0;
String relPath = "";
StringBuilder relPath = new StringBuilder();
while (count++ < level) {
relPath = Path.SEPARATOR + path.getName() + relPath;
relPath.insert(0, Path.SEPARATOR + path.getName());
path = path.getParent();
}
return new Text(relPath);
return new Text(relPath.toString());
}
private List<Path> getSourceFiles() throws NoSuchFieldException, SecurityException,