|
19 | 19 | package org.apache.accumulo.test;
|
20 | 20 |
|
21 | 21 | import java.time.Duration;
|
22 |
| -import java.util.List; |
23 |
| -import java.util.Map.Entry; |
24 | 22 | import java.util.SortedSet;
|
25 | 23 | import java.util.TreeSet;
|
26 |
| -import java.util.UUID; |
27 | 24 | import java.util.concurrent.atomic.AtomicInteger;
|
28 | 25 |
|
29 | 26 | import org.apache.accumulo.core.client.Accumulo;
|
|
33 | 30 | import org.apache.accumulo.core.client.admin.NewTableConfiguration;
|
34 | 31 | import org.apache.accumulo.core.conf.Property;
|
35 | 32 | import org.apache.accumulo.core.data.Mutation;
|
36 |
| -import org.apache.accumulo.core.metadata.TServerInstance; |
37 | 33 | import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
|
38 | 34 | import org.apache.accumulo.server.ServerContext;
|
39 | 35 | import org.apache.accumulo.server.log.WalStateManager;
|
@@ -100,7 +96,7 @@ public void testWALMaxReferenced() throws Exception {
|
100 | 96 | writeData(client, tableName, startRow, endRow);
|
101 | 97 |
|
102 | 98 | // Check the current number of WALs in use
|
103 |
| - int walCount = getWalCount(getServerContext()); |
| 99 | + long walCount = getWalCount(getServerContext()); |
104 | 100 | log.info("After iteration {}, wrote rows [{}..{}), WAL count is {}", iteration, startRow,
|
105 | 101 | endRow, walCount);
|
106 | 102 | iteration.getAndIncrement();
|
@@ -131,13 +127,9 @@ private void writeData(AccumuloClient client, String table, int startRow, int en
|
131 | 127 | }
|
132 | 128 | }
|
133 | 129 |
|
134 |
| - private int getWalCount(ServerContext context) throws Exception { |
135 |
| - WalStateManager wals = new WalStateManager(context); |
136 |
| - int total = 0; |
137 |
| - for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) { |
138 |
| - total += entry.getValue().size(); |
139 |
| - } |
140 |
| - return total; |
| 130 | + private long getWalCount(ServerContext context) throws Exception { |
| 131 | + return new WalStateManager(context).getAllState().values().stream() |
| 132 | + .filter(walState -> walState != WalStateManager.WalState.OPEN).count(); |
141 | 133 | }
|
142 | 134 |
|
143 | 135 | }
|
0 commit comments