HBASE-26564 Retire the method visitLogEntryBeforeWrite without RegionInfo in WALActionListner (#3985)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
c28a266613
commit
c6a287930b
|
@ -794,7 +794,7 @@ public class TestCellBasedImportExport2 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
if (logKey.getTableName().getNameAsString().equalsIgnoreCase(
|
||||
this.regionInfo.getTable().getNameAsString()) && (!logEdit.isMetaEdit())) {
|
||||
isVisited = true;
|
||||
|
|
|
@ -813,7 +813,7 @@ public class TestImportExport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
if (logKey.getTableName().getNameAsString().equalsIgnoreCase(
|
||||
this.regionInfo.getTable().getNameAsString()) && (!logEdit.isMetaEdit())) {
|
||||
isVisited = true;
|
||||
|
|
|
@ -1051,7 +1051,7 @@ public abstract class AbstractFSWAL<W extends WriterBase> implements WAL {
|
|||
coprocessorHost.preWALWrite(entry.getRegionInfo(), entry.getKey(), entry.getEdit());
|
||||
if (!listeners.isEmpty()) {
|
||||
for (WALActionsListener i : listeners) {
|
||||
i.visitLogEntryBeforeWrite(entry.getKey(), entry.getEdit());
|
||||
i.visitLogEntryBeforeWrite(entry.getRegionInfo(), entry.getKey(), entry.getEdit());
|
||||
}
|
||||
}
|
||||
doAppend(writer, entry);
|
||||
|
|
|
@ -89,16 +89,6 @@ public interface WALActionsListener {
|
|||
*/
|
||||
default void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {}
|
||||
|
||||
/**
|
||||
* @param logKey
|
||||
* @param logEdit TODO: Retire this in favor of
|
||||
* {@link #visitLogEntryBeforeWrite(RegionInfo, WALKey, WALEdit)} It only exists to get
|
||||
* scope when replicating. Scope should be in the WALKey and not need us passing in a
|
||||
* <code>htd</code>.
|
||||
* @throws IOException If failed to parse the WALEdit
|
||||
*/
|
||||
default void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) throws IOException {}
|
||||
|
||||
/**
|
||||
* For notification post append to the writer. Used by metrics system at least.
|
||||
* TODO: Combine this with above.
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.replication.regionserver;
|
|||
import java.io.IOException;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.client.RegionInfo;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
import org.apache.hadoop.hbase.replication.ReplicationUtils;
|
||||
import org.apache.hadoop.hbase.wal.WALEdit;
|
||||
|
@ -53,7 +54,7 @@ class ReplicationSourceWALActionListener implements WALActionsListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) throws IOException {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
scopeWALEdits(logKey, logEdit, conf);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.TableExistsException;
|
|||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.ClientServiceCallable;
|
||||
import org.apache.hadoop.hbase.client.ClusterConnection;
|
||||
import org.apache.hadoop.hbase.client.RegionInfo;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||
import org.apache.hadoop.hbase.client.RpcRetryingCaller;
|
||||
|
@ -444,7 +445,7 @@ public class TestHRegionServerBulkLoad {
|
|||
private boolean found = false;
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
for (Cell cell : logEdit.getCells()) {
|
||||
KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
|
||||
for (Map.Entry entry : kv.toStringMap().entrySet()) {
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.client.ClusterConnection;
|
|||
import org.apache.hadoop.hbase.client.Connection;
|
||||
import org.apache.hadoop.hbase.client.Durability;
|
||||
import org.apache.hadoop.hbase.client.Put;
|
||||
import org.apache.hadoop.hbase.client.RegionInfo;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.DamagedWALException;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.FSHLog;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
|
@ -535,26 +536,6 @@ public class TestWALLockup {
|
|||
}
|
||||
}
|
||||
|
||||
static class DummyWALActionsListener implements WALActionsListener {
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit)
|
||||
throws IOException {
|
||||
if (logKey.getTableName().getNameAsString().equalsIgnoreCase("sleep")) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (logKey.getTableName().getNameAsString()
|
||||
.equalsIgnoreCase("DamagedWALException")) {
|
||||
throw new DamagedWALException("Failed appending");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A region on which you must call {@link HBaseTestingUtility#closeRegionAndWAL(HRegion)}
|
||||
* when done.
|
||||
|
|
|
@ -537,7 +537,7 @@ public abstract class AbstractTestFSWAL {
|
|||
wal.init();
|
||||
wal.registerWALActionsListener(new WALActionsListener() {
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) throws IOException {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
if (startHoldingForAppend.get()) {
|
||||
try {
|
||||
holdAppend.await();
|
||||
|
|
|
@ -240,8 +240,7 @@ public class TestFSHLog extends AbstractTestFSWAL {
|
|||
log.init();
|
||||
log.registerWALActionsListener(new WALActionsListener() {
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit)
|
||||
throws IOException {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
if (startHoldingForAppend.get()) {
|
||||
try {
|
||||
holdAppend.await();
|
||||
|
|
|
@ -675,13 +675,6 @@ public class TestWALFactory {
|
|||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
increments++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) {
|
||||
// To change body of implemented methods use File | Settings | File
|
||||
// Templates.
|
||||
increments++;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -471,7 +471,7 @@ public final class WALPerformanceEvaluation extends Configured implements Tool {
|
|||
private int appends = 0;
|
||||
|
||||
@Override
|
||||
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) {
|
||||
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
|
||||
this.appends++;
|
||||
if (this.appends % whenToRoll == 0) {
|
||||
LOG.info("Rolling after " + appends + " edits");
|
||||
|
|
Loading…
Reference in New Issue