Skip to content

Commit e25aa9f

Browse files
authored
Merge branch 'main' into builder-get-flush-querycache
Signed-off-by: Sandesh Kumar <[email protected]>
2 parents 019fcfc + 97881bc commit e25aa9f

File tree

12 files changed

+58
-12
lines changed

12 files changed

+58
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4747
- Refactor the Condition.Stats and DirectoryFileTransferTracker.Stats class to use the Builder pattern instead of constructors ([#19862](https://github.com/opensearch-project/OpenSearch/pull/19862))
4848
- Refactor the RemoteTranslogTransferTracker.Stats and RemoteSegmentTransferTracker.Stats class to use the Builder pattern instead of constructors ([#19837](https://github.com/opensearch-project/OpenSearch/pull/19837))
4949
- Refactor the GetStats, FlushStats and QueryCacheStats class to use the Builder pattern instead of constructors ([#19935](https://github.com/opensearch-project/OpenSearch/pull/19935))
50+
- Add RangeSemver for `dependencies` in `plugin-descriptor.properties` ([#19939](https://github.com/opensearch-project/OpenSearch/pull/19939))
5051

5152
### Fixed
5253
- Fix Allocation and Rebalance Constraints of WeightFunction are incorrectly reset ([#19012](https://github.com/opensearch-project/OpenSearch/pull/19012))
@@ -73,7 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7374
- Bump `org.apache.zookeeper:zookeeper` from 3.9.3 to 3.9.4 ([#19535](https://github.com/opensearch-project/OpenSearch/pull/19535))
7475
- Bump `com.azure:azure-storage-common` from 12.30.2 to 12.30.3 ([#19615](https://github.com/opensearch-project/OpenSearch/pull/19615))
7576
- Bump `peter-evans/create-issue-from-file` from 5 to 6 ([#19616](https://github.com/opensearch-project/OpenSearch/pull/19616))
76-
- Bump `com.squareup.okhttp3:okhttp` from 5.1.0 to 5.2.1 ([#19614](https://github.com/opensearch-project/OpenSearch/pull/19614))
77+
- Bump `com.squareup.okhttp3:okhttp` from 5.1.0 to 5.3.0 ([#19614](https://github.com/opensearch-project/OpenSearch/pull/19614), [#19944](https://github.com/opensearch-project/OpenSearch/pull/19944))
7778
- Bump `com.microsoft.azure:msal4j` from 1.21.0 to 1.23.1 ([#19688](https://github.com/opensearch-project/OpenSearch/pull/19688))
7879
- Bump `commons-net:commons-net` from 3.11.1 to 3.12.0 ([#19687](https://github.com/opensearch-project/OpenSearch/pull/19687))
7980
- Bump `org.apache.avro:avro` from 1.12.0 to 1.12.1 ([#19692](https://github.com/opensearch-project/OpenSearch/pull/19692))
@@ -90,14 +91,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
9091
- Bump `org.apache.commons:commons-text` from 1.13.1 to 1.14.0 ([#19871](https://github.com/opensearch-project/OpenSearch/pull/19871))
9192
- Exclude group com.microsoft.sqlserver from hadoop-minicluster ([#19889](https://github.com/opensearch-project/OpenSearch/pull/19889))
9293

93-
- ### Deprecated
94+
### Deprecated
9495
- Deprecated existing constructors in ThreadPoolStats.Stats in favor of the new Builder ([#19317](https://github.com/opensearch-project/OpenSearch/pull/19317))
9596
- Deprecated existing constructors in IndexingStats.Stats in favor of the new Builder ([#19306](https://github.com/opensearch-project/OpenSearch/pull/19306))
9697
- Deprecated existing constructors in RefreshStats in favor of the new Builder ([#19835](https://github.com/opensearch-project/OpenSearch/pull/19835))
9798
- Deprecated existing constructors in DocStats and StoreStats in favor of the new Builder ([#19863](https://github.com/opensearch-project/OpenSearch/pull/19863))
9899
- Deprecated existing constructors in Condition.Stats and DirectoryFileTransferTracker.Stats in favor of the new Builder ([#19862](https://github.com/opensearch-project/OpenSearch/pull/19862))
99100
- Deprecated existing constructors in RemoteTranslogTransferTracker.Stats and RemoteSegmentTransferTracker.Stats in favor of the new Builder ([#19837](https://github.com/opensearch-project/OpenSearch/pull/19837))
100101
- Deprecated existing constructors in GetStats, FlushStats and QueryCacheStats in favor of the new Builder ([#19935](https://github.com/opensearch-project/OpenSearch/pull/19935))
102+
- Bump `com.google.api:gax-httpjson` from 2.69.0 to 2.72.1 ([#19943](https://github.com/opensearch-project/OpenSearch/pull/19943))
101103

102104
### Removed
103105

libs/core/src/main/java/org/opensearch/semver/SemverRange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@PublicApi(since = "2.13.0")
4444
public class SemverRange implements ToXContentFragment {
4545

46-
private static final Pattern RANGE_PATTERN = Pattern.compile("([\\[\\(])([\\d.]+)\\s*,\\s*([\\d.]+)([\\]\\)])");
46+
public static final Pattern RANGE_PATTERN = Pattern.compile("([\\[\\(])([\\d.]+)\\s*,\\s*([\\d.]+)([\\]\\)])");
4747

4848
private final Version rangeVersion;
4949
private final RangeOperator rangeOperator;

plugins/repository-gcs/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ dependencies {
6666
runtimeOnly "org.slf4j:slf4j-api:${versions.slf4j}" // 2.0.16 in bom
6767
runtimeOnly "commons-codec:commons-codec:${versions.commonscodec}" // 1.18.0 in bom
6868
implementation "com.google.api:api-common:2.52.0"
69-
implementation "com.google.api:gax:2.69.0"
70-
runtimeOnly "com.google.api:gax-httpjson:2.69.0"
69+
implementation "com.google.api:gax:2.72.1"
70+
runtimeOnly "com.google.api:gax-httpjson:2.72.1"
7171
implementation "org.threeten:threetenbp:1.7.0"
7272
runtimeOnly "com.google.protobuf:protobuf-java-util:${versions.protobuf}"
7373
runtimeOnly "com.google.protobuf:protobuf-java:${versions.protobuf}"

plugins/repository-gcs/licenses/gax-2.69.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
27357249073aa98ba8bcadba6ade835969a5442b

plugins/repository-gcs/licenses/gax-httpjson-2.69.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f6842f1cfe14d295a27561b3d34d468e6c5054b5

server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ public IndexInput getIndexInput() throws IOException {
232232
@ExperimentalApi
233233
public CompletableFuture<IndexInput> asyncLoadIndexInput(Executor executor) {
234234
if (isClosed.get()) {
235+
fileCache.decRef(request.getFilePath());
235236
return CompletableFuture.failedFuture(new IllegalStateException("Already closed"));
236237
}
237238
if (isStarted.getAndSet(true) == false) {
@@ -252,6 +253,9 @@ public CompletableFuture<IndexInput> asyncLoadIndexInput(Executor executor) {
252253
}
253254
return null;
254255
});
256+
} else {
257+
// Decreasing the extra ref count introduced by compute
258+
fileCache.decRef(request.getFilePath());
255259
}
256260
return result;
257261
}

server/src/main/java/org/opensearch/plugins/PluginInfo.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
import java.util.function.Function;
6464
import java.util.stream.Collectors;
6565

66+
import static org.opensearch.semver.SemverRange.RANGE_PATTERN;
67+
6668
/**
6769
* An in-memory representation of the plugin descriptor.
6870
*
@@ -322,13 +324,17 @@ public static PluginInfo readFromProperties(final Path path) throws IOException
322324
if (dependenciesMap.keySet().stream().noneMatch(s -> s.equals("opensearch"))) {
323325
throw new IllegalArgumentException("Only opensearch is allowed to be specified as a plugin dependency: " + dependenciesMap);
324326
}
325-
String[] ranges = dependenciesMap.get("opensearch").split(",");
326-
if (ranges.length != 1) {
327+
String opensearchDependencyVersion = dependenciesMap.get("opensearch");
328+
String[] ranges = opensearchDependencyVersion.split(",");
329+
String opensearchVersion = ranges[0];
330+
if (RANGE_PATTERN.matcher(opensearchDependencyVersion).matches()) {
331+
opensearchVersion = opensearchDependencyVersion;
332+
} else if (ranges.length != 1) {
327333
throw new IllegalArgumentException(
328-
"Exactly one range is allowed to be specified in dependencies for the plugin [\" + name + \"]"
334+
"Exactly one range is allowed to be specified in dependencies for the plugin [" + name + "]"
329335
);
330336
}
331-
opensearchVersionRanges.add(SemverRange.fromString(ranges[0].trim()));
337+
opensearchVersionRanges.add(SemverRange.fromString(opensearchVersion.trim()));
332338
}
333339

334340
final String javaVersionString = propsMap.remove("java.version");

server/src/test/java/org/opensearch/index/store/remote/utils/TransferManagerTestCase.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,18 @@ public void testRefCount() throws Exception {
324324
assertEquals(Optional.of(1), Optional.of(fileCache.getRef(blobFetchRequest.getFilePath())));
325325
}
326326

327+
public void testRefMultipleCount() throws Exception {
328+
List<BlobFetchRequest.BlobPart> blobParts = new ArrayList<>();
329+
String blobname = "test-blob";
330+
blobParts.add(new BlobFetchRequest.BlobPart("blob", 0, EIGHT_MB));
331+
BlobFetchRequest blobFetchRequest = BlobFetchRequest.builder().fileName(blobname).directory(directory).blobParts(blobParts).build();
332+
transferManager.fetchBlob(blobFetchRequest);
333+
assertNotNull(fileCache.getRef(blobFetchRequest.getFilePath()));
334+
transferManager.fetchBlobAsync(blobFetchRequest).join();
335+
waitUntil(() -> fileCache.getRef(blobFetchRequest.getFilePath()) == 1, 10, TimeUnit.SECONDS);
336+
assertEquals(Optional.of(1), Optional.of(fileCache.getRef(blobFetchRequest.getFilePath())));
337+
}
338+
327339
protected abstract void initializeTransferManager() throws IOException;
328340

329341
protected abstract void mockExceptionWhileReading() throws IOException;

0 commit comments

Comments
 (0)