|
48 | 48 | import org.apache.hadoop.fs.RawLocalFileSystem;
|
49 | 49 | import org.apache.hadoop.io.Text;
|
50 | 50 | import org.junit.jupiter.api.Test;
|
| 51 | +import org.slf4j.Logger; |
| 52 | +import org.slf4j.LoggerFactory; |
51 | 53 |
|
52 | 54 | public class VerifySerialRecoveryIT extends ConfigurableMacBase {
|
53 | 55 |
|
| 56 | + private static final Logger log = LoggerFactory.getLogger(VerifySerialRecoveryIT.class); |
| 57 | + |
54 | 58 | private static final byte[] HEXCHARS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
|
55 | 59 | 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
|
56 | 60 |
|
@@ -116,33 +120,32 @@ public void testSerializedRecovery() throws Exception {
|
116 | 120 | assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
|
117 | 121 | ts.getProcess().waitFor();
|
118 | 122 | String result = ts.readStdOut();
|
119 |
| - for (String line : result.split("\n")) { |
120 |
| - System.out.println(line); |
121 |
| - } |
| 123 | + log.info(result); |
| 124 | + |
122 | 125 | // walk through the output, verifying that only a single normal recovery was running at one
|
123 | 126 | // time
|
124 |
| - boolean started = false; |
| 127 | + boolean ongoingRecovery = false; |
125 | 128 | int recoveries = 0;
|
126 | 129 | var pattern =
|
127 | 130 | Pattern.compile(".*recovered \\d+ mutations creating \\d+ entries from \\d+ walogs.*");
|
128 | 131 | for (String line : result.split("\n")) {
|
129 |
| - // ignore metadata tables |
| 132 | + // ignore metadata and root tables |
130 | 133 | if (line.contains(AccumuloTable.METADATA.tableId().canonical())
|
131 | 134 | || line.contains(AccumuloTable.ROOT.tableId().canonical())) {
|
132 | 135 | continue;
|
133 | 136 | }
|
134 | 137 | 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; |
137 | 140 | recoveries++;
|
138 | 141 | }
|
139 | 142 | if (pattern.matcher(line).matches()) {
|
140 |
| - assertTrue(started); |
141 |
| - started = false; |
| 143 | + assertTrue(ongoingRecovery, "Saw recovery end without recovery start"); |
| 144 | + ongoingRecovery = false; |
142 | 145 | }
|
143 | 146 | }
|
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"); |
146 | 149 | }
|
147 | 150 | }
|
148 | 151 | }
|
0 commit comments