Skip to content

Commit

Permalink
SHAs, spotlessApply
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Alfonsi <[email protected]>
  • Loading branch information
Peter Alfonsi committed Jan 26, 2024
1 parent cdea52d commit 62b80ca
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b45b49c1ec5c5fc48580412d0ca635e1833110ea
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8bd7794fbdaa9536354dd2d8d961d9503beb9460
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ protected KeyStoreStats(long memSizeCapInBytes) {
this.numSuccessfulRemovals = new CounterMetric();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.opensearch.cache;


import org.opensearch.common.cache.tier.keystore.KeyLookupStore;
import org.opensearch.common.metrics.CounterMetric;
import org.opensearch.core.common.unit.ByteSizeValue;
Expand Down Expand Up @@ -67,7 +66,6 @@ public int getValue() {
// in terms of storage impact
static final int REFRESH_SIZE_EST_INTERVAL = 10_000;


// Use this constructor to specify memory cap with default modulo = 2^28, which we found in experiments
// to be the best tradeoff between lower memory usage and risk of collisions
public RBMIntKeyLookupStore(long memSizeCapInBytes) {
Expand Down Expand Up @@ -204,7 +202,8 @@ public boolean remove(Integer value) {
if (removalSet == null) {
// First time a removal has been attempted for this transformed value
HashSet<Integer> newRemovalSet = new HashSet<>();
newRemovalSet.add(value); // Add the key value, not the transformed value, to the list of attempted removals for this transformedValue
newRemovalSet.add(value); // Add the key value, not the transformed value, to the list of attempted removals for this
// transformedValue
removalSets.put(transformedValue, newRemovalSet);
numCollisions.dec();
} else {
Expand Down Expand Up @@ -379,4 +378,3 @@ protected void setMemSizeCap(ByteSizeValue newMemSizeCap) {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

package org.opensearch.cache;

import org.opensearch.plugins.Plugin;

public class RoaringBitmapKeystoreModulePlugin extends Plugin {
}
public class RoaringBitmapKeystoreModulePlugin extends Plugin {}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.test.OpenSearchTestCase;
import org.roaringbitmap.RoaringBitmap;

import java.util.ArrayList;
import java.util.HashSet;
Expand All @@ -22,9 +21,12 @@
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;

import org.roaringbitmap.RoaringBitmap;

public class RBMIntKeyLookupStoreTests extends OpenSearchTestCase {

final int BYTES_IN_MB = 1048576;

public void testInit() {
long memCap = 100 * BYTES_IN_MB;
RBMIntKeyLookupStore kls = new RBMIntKeyLookupStore(memCap);
Expand Down Expand Up @@ -130,10 +132,10 @@ public void testMemoryCapBlocksAdd() throws Exception {
// as that's what our size estimator is designed for.
// If we add a run of integers, our size estimator is not valid, especially for small RBMs.

int[] maxEntriesArr = new int[] { 1342000, 100000, 3000000};
int[] maxEntriesArr = new int[] { 1342000, 100000, 3000000 };
long[] rbmReportedSizes = new long[4];
Random rand = Randomness.get();
for (int j = 0; j < maxEntriesArr.length; j++) {
for (int j = 0; j < maxEntriesArr.length; j++) {
RoaringBitmap rbm = new RoaringBitmap();
for (int i = 0; i < maxEntriesArr[j]; i++) {
rbm.add(rand.nextInt());
Expand All @@ -144,7 +146,7 @@ public void testMemoryCapBlocksAdd() throws Exception {
for (int i = 0; i < maxEntriesArr.length; i++) {
double multiplier = RBMIntKeyLookupStore.getRBMSizeMultiplier(maxEntriesArr[i], moduloValue.getValue());
long memSizeCapInBytes = (long) (rbmReportedSizes[i] * multiplier);
//long memSizeCapInBytes = RBMSizeEstimator.getSizeInBytesWithModuloValue(maxEntries, moduloValue);
// long memSizeCapInBytes = RBMSizeEstimator.getSizeInBytesWithModuloValue(maxEntries, moduloValue);
RBMIntKeyLookupStore kls = new RBMIntKeyLookupStore(moduloValue, memSizeCapInBytes);
for (int j = 0; j < maxEntriesArr[i] + 5000; j++) {
kls.add(rand.nextInt());
Expand Down Expand Up @@ -406,4 +408,3 @@ public void testSetMemSizeCap() throws Exception {
assertFalse(kls.add(rand.nextInt()));
}
}

0 comments on commit 62b80ca

Please sign in to comment.