Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.1' into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DomGarguilo committed Dec 13, 2024
2 parents c0979fd + d53c1c6 commit ff2c9b3
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class VerifySerialRecoveryIT extends ConfigurableMacBase {

private static final Logger log = LoggerFactory.getLogger(VerifySerialRecoveryIT.class);

private static final byte[] HEXCHARS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66};

Expand Down Expand Up @@ -116,33 +120,32 @@ public void testSerializedRecovery() throws Exception {
assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
ts.getProcess().waitFor();
String result = ts.readStdOut();
for (String line : result.split("\n")) {
System.out.println(line);
}
log.info(result);

// walk through the output, verifying that only a single normal recovery was running at one
// time
boolean started = false;
boolean ongoingRecovery = false;
int recoveries = 0;
var pattern =
Pattern.compile(".*recovered \\d+ mutations creating \\d+ entries from \\d+ walogs.*");
for (String line : result.split("\n")) {
// ignore metadata tables
// ignore metadata and root tables
if (line.contains(AccumuloTable.METADATA.tableId().canonical())
|| line.contains(AccumuloTable.ROOT.tableId().canonical())) {
continue;
}
if (line.contains("recovering data from walogs")) {
assertFalse(started);
started = true;
assertFalse(ongoingRecovery, "Saw recovery start before previous recovery finished");
ongoingRecovery = true;
recoveries++;
}
if (pattern.matcher(line).matches()) {
assertTrue(started);
started = false;
assertTrue(ongoingRecovery, "Saw recovery end without recovery start");
ongoingRecovery = false;
}
}
assertFalse(started);
assertTrue(recoveries > 0);
assertFalse(ongoingRecovery, "Expected no ongoing recovery at end of test");
assertTrue(recoveries > 0, "Expected at least one recovery to have occurred");
}
}
}

0 comments on commit ff2c9b3

Please sign in to comment.