Skip to content

Commit

Permalink
HBASE-24830 Some tests involving RS crash fail with NullPointerExcept…
Browse files Browse the repository at this point in the history
…ion after HBASE-24632 in branch-2
  • Loading branch information
saintstack committed Aug 8, 2020
1 parent 303db63 commit 6875d96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ static Status splitLog(String filename, CancelableProgressable p, Configuration
// encountered a bad non-retry-able persistent error.
try {
SplitLogWorkerCoordination splitLogWorkerCoordination =
server.getCoordinatedStateManager().getSplitLogWorkerCoordination();
server.getCoordinatedStateManager() == null ? null
: server.getCoordinatedStateManager().getSplitLogWorkerCoordination();
if (!WALSplitter.splitLogFile(walDir, fs.getFileStatus(new Path(walDir, filename)), fs, conf,
p, sequenceIdChecker, splitLogWorkerCoordination, factory, server)) {
return Status.PREEMPTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ public static boolean splitLogFile(Path walDir, FileStatus logfile, FileSystem w
Configuration conf, CancelableProgressable reporter, LastSequenceId idChecker,
SplitLogWorkerCoordination splitLogWorkerCoordination, WALFactory factory,
RegionServerServices rsServices) throws IOException {
Preconditions.checkNotNull(splitLogWorkerCoordination,
"Can't be null; needed to propagate WAL corruption if any found");
Path rootDir = CommonFSUtils.getRootDir(conf);
FileSystem rootFS = rootDir.getFileSystem(conf);
WALSplitter splitter = new WALSplitter(factory, conf, walDir, walFS, rootDir, rootFS, idChecker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
Expand Down Expand Up @@ -172,13 +175,17 @@ public void testWALEntryFilter() throws IOException {
TEST_UTIL.waitFor(30000, () -> rs.getWalEntryFilter() != null);
WALEntryFilter wef = rs.getWalEntryFilter();
// Test non-system WAL edit.
WALEdit we = new WALEdit().add(CellBuilderFactory.create(CellBuilderType.DEEP_COPY).
setRow(HConstants.EMPTY_START_ROW).
setFamily(HConstants.CATALOG_FAMILY).
setType(Cell.Type.Put).build());
WAL.Entry e = new WAL.Entry(new WALKeyImpl(HConstants.EMPTY_BYTE_ARRAY,
TableName.valueOf("test"), -1), new WALEdit());
TableName.valueOf("test"), -1, -1, uuid), we);
assertTrue(wef.filter(e) == e);
// Test system WAL edit.
e = new WAL.Entry(
new WALKeyImpl(HConstants.EMPTY_BYTE_ARRAY, TableName.META_TABLE_NAME, -1),
new WALEdit());
new WALKeyImpl(HConstants.EMPTY_BYTE_ARRAY, TableName.META_TABLE_NAME, -1, -1, uuid),
we);
assertNull(wef.filter(e));
} finally {
rs.terminate("Done");
Expand Down Expand Up @@ -383,6 +390,10 @@ protected void doStart() {
protected void doStop() {
notifyStopped();
}

@Override public boolean canReplicateToSameCluster() {
return true;
}
}

/**
Expand Down

0 comments on commit 6875d96

Please sign in to comment.