HBASE-21457 BackupUtils#getWALFilesOlderThan refers to wrong FileSystem
This commit is contained in:
parent
64c4861272
commit
00acda3c58
|
@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.client.RegionInfo;
|
|||
import org.apache.hadoop.hbase.client.TableDescriptor;
|
||||
import org.apache.hadoop.hbase.regionserver.HRegion;
|
||||
import org.apache.hadoop.hbase.tool.LoadIncrementalHFiles;
|
||||
import org.apache.hadoop.hbase.util.CommonFSUtils;
|
||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||
import org.apache.hadoop.hbase.util.FSTableDescriptors;
|
||||
import org.apache.hadoop.hbase.util.FSUtils;
|
||||
|
@ -249,9 +250,9 @@ public final class BackupUtils {
|
|||
*/
|
||||
public static List<String> getWALFilesOlderThan(final Configuration c,
|
||||
final HashMap<String, Long> hostTimestampMap) throws IOException {
|
||||
Path rootDir = FSUtils.getRootDir(c);
|
||||
Path logDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME);
|
||||
Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
|
||||
Path walRootDir = CommonFSUtils.getWALRootDir(c);
|
||||
Path logDir = new Path(walRootDir, HConstants.HREGION_LOGDIR_NAME);
|
||||
Path oldLogDir = new Path(walRootDir, HConstants.HREGION_OLDLOGDIR_NAME);
|
||||
List<String> logFiles = new ArrayList<>();
|
||||
|
||||
PathFilter filter = p -> {
|
||||
|
@ -271,9 +272,9 @@ public final class BackupUtils {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
FileSystem fs = FileSystem.get(c);
|
||||
logFiles = BackupUtils.getFiles(fs, logDir, logFiles, filter);
|
||||
logFiles = BackupUtils.getFiles(fs, oldLogDir, logFiles, filter);
|
||||
FileSystem walFs = CommonFSUtils.getWALFileSystem(c);
|
||||
logFiles = BackupUtils.getFiles(walFs, logDir, logFiles, filter);
|
||||
logFiles = BackupUtils.getFiles(walFs, oldLogDir, logFiles, filter);
|
||||
return logFiles;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ import org.apache.hadoop.hbase.security.UserProvider;
|
|||
import org.apache.hadoop.hbase.security.access.SecureTestUtil;
|
||||
import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.hadoop.hbase.util.CommonFSUtils;
|
||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||
import org.apache.hadoop.hbase.wal.WALFactory;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -304,6 +305,10 @@ public class TestBackupBase {
|
|||
conf2.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/2");
|
||||
TEST_UTIL2 = new HBaseTestingUtility(conf2);
|
||||
TEST_UTIL2.setZkCluster(TEST_UTIL.getZkCluster());
|
||||
TEST_UTIL2.startMiniDFSCluster(3);
|
||||
String root2 = TEST_UTIL2.getConfiguration().get("fs.defaultFS");
|
||||
Path p = new Path(new Path(root2), "/tmp/wal");
|
||||
CommonFSUtils.setWALRootDir(TEST_UTIL2.getConfiguration(), p);
|
||||
TEST_UTIL2.startMiniCluster();
|
||||
}
|
||||
conf1 = TEST_UTIL.getConfiguration();
|
||||
|
|
Loading…
Reference in New Issue