Skip to content

Commit 52747c7

Browse files
committed
Fixing changelog
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
1 parent fc94f6c commit 52747c7

File tree

80 files changed

+4665
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4665
-315
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2222
- [Tiered Caching] Add dimension-based stats to ICache implementations. ([#12531](https://github.com/opensearch-project/OpenSearch/pull/12531))
2323
- Add changes for overriding remote store and replication settings during snapshot restore. ([#11868](https://github.com/opensearch-project/OpenSearch/pull/11868))
2424
- Add an individual setting of rate limiter for segment replication ([#12959](https://github.com/opensearch-project/OpenSearch/pull/12959))
25+
- [Tiered Caching] Expose new cache stats API ([#13237](https://github.com/opensearch-project/OpenSearch/pull/13237))
2526
- [Streaming Indexing] Ensure support of the new transport by security plugin ([#13174](https://github.com/opensearch-project/OpenSearch/pull/13174))
2627
- Add cluster setting to dynamically configure the buckets for filter rewrite optimization. ([#13179](https://github.com/opensearch-project/OpenSearch/pull/13179))
2728
- [Tiered Caching] Gate new stats logic behind FeatureFlags.PLUGGABLE_CACHE ([#13238](https://github.com/opensearch-project/OpenSearch/pull/13238))
2829
- [Tiered Caching] Add a dynamic setting to disable/enable disk cache. ([#13373](https://github.com/opensearch-project/OpenSearch/pull/13373))
2930
- [Remote Store] Add capability of doing refresh as determined by the translog ([#12992](https://github.com/opensearch-project/OpenSearch/pull/12992))
31+
- [Batch Ingestion] Add `batch_size` to `_bulk` API. ([#12457](https://github.com/opensearch-project/OpenSearch/issues/12457))
3032
- [Tiered caching] Make Indices Request Cache Stale Key Mgmt Threshold setting dynamic ([#12941](https://github.com/opensearch-project/OpenSearch/pull/12941))
3133
- Batch mode for async fetching shard information in GatewayAllocator for unassigned shards ([#8746](https://github.com/opensearch-project/OpenSearch/pull/8746))
3234
- [Remote Store] Add settings for remote path type and hash algorithm ([#13225](https://github.com/opensearch-project/OpenSearch/pull/13225))
3335
- [Remote Store] Upload remote paths during remote enabled index creation ([#13386](https://github.com/opensearch-project/OpenSearch/pull/13386))
36+
- [Search Pipeline] Handle default pipeline for multiple indices ([#13276](https://github.com/opensearch-project/OpenSearch/pull/13276))
3437

3538
### Dependencies
3639
- Bump `org.apache.commons:commons-configuration2` from 2.10.0 to 2.10.1 ([#12896](https://github.com/opensearch-project/OpenSearch/pull/12896))
@@ -57,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5760
- Bump `com.netflix.nebula.ospackage-base` from 11.8.1 to 11.9.0 ([#13440](https://github.com/opensearch-project/OpenSearch/pull/13440))
5861
- Bump `org.bouncycastle:bc-fips` from 1.0.2.4 to 1.0.2.5 ([#13446](https://github.com/opensearch-project/OpenSearch/pull/13446))
5962
- Bump `lycheeverse/lychee-action` from 1.9.3 to 1.10.0 ([#13447](https://github.com/opensearch-project/OpenSearch/pull/13447))
63+
- Bump `org.gradle.test-retry` from 1.5.8 to 1.5.9 ([#13442](https://github.com/opensearch-project/OpenSearch/pull/13442))
6064

6165
### Changed
6266
- [BWC and API enforcement] Enforcing the presence of API annotations at build time ([#12872](https://github.com/opensearch-project/OpenSearch/pull/12872))

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ plugins {
5555
id 'opensearch.docker-support'
5656
id 'opensearch.global-build-info'
5757
id "com.diffplug.spotless" version "6.25.0" apply false
58-
id "org.gradle.test-retry" version "1.5.8" apply false
58+
id "org.gradle.test-retry" version "1.5.9" apply false
5959
id "test-report-aggregation"
6060
id 'jacoco-report-aggregation'
6161
}

libs/core/src/main/java/org/opensearch/core/common/io/stream/StreamInput.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
import java.util.Arrays;
8181
import java.util.Collection;
8282
import java.util.Collections;
83+
import java.util.Comparator;
8384
import java.util.Date;
8485
import java.util.EnumSet;
8586
import java.util.HashMap;
@@ -90,6 +91,8 @@
9091
import java.util.Locale;
9192
import java.util.Map;
9293
import java.util.Set;
94+
import java.util.SortedMap;
95+
import java.util.TreeMap;
9396
import java.util.concurrent.TimeUnit;
9497
import java.util.function.IntFunction;
9598

@@ -642,12 +645,47 @@ public <K, V> Map<K, V> readMap(Writeable.Reader<K> keyReader, Writeable.Reader<
642645
return Collections.emptyMap();
643646
}
644647
Map<K, V> map = new HashMap<>(size);
648+
readIntoMap(keyReader, valueReader, map, size);
649+
return map;
650+
}
651+
652+
/**
653+
* Read a serialized map into a SortedMap using the default ordering for the keys. If the result is empty it might be immutable.
654+
*/
655+
public <K extends Comparable<K>, V> SortedMap<K, V> readOrderedMap(Writeable.Reader<K> keyReader, Writeable.Reader<V> valueReader)
656+
throws IOException {
657+
return readOrderedMap(keyReader, valueReader, null);
658+
}
659+
660+
/**
661+
* Read a serialized map into a SortedMap, specifying a Comparator for the keys. If the result is empty it might be immutable.
662+
*/
663+
public <K extends Comparable<K>, V> SortedMap<K, V> readOrderedMap(
664+
Writeable.Reader<K> keyReader,
665+
Writeable.Reader<V> valueReader,
666+
@Nullable Comparator<K> keyComparator
667+
) throws IOException {
668+
int size = readArraySize();
669+
if (size == 0) {
670+
return Collections.emptySortedMap();
671+
}
672+
SortedMap<K, V> sortedMap;
673+
if (keyComparator == null) {
674+
sortedMap = new TreeMap<>();
675+
} else {
676+
sortedMap = new TreeMap<>(keyComparator);
677+
}
678+
readIntoMap(keyReader, valueReader, sortedMap, size);
679+
return sortedMap;
680+
}
681+
682+
private <K, V> void readIntoMap(Writeable.Reader<K> keyReader, Writeable.Reader<V> valueReader, Map<K, V> map, int size)
683+
throws IOException {
645684
for (int i = 0; i < size; i++) {
646685
K key = keyReader.read(this);
647686
V value = valueReader.read(this);
648687
map.put(key, value);
649688
}
650-
return map;
651689
}
652690

653691
/**

modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public void close() throws IOException {
230230
}
231231

232232
@Override
233-
public ImmutableCacheStatsHolder stats() {
233+
public ImmutableCacheStatsHolder stats(String[] levels) {
234234
return null; // TODO: in TSC stats PR
235235
}
236236

modules/cache-common/src/test/java/org/opensearch/cache/common/tier/MockDiskCache.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public ImmutableCacheStatsHolder stats() {
9999
return null;
100100
}
101101

102+
@Override
103+
public ImmutableCacheStatsHolder stats(String[] levels) {
104+
return null;
105+
}
106+
102107
@Override
103108
public void close() {
104109

modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/70_bulk.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,90 @@ teardown:
167167
index: test_index
168168
id: test_id3
169169
- match: { _source: {"f1": "v2", "f2": 47, "field1": "value1"}}
170+
171+
---
172+
"Test bulk API with batch enabled happy case":
173+
- skip:
174+
version: " - 2.13.99"
175+
reason: "Added in 2.14.0"
176+
177+
- do:
178+
bulk:
179+
refresh: true
180+
batch_size: 2
181+
pipeline: "pipeline1"
182+
body:
183+
- '{"index": {"_index": "test_index", "_id": "test_id1"}}'
184+
- '{"text": "text1"}'
185+
- '{"index": {"_index": "test_index", "_id": "test_id2"}}'
186+
- '{"text": "text2"}'
187+
- '{"index": {"_index": "test_index", "_id": "test_id3"}}'
188+
- '{"text": "text3"}'
189+
- '{"index": {"_index": "test_index", "_id": "test_id4"}}'
190+
- '{"text": "text4"}'
191+
- '{"index": {"_index": "test_index", "_id": "test_id5", "pipeline": "pipeline2"}}'
192+
- '{"text": "text5"}'
193+
- '{"index": {"_index": "test_index", "_id": "test_id6", "pipeline": "pipeline2"}}'
194+
- '{"text": "text6"}'
195+
196+
- match: { errors: false }
197+
198+
- do:
199+
get:
200+
index: test_index
201+
id: test_id5
202+
- match: { _source: {"text": "text5", "field2": "value2"}}
203+
204+
- do:
205+
get:
206+
index: test_index
207+
id: test_id3
208+
- match: { _source: { "text": "text3", "field1": "value1" } }
209+
210+
---
211+
"Test bulk API with batch_size missing":
212+
- skip:
213+
version: " - 2.13.99"
214+
reason: "Added in 2.14.0"
215+
216+
- do:
217+
bulk:
218+
refresh: true
219+
pipeline: "pipeline1"
220+
body:
221+
- '{"index": {"_index": "test_index", "_id": "test_id1"}}'
222+
- '{"text": "text1"}'
223+
- '{"index": {"_index": "test_index", "_id": "test_id2"}}'
224+
- '{"text": "text2"}'
225+
226+
- match: { errors: false }
227+
228+
- do:
229+
get:
230+
index: test_index
231+
id: test_id1
232+
- match: { _source: { "text": "text1", "field1": "value1" } }
233+
234+
- do:
235+
get:
236+
index: test_index
237+
id: test_id2
238+
- match: { _source: { "text": "text2", "field1": "value1" } }
239+
240+
---
241+
"Test bulk API with invalid batch_size":
242+
- skip:
243+
version: " - 2.13.99"
244+
reason: "Added in 2.14.0"
245+
246+
- do:
247+
catch: bad_request
248+
bulk:
249+
refresh: true
250+
batch_size: -1
251+
pipeline: "pipeline1"
252+
body:
253+
- '{"index": {"_index": "test_index", "_id": "test_id1"}}'
254+
- '{"text": "text1"}'
255+
- '{"index": {"_index": "test_index", "_id": "test_id2"}}'
256+
- '{"text": "text2"}'

plugins/cache-ehcache/src/main/java/org/opensearch/cache/store/disk/EhcacheDiskCache.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private EhcacheDiskCache(Builder<K, V> builder) {
164164
this.cache = buildCache(Duration.ofMillis(expireAfterAccess.getMillis()), builder);
165165
List<String> dimensionNames = Objects.requireNonNull(builder.dimensionNames, "Dimension names can't be null");
166166
// If this cache is being used, FeatureFlags.PLUGGABLE_CACHE is already on, so we can always use the DefaultCacheStatsHolder.
167-
this.cacheStatsHolder = new DefaultCacheStatsHolder(dimensionNames);
167+
this.cacheStatsHolder = new DefaultCacheStatsHolder(dimensionNames, EhcacheDiskCacheFactory.EHCACHE_DISK_CACHE_NAME);
168168
}
169169

170170
@SuppressWarnings({ "rawtypes" })
@@ -446,12 +446,13 @@ public void close() {
446446
}
447447

448448
/**
449-
* Relevant stats for this cache.
450-
* @return CacheStats
449+
* Relevant stats for this cache, aggregated by levels.
450+
* @param levels The levels to aggregate by.
451+
* @return ImmutableCacheStatsHolder
451452
*/
452453
@Override
453-
public ImmutableCacheStatsHolder stats() {
454-
return cacheStatsHolder.getImmutableCacheStatsHolder();
454+
public ImmutableCacheStatsHolder stats(String[] levels) {
455+
return cacheStatsHolder.getImmutableCacheStatsHolder(levels);
455456
}
456457

457458
/**
@@ -510,15 +511,15 @@ private long getNewValuePairSize(CacheEvent<? extends ICacheKey<K>, ? extends By
510511
public void onEvent(CacheEvent<? extends ICacheKey<K>, ? extends ByteArrayWrapper> event) {
511512
switch (event.getType()) {
512513
case CREATED:
513-
cacheStatsHolder.incrementEntries(event.getKey().dimensions);
514+
cacheStatsHolder.incrementItems(event.getKey().dimensions);
514515
cacheStatsHolder.incrementSizeInBytes(event.getKey().dimensions, getNewValuePairSize(event));
515516
assert event.getOldValue() == null;
516517
break;
517518
case EVICTED:
518519
this.removalListener.onRemoval(
519520
new RemovalNotification<>(event.getKey(), deserializeValue(event.getOldValue()), RemovalReason.EVICTED)
520521
);
521-
cacheStatsHolder.decrementEntries(event.getKey().dimensions);
522+
cacheStatsHolder.decrementItems(event.getKey().dimensions);
522523
cacheStatsHolder.decrementSizeInBytes(event.getKey().dimensions, getOldValuePairSize(event));
523524
cacheStatsHolder.incrementEvictions(event.getKey().dimensions);
524525
assert event.getNewValue() == null;
@@ -527,15 +528,15 @@ public void onEvent(CacheEvent<? extends ICacheKey<K>, ? extends ByteArrayWrappe
527528
this.removalListener.onRemoval(
528529
new RemovalNotification<>(event.getKey(), deserializeValue(event.getOldValue()), RemovalReason.EXPLICIT)
529530
);
530-
cacheStatsHolder.decrementEntries(event.getKey().dimensions);
531+
cacheStatsHolder.decrementItems(event.getKey().dimensions);
531532
cacheStatsHolder.decrementSizeInBytes(event.getKey().dimensions, getOldValuePairSize(event));
532533
assert event.getNewValue() == null;
533534
break;
534535
case EXPIRED:
535536
this.removalListener.onRemoval(
536537
new RemovalNotification<>(event.getKey(), deserializeValue(event.getOldValue()), RemovalReason.INVALIDATED)
537538
);
538-
cacheStatsHolder.decrementEntries(event.getKey().dimensions);
539+
cacheStatsHolder.decrementItems(event.getKey().dimensions);
539540
cacheStatsHolder.decrementSizeInBytes(event.getKey().dimensions, getOldValuePairSize(event));
540541
assert event.getNewValue() == null;
541542
break;

plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testBasicGetAndPut() throws IOException {
9393
String value = ehcacheTest.get(getICacheKey(entry.getKey()));
9494
assertEquals(entry.getValue(), value);
9595
}
96-
assertEquals(randomKeys, ehcacheTest.stats().getTotalEntries());
96+
assertEquals(randomKeys, ehcacheTest.stats().getTotalItems());
9797
assertEquals(randomKeys, ehcacheTest.stats().getTotalHits());
9898
assertEquals(expectedSize, ehcacheTest.stats().getTotalSizeInBytes());
9999
assertEquals(randomKeys, ehcacheTest.count());
@@ -217,7 +217,7 @@ public void testConcurrentPut() throws Exception {
217217
assertEquals(entry.getValue(), value);
218218
}
219219
assertEquals(randomKeys, ehcacheTest.count());
220-
assertEquals(randomKeys, ehcacheTest.stats().getTotalEntries());
220+
assertEquals(randomKeys, ehcacheTest.stats().getTotalItems());
221221
ehcacheTest.close();
222222
}
223223
}
@@ -416,7 +416,7 @@ public String load(ICacheKey<String> key) {
416416
assertEquals(1, numberOfTimesValueLoaded);
417417
assertEquals(0, ((EhcacheDiskCache) ehcacheTest).getCompletableFutureMap().size());
418418
assertEquals(1, ehcacheTest.stats().getTotalMisses());
419-
assertEquals(1, ehcacheTest.stats().getTotalEntries());
419+
assertEquals(1, ehcacheTest.stats().getTotalItems());
420420
assertEquals(numberOfRequest - 1, ehcacheTest.stats().getTotalHits());
421421
assertEquals(1, ehcacheTest.count());
422422
ehcacheTest.close();

rest-api-spec/src/main/resources/rest-api-spec/api/bulk.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
"require_alias": {
7575
"type": "boolean",
7676
"description": "Sets require_alias for all incoming documents. Defaults to unset (false)"
77+
},
78+
"batch_size": {
79+
"type": "int",
80+
"description": "Sets the batch size"
7781
}
7882
},
7983
"body":{

0 commit comments

Comments
 (0)