Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into primary_only
Browse files Browse the repository at this point in the history
  • Loading branch information
gaobinlong committed Mar 15, 2024
2 parents 4c45a9e + d0467b3 commit f7375f6
Show file tree
Hide file tree
Showing 63 changed files with 1,277 additions and 428 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `codecov/codecov-action` from 3 to 4 ([#12585](https://github.com/opensearch-project/OpenSearch/pull/12585))
- Bump `org.apache.zookeeper:zookeeper` from 3.9.1 to 3.9.2 ([#12580](https://github.com/opensearch-project/OpenSearch/pull/12580))
- Bump `org.codehaus.woodstox:stax2-api` from 4.2.1 to 4.2.2 ([#12579](https://github.com/opensearch-project/OpenSearch/pull/12579))
- Bump Jackson version from 2.16.1 to 2.16.2 ([#12611](https://github.com/opensearch-project/OpenSearch/pull/12611))
- Bump Jackson version from 2.16.1 to 2.17.0 ([#12611](https://github.com/opensearch-project/OpenSearch/pull/12611), [#12662](https://github.com/opensearch-project/OpenSearch/pull/12662))
- Bump `aws-sdk-java` from 2.20.55 to 2.20.86 ([#12251](https://github.com/opensearch-project/OpenSearch/pull/12251))
- Bump `reactor-netty` from 1.1.15 to 1.1.17 ([#12633](https://github.com/opensearch-project/OpenSearch/pull/12633))
- Bump `reactor` from 3.5.14 to 3.5.15 ([#12633](https://github.com/opensearch-project/OpenSearch/pull/12633))
Expand All @@ -157,6 +157,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix `terms` query on `float` field when `doc_values` are turned off by reverting back to `FloatPoint` from `FloatField` ([#12499](https://github.com/opensearch-project/OpenSearch/pull/12499))
- Fix get task API does not refresh resource stats ([#11531](https://github.com/opensearch-project/OpenSearch/pull/11531))
- onShardResult and onShardFailure are executed on one shard causes opensearch jvm crashed ([#12158](https://github.com/opensearch-project/OpenSearch/pull/12158))
- Avoid overflow when sorting missing last on `epoch_millis` datetime field ([#12676](https://github.com/opensearch-project/OpenSearch/pull/12676))

### Security

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ bundled_jdk = 21.0.2+13
# optional dependencies
spatial4j = 0.7
jts = 1.15.0
jackson = 2.16.2
jackson_databind = 2.16.2
jackson = 2.17.0
jackson_databind = 2.17.0
snakeyaml = 2.1
icu4j = 70.1
supercsv = 2.4.0
Expand Down
1 change: 0 additions & 1 deletion client/sniffer/licenses/jackson-core-2.16.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/sniffer/licenses/jackson-core-2.17.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a6e5058ef9720623c517252d17162f845306ff3a

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34
1 change: 0 additions & 1 deletion libs/core/licenses/jackson-core-2.16.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions libs/core/licenses/jackson-core-2.17.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a6e5058ef9720623c517252d17162f845306ff3a
1 change: 0 additions & 1 deletion libs/x-content/licenses/jackson-core-2.16.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions libs/x-content/licenses/jackson-core-2.17.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a6e5058ef9720623c517252d17162f845306ff3a

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6833c8573452d583e4af650a7424d547606b2501

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f10183857607fde789490d33ea46372a2d2b0c72

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
57a963c6258c49febc11390082d8503f71bb15a9
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void onRemoval(RemovalNotification<K, V> notification) {
try (ReleasableLock ignore = writeLock.acquire()) {
diskCache.put(notification.getKey(), notification.getValue());
}
removalListener.onRemoval(notification);
}
})
.setKeyType(builder.cacheConfig.getKeyType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import org.opensearch.common.cache.CacheType;
import org.opensearch.common.cache.ICache;
import org.opensearch.common.cache.LoadAwareCacheLoader;
import org.opensearch.common.cache.RemovalListener;
import org.opensearch.common.cache.RemovalNotification;
import org.opensearch.common.cache.RemovalReason;
import org.opensearch.common.cache.store.builders.ICacheBuilder;
import org.opensearch.common.cache.store.config.CacheConfig;

Expand All @@ -23,9 +26,12 @@ public class MockDiskCache<K, V> implements ICache<K, V> {
int maxSize;
long delay;

public MockDiskCache(int maxSize, long delay) {
private final RemovalListener<K, V> removalListener;

public MockDiskCache(int maxSize, long delay, RemovalListener<K, V> removalListener) {
this.maxSize = maxSize;
this.delay = delay;
this.removalListener = removalListener;
this.cache = new ConcurrentHashMap<K, V>();
}

Expand All @@ -38,7 +44,7 @@ public V get(K key) {
@Override
public void put(K key, V value) {
if (this.cache.size() >= maxSize) { // For simplification
return;
this.removalListener.onRemoval(new RemovalNotification<>(key, value, RemovalReason.EVICTED));
}
try {
Thread.sleep(delay);
Expand Down Expand Up @@ -101,7 +107,10 @@ public MockDiskCacheFactory(long delay, int maxSize) {

@Override
public <K, V> ICache<K, V> create(CacheConfig<K, V> config, CacheType cacheType, Map<String, Factory> cacheFactories) {
return new Builder<K, V>().setMaxSize(maxSize).setDeliberateDelay(delay).build();
return new Builder<K, V>().setMaxSize(maxSize)
.setDeliberateDelay(delay)
.setRemovalListener(config.getRemovalListener())
.build();
}

@Override
Expand All @@ -117,7 +126,7 @@ public static class Builder<K, V> extends ICacheBuilder<K, V> {

@Override
public ICache<K, V> build() {
return new MockDiskCache<K, V>(this.maxSize, this.delay);
return new MockDiskCache<K, V>(this.maxSize, this.delay, this.getRemovalListener());
}

public Builder<K, V> setMaxSize(int maxSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testComputeIfAbsentWithoutAnyOnHeapCacheEviction() throws Exception

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
TieredSpilloverCache<String, String> tieredSpilloverCache = intializeTieredSpilloverCache(
onHeapCacheSize,
keyValueSize,
randomIntBetween(1, 4),
removalListener,
Settings.builder()
Expand Down Expand Up @@ -142,10 +142,6 @@ public void testComputeIfAbsentWithFactoryBasedCacheCreation() throws Exception
LoadAwareCacheLoader<String, String> tieredCacheLoader = getLoadAwareCacheLoader();
tieredSpilloverCache.computeIfAbsent(key, tieredCacheLoader);
}
long actualDiskCacheSize = tieredSpilloverCache.getDiskCache().count();
assertEquals(actualDiskCacheSize, removalListener.evictionsMetric.count()); // Evictions from onHeap equal to
// disk cache size.

tieredSpilloverCache.getOnHeapCache().keys().forEach(onHeapKeys::add);
tieredSpilloverCache.getDiskCache().keys().forEach(diskTierKeys::add);

Expand Down Expand Up @@ -290,9 +286,6 @@ public void testComputeIfAbsentWithEvictionsFromOnHeapCache() throws Exception {
LoadAwareCacheLoader<String, String> tieredCacheLoader = getLoadAwareCacheLoader();
tieredSpilloverCache.computeIfAbsent(key, tieredCacheLoader);
}
long actualDiskCacheSize = tieredSpilloverCache.getDiskCache().count();
assertEquals(actualDiskCacheSize, removalListener.evictionsMetric.count()); // Evictions from onHeap equal to
// disk cache size.

tieredSpilloverCache.getOnHeapCache().keys().forEach(onHeapKeys::add);
tieredSpilloverCache.getDiskCache().keys().forEach(diskTierKeys::add);
Expand Down Expand Up @@ -328,15 +321,15 @@ public void testComputeIfAbsentWithEvictionsFromOnHeapCache() throws Exception {
}
}

public void testComputeIfAbsentWithEvictionsFromBothTier() throws Exception {
public void testComputeIfAbsentWithEvictionsFromTieredCache() throws Exception {
int onHeapCacheSize = randomIntBetween(10, 30);
int diskCacheSize = randomIntBetween(onHeapCacheSize + 1, 100);
int totalSize = onHeapCacheSize + diskCacheSize;
int keyValueSize = 50;

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
TieredSpilloverCache<String, String> tieredSpilloverCache = intializeTieredSpilloverCache(
onHeapCacheSize,
keyValueSize,
diskCacheSize,
removalListener,
Settings.builder()
Expand All @@ -349,13 +342,13 @@ public void testComputeIfAbsentWithEvictionsFromBothTier() throws Exception {
.build(),
0
);

int numOfItems = randomIntBetween(totalSize + 1, totalSize * 3);
for (int iter = 0; iter < numOfItems; iter++) {
LoadAwareCacheLoader<String, String> tieredCacheLoader = getLoadAwareCacheLoader();
tieredSpilloverCache.computeIfAbsent(UUID.randomUUID().toString(), tieredCacheLoader);
}
assertTrue(removalListener.evictionsMetric.count() > 0);
int evictions = numOfItems - (totalSize);
assertEquals(evictions, removalListener.evictionsMetric.count());
}

public void testGetAndCount() throws Exception {
Expand All @@ -366,7 +359,7 @@ public void testGetAndCount() throws Exception {

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
TieredSpilloverCache<String, String> tieredSpilloverCache = intializeTieredSpilloverCache(
onHeapCacheSize,
keyValueSize,
diskCacheSize,
removalListener,
Settings.builder()
Expand Down Expand Up @@ -418,7 +411,7 @@ public void testPut() {

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
TieredSpilloverCache<String, String> tieredSpilloverCache = intializeTieredSpilloverCache(
onHeapCacheSize,
keyValueSize,
diskCacheSize,
removalListener,
Settings.builder()
Expand Down Expand Up @@ -519,7 +512,7 @@ public void testInvalidate() {

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
TieredSpilloverCache<String, String> tieredSpilloverCache = intializeTieredSpilloverCache(
onHeapCacheSize,
keyValueSize,
diskCacheSize,
removalListener,
Settings.builder()
Expand Down Expand Up @@ -744,7 +737,7 @@ public String load(String key) {
assertEquals(1, numberOfTimesKeyLoaded); // It should be loaded only once.
}

public void testConcurrencyForEvictionFlow() throws Exception {
public void testConcurrencyForEvictionFlowFromOnHeapToDiskTier() throws Exception {
int diskCacheSize = randomIntBetween(450, 800);

MockCacheRemovalListener<String, String> removalListener = new MockCacheRemovalListener<>();
Expand Down Expand Up @@ -828,7 +821,6 @@ public String load(String key) {
countDownLatch.await();
assertNotNull(actualValue.get());
countDownLatch1.await();
assertEquals(1, removalListener.evictionsMetric.count());
assertEquals(1, tieredSpilloverCache.getOnHeapCache().count());
assertEquals(1, onDiskCache.count());
assertNotNull(onDiskCache.get(keyToBeEvicted));
Expand Down Expand Up @@ -883,7 +875,6 @@ private TieredSpilloverCache<String, String> intializeTieredSpilloverCache(
.build()
)
.build();

ICache.Factory mockDiskCacheFactory = new MockDiskCache.MockDiskCacheFactory(diskDeliberateDelay, diskCacheSize);

return new TieredSpilloverCache.Builder<String, String>().setCacheType(CacheType.INDICES_REQUEST_CACHE)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fbe3c274a39cef5538ca8688ac7e2ad0053a6ffa

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3fab507bba9d477e52ed2302dc3ddbd23cbae339

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e07032ce170277213ac4835169ca79fa0340c7b5

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
880a742337010da4c851f843d8cac150e22dff9f

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34
Loading

0 comments on commit f7375f6

Please sign in to comment.