Skip to content

HBASE-27822 TestFromClientSide5.testAppendWithoutWAL is flaky #5211

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 1 commit into from
May 4, 2023
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 @@ -98,8 +98,8 @@ protected static boolean isSameParameterizedCluster(Class<?> registryImpl, int n
return confClass.getName().equals(registryImpl.getName()) && numHedgedReqs == hedgedReqConfig;
}

protected static final void initialize(Class<?> registryImpl, int numHedgedReqs, Class<?>... cps)
throws Exception {
protected static final void initialize(Class<? extends ConnectionRegistry> registryImpl,
int numHedgedReqs, Class<?>... cps) throws Exception {
// initialize() is called for every unit test, however we only want to reset the cluster state
// at the end of every parameterized run.
if (isSameParameterizedCluster(registryImpl, numHedgedReqs)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -91,6 +90,7 @@
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -115,21 +115,23 @@ public class TestFromClientSide5 extends FromClientSideBase {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestFromClientSide5.class);

@Rule
public TableNameTestRule name = new TableNameTestRule();

// To keep the child classes happy.
TestFromClientSide5() {
}

public TestFromClientSide5(Class registry, int numHedgedReqs) throws Exception {
public TestFromClientSide5(Class<? extends ConnectionRegistry> registry, int numHedgedReqs)
throws Exception {
initialize(registry, numHedgedReqs, MultiRowMutationEndpoint.class);
}

@Parameterized.Parameters
public static Collection parameters() {
return Arrays.asList(new Object[][] { { MasterRegistry.class, 1 }, { MasterRegistry.class, 2 },
{ ZKConnectionRegistry.class, 1 } });
@Parameters(name = "{index}: registry={0}, numHedgedReqs={1}")
public static List<Object[]> parameters() {
return Arrays.asList(new Object[] { MasterRegistry.class, 1 },
new Object[] { MasterRegistry.class, 2 }, new Object[] { ZKConnectionRegistry.class, 1 });
}

@AfterClass
Expand Down Expand Up @@ -771,10 +773,20 @@ private List<Result> doAppend(final boolean walUsed) throws IOException {
t.put(put_1);
List<Result> results = new LinkedList<>();
try (ResultScanner scanner = t.getScanner(s)) {
// get one row(should be row3) from the scanner to make sure that we have send a request to
// region server, which means we have already set the read point, so later we should not see
// the new appended values.
Result r = scanner.next();
assertNotNull(r);
results.add(r);
t.append(append_1);
t.append(append_2);
t.append(append_3);
for (Result r : scanner) {
for (;;) {
r = scanner.next();
if (r == null) {
break;
}
results.add(r);
}
}
Expand All @@ -788,11 +800,11 @@ public void testAppendWithoutWAL() throws Exception {
List<Result> resultsWithWal = doAppend(true);
List<Result> resultsWithoutWal = doAppend(false);
assertEquals(resultsWithWal.size(), resultsWithoutWal.size());
for (int i = 0; i != resultsWithWal.size(); ++i) {
for (int i = 0; i < resultsWithWal.size(); ++i) {
Result resultWithWal = resultsWithWal.get(i);
Result resultWithoutWal = resultsWithoutWal.get(i);
assertEquals(resultWithWal.rawCells().length, resultWithoutWal.rawCells().length);
for (int j = 0; j != resultWithWal.rawCells().length; ++j) {
for (int j = 0; j < resultWithWal.rawCells().length; ++j) {
Cell cellWithWal = resultWithWal.rawCells()[j];
Cell cellWithoutWal = resultWithoutWal.rawCells()[j];
assertArrayEquals(CellUtil.cloneRow(cellWithWal), CellUtil.cloneRow(cellWithoutWal));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.hadoop.hbase.client;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
import org.apache.hadoop.hbase.regionserver.NoOpScanPolicyObserver;
Expand All @@ -27,7 +27,7 @@
import org.junit.AfterClass;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
* Test all client operations with a coprocessor that just implements the default flush/compact/scan
Expand All @@ -41,18 +41,19 @@ public class TestFromClientSideWithCoprocessor5 extends TestFromClientSide5 {

// Override the parameters from the parent class. We just want to run it for the default
// param combination.
@Parameterized.Parameters
public static Collection parameters() {
return Arrays
.asList(new Object[][] { { MasterRegistry.class, 1 }, { ZKConnectionRegistry.class, 1 } });
@Parameters(name = "{index}: registry={0}, numHedgedReqs={1}")
public static List<Object[]> parameters() {
return Arrays.asList(new Object[] { MasterRegistry.class, 1 },
new Object[] { ZKConnectionRegistry.class, 1 });
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
afterClass();
}

public TestFromClientSideWithCoprocessor5(Class registry, int numHedgedReqs) throws Exception {
public TestFromClientSideWithCoprocessor5(Class<? extends ConnectionRegistry> registry,
int numHedgedReqs) throws Exception {
initialize(registry, numHedgedReqs, NoOpScanPolicyObserver.class,
MultiRowMutationEndpoint.class);
}
Expand Down