Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ public TableWALActionListener(RegionInfo region) {
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ protected final boolean appendEntry(W writer, FSWALEntry entry) throws IOExcepti
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ default void logCloseRequested() {}
*/
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void postLogRoll(Path oldPath, Path newPath) throws IOException {
}

@Override
public void visitLogEntryBeforeWrite(WALKey logKey, WALEdit logEdit) throws IOException {
public void visitLogEntryBeforeWrite(RegionInfo info, WALKey logKey, WALEdit logEdit) {
scopeWALEdits(logKey, logEdit, conf);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
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;
Expand Down Expand Up @@ -407,7 +408,7 @@ static class FindBulkHBaseListener extends TestWALActionsListener.DummyWALAction
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ private AbstractFSWAL<?> createHoldingWAL(String testName, AtomicBoolean startHo
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ public void testUnflushedSeqIdTracking() throws IOException, InterruptedExceptio
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,6 @@ static class DumbWALActionsListener implements WALActionsListener {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private HRegion openRegion(final FileSystem fs, final Path dir, final TableDescr
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");
Expand Down