HBASE-26564 Retire the method visitLogEntryBeforeWrite without RegionInfo in WALActionListner (#3938)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Yutong Xiao 2021-12-27 23:59:13 +08:00 committed by GitHub
parent 543582e7eb
commit a599d52820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 25 deletions

View File

@ -810,7 +810,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;

View File

@ -1129,7 +1129,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);

View File

@ -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.

View File

@ -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);
}

View File

@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
@ -407,7 +408,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()) {

View File

@ -545,7 +545,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();

View File

@ -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();

View File

@ -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

View File

@ -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");