Skip to content

Commit a176b85

Browse files
committed
disregard open state WALs in count method
1 parent 2feaa45 commit a176b85

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

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

+4-12
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919
package org.apache.accumulo.test;
2020

2121
import java.time.Duration;
22-
import java.util.List;
23-
import java.util.Map.Entry;
2422
import java.util.SortedSet;
2523
import java.util.TreeSet;
26-
import java.util.UUID;
2724
import java.util.concurrent.atomic.AtomicInteger;
2825

2926
import org.apache.accumulo.core.client.Accumulo;
@@ -33,7 +30,6 @@
3330
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
3431
import org.apache.accumulo.core.conf.Property;
3532
import org.apache.accumulo.core.data.Mutation;
36-
import org.apache.accumulo.core.metadata.TServerInstance;
3733
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
3834
import org.apache.accumulo.server.ServerContext;
3935
import org.apache.accumulo.server.log.WalStateManager;
@@ -100,7 +96,7 @@ public void testWALMaxReferenced() throws Exception {
10096
writeData(client, tableName, startRow, endRow);
10197

10298
// Check the current number of WALs in use
103-
int walCount = getWalCount(getServerContext());
99+
long walCount = getWalCount(getServerContext());
104100
log.info("After iteration {}, wrote rows [{}..{}), WAL count is {}", iteration, startRow,
105101
endRow, walCount);
106102
iteration.getAndIncrement();
@@ -131,13 +127,9 @@ private void writeData(AccumuloClient client, String table, int startRow, int en
131127
}
132128
}
133129

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();
141133
}
142134

143135
}

0 commit comments

Comments
 (0)