HBASE-24830 Some tests involving RS crash fail with NullPointerException after HBASE-24632 in branch-2

This commit is contained in:
stack 2020-08-07 09:34:41 -07:00
parent 4a2f3f89f4
commit cee7431d0a
3 changed files with 16 additions and 6 deletions

View File

@ -104,7 +104,8 @@ public class SplitLogWorker implements Runnable {
// 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;

View File

@ -197,8 +197,6 @@ public class WALSplitter {
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,

View File

@ -32,6 +32,9 @@ import java.util.concurrent.atomic.AtomicLong;
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;
@ -172,13 +175,17 @@ public class TestReplicationSource {
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");
@ -383,6 +390,10 @@ public class TestReplicationSource {
protected void doStop() {
notifyStopped();
}
@Override public boolean canReplicateToSameCluster() {
return true;
}
}
/**