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