Skip to content

Commit ff2c9b3

Browse files
committed
Merge remote-tracking branch 'upstream/2.1' into 3.1
2 parents c0979fd + d53c1c6 commit ff2c9b3

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@
4848
import org.apache.hadoop.fs.RawLocalFileSystem;
4949
import org.apache.hadoop.io.Text;
5050
import org.junit.jupiter.api.Test;
51+
import org.slf4j.Logger;
52+
import org.slf4j.LoggerFactory;
5153

5254
public class VerifySerialRecoveryIT extends ConfigurableMacBase {
5355

56+
private static final Logger log = LoggerFactory.getLogger(VerifySerialRecoveryIT.class);
57+
5458
private static final byte[] HEXCHARS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
5559
0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
5660

@@ -116,33 +120,32 @@ public void testSerializedRecovery() throws Exception {
116120
assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
117121
ts.getProcess().waitFor();
118122
String result = ts.readStdOut();
119-
for (String line : result.split("\n")) {
120-
System.out.println(line);
121-
}
123+
log.info(result);
124+
122125
// walk through the output, verifying that only a single normal recovery was running at one
123126
// time
124-
boolean started = false;
127+
boolean ongoingRecovery = false;
125128
int recoveries = 0;
126129
var pattern =
127130
Pattern.compile(".*recovered \\d+ mutations creating \\d+ entries from \\d+ walogs.*");
128131
for (String line : result.split("\n")) {
129-
// ignore metadata tables
132+
// ignore metadata and root tables
130133
if (line.contains(AccumuloTable.METADATA.tableId().canonical())
131134
|| line.contains(AccumuloTable.ROOT.tableId().canonical())) {
132135
continue;
133136
}
134137
if (line.contains("recovering data from walogs")) {
135-
assertFalse(started);
136-
started = true;
138+
assertFalse(ongoingRecovery, "Saw recovery start before previous recovery finished");
139+
ongoingRecovery = true;
137140
recoveries++;
138141
}
139142
if (pattern.matcher(line).matches()) {
140-
assertTrue(started);
141-
started = false;
143+
assertTrue(ongoingRecovery, "Saw recovery end without recovery start");
144+
ongoingRecovery = false;
142145
}
143146
}
144-
assertFalse(started);
145-
assertTrue(recoveries > 0);
147+
assertFalse(ongoingRecovery, "Expected no ongoing recovery at end of test");
148+
assertTrue(recoveries > 0, "Expected at least one recovery to have occurred");
146149
}
147150
}
148151
}

0 commit comments

Comments
 (0)