You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/11/16 17:21:12 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #1779: Stabilize NamespaceIdTest and TableIdTest

ctubbsii commented on a change in pull request #1779:
URL: https://github.com/apache/accumulo/pull/1779#discussion_r524440237



##########
File path: core/src/test/java/org/apache/accumulo/core/data/NamespaceIdTest.java
##########
@@ -79,12 +79,13 @@ public void testCacheIncreasesAndDecreasesAfterGC() {
     assertEquals(namespaceString, nsId.canonical());
 
     // create a bunch more and throw them away
-    for (int i = 0; i < 999; i++) {
-      NamespaceId.of(new String("namespace" + i));
+    long preGCSize = 0;
+    int i = 0;
+    while ((preGCSize = NamespaceId.cache.asMap().entrySet().stream().count()) < 100) {

Review comment:
       We can't use `size()` (either on the `Map` or its `entrySet()`), because that is only an approximation when working with Guava Cache objects. We need the actual count, which we can get by iterating over the entry set. See https://guava.dev/releases/21.0/api/docs/com/google/common/cache/Cache.html#size--




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org