Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into resource-permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshitChanpura committed Dec 17, 2024
2 parents d7d1f25 + d947df0 commit a44b06a
Show file tree
Hide file tree
Showing 65 changed files with 136 additions and 49 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add stats for remote publication failure and move download failure stats to remote methods([#16682](https://github.com/opensearch-project/OpenSearch/pull/16682/))
- Added a precaution to handle extreme date values during sorting to prevent `arithmetic_exception: long overflow` ([#16812](https://github.com/opensearch-project/OpenSearch/pull/16812)).
- Add search replica stats to segment replication stats API ([#16678](https://github.com/opensearch-project/OpenSearch/pull/16678))
- Introduce a setting to disable download of full cluster state from remote on term mismatch([#16798](https://github.com/opensearch-project/OpenSearch/pull/16798/))
- Add resource-level access control and sharing ([#16030](https://github.com/opensearch-project/OpenSearch/pull/16030))

### Dependencies
Expand All @@ -32,18 +33,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `com.google.apis:google-api-services-compute` from v1-rev20240407-2.0.0 to v1-rev20241105-2.0.0 ([#16502](https://github.com/opensearch-project/OpenSearch/pull/16502), [#16548](https://github.com/opensearch-project/OpenSearch/pull/16548), [#16613](https://github.com/opensearch-project/OpenSearch/pull/16613))
- Bump `com.azure:azure-storage-blob` from 12.23.0 to 12.28.1 ([#16501](https://github.com/opensearch-project/OpenSearch/pull/16501))
- Bump `org.apache.hadoop:hadoop-minicluster` from 3.4.0 to 3.4.1 ([#16550](https://github.com/opensearch-project/OpenSearch/pull/16550))
- Bump `org.apache.xmlbeans:xmlbeans` from 5.2.1 to 5.2.2 ([#16612](https://github.com/opensearch-project/OpenSearch/pull/16612))
- Bump `org.apache.xmlbeans:xmlbeans` from 5.2.1 to 5.3.0 ([#16612](https://github.com/opensearch-project/OpenSearch/pull/16612), [#16854](https://github.com/opensearch-project/OpenSearch/pull/16854))
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.41.1 to 9.47 ([#16611](https://github.com/opensearch-project/OpenSearch/pull/16611), [#16807](https://github.com/opensearch-project/OpenSearch/pull/16807))
- Bump `lycheeverse/lychee-action` from 2.0.2 to 2.1.0 ([#16610](https://github.com/opensearch-project/OpenSearch/pull/16610))
- Bump `me.champeau.gradle.japicmp` from 0.4.4 to 0.4.5 ([#16614](https://github.com/opensearch-project/OpenSearch/pull/16614))
- Bump `mockito` from 5.14.1 to 5.14.2, `objenesis` from 3.2 to 3.3 and `bytebuddy` from 1.15.4 to 1.15.10 ([#16655](https://github.com/opensearch-project/OpenSearch/pull/16655))
- Bump `Netty` from 4.1.114.Final to 4.1.115.Final ([#16661](https://github.com/opensearch-project/OpenSearch/pull/16661))
- Bump `org.xerial.snappy:snappy-java` from 1.1.10.6 to 1.1.10.7 ([#16665](https://github.com/opensearch-project/OpenSearch/pull/16665))
- Bump `codecov/codecov-action` from 4 to 5 ([#16667](https://github.com/opensearch-project/OpenSearch/pull/16667))
- Bump `org.apache.logging.log4j:log4j-core` from 2.24.1 to 2.24.2 ([#16718](https://github.com/opensearch-project/OpenSearch/pull/16718))
- Bump `org.apache.logging.log4j:log4j-core` from 2.24.1 to 2.24.3 ([#16718](https://github.com/opensearch-project/OpenSearch/pull/16718), [#16858](https://github.com/opensearch-project/OpenSearch/pull/16858))
- Bump `jackson` from 2.17.2 to 2.18.2 ([#16733](https://github.com/opensearch-project/OpenSearch/pull/16733))
- Bump `ch.qos.logback:logback-classic` from 1.2.13 to 1.5.12 ([#16716](https://github.com/opensearch-project/OpenSearch/pull/16716))
- Bump `com.azure:azure-identity` from 1.13.2 to 1.14.2 ([#16778](https://github.com/opensearch-project/OpenSearch/pull/16778))
- Bump Apache Lucene from 9.12.0 to 9.12.1 ([#16846](https://github.com/opensearch-project/OpenSearch/pull/16846))
- Bump `com.gradle.develocity` from 3.18.2 to 3.19 ([#16855](https://github.com/opensearch-project/OpenSearch/pull/16855))
- Bump `org.jline:jline` from 3.27.1 to 3.28.0 ([#16857](https://github.com/opensearch-project/OpenSearch/pull/16857))

### Changed
- Indexed IP field supports `terms_query` with more than 1025 IP masks [#16391](https://github.com/opensearch-project/OpenSearch/pull/16391)
Expand All @@ -69,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Ensure consistency of system flag on IndexMetadata after diff is applied ([#16644](https://github.com/opensearch-project/OpenSearch/pull/16644))
- Skip remote-repositories validations for node-joins when RepositoriesService is not in sync with cluster-state ([#16763](https://github.com/opensearch-project/OpenSearch/pull/16763))
- Fix _list/shards API failing when closed indices are present ([#16606](https://github.com/opensearch-project/OpenSearch/pull/16606))
- Fix remote shards balance ([#15335](https://github.com/opensearch-project/OpenSearch/pull/15335))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
implementation "org.apache.logging.log4j:log4j-core:2.24.2"
implementation "org.apache.logging.log4j:log4j-core:2.24.3"
}

["0.0.1", "0.0.2"].forEach { v ->
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
opensearch = "3.0.0"
lucene = "9.12.0"
lucene = "9.12.1"

bundled_jdk_vendor = "adoptium"
bundled_jdk = "23.0.1+11"
Expand Down
1 change: 0 additions & 1 deletion libs/core/licenses/lucene-core-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions libs/core/licenses/lucene-core-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
91447c90c1180122142773b5baddaf8547124794
2 changes: 1 addition & 1 deletion libs/core/src/main/java/org/opensearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public class Version implements Comparable<Version>, ToXContentFragment {
public static final Version V_2_17_2 = new Version(2170299, org.apache.lucene.util.Version.LUCENE_9_11_1);
public static final Version V_2_18_0 = new Version(2180099, org.apache.lucene.util.Version.LUCENE_9_12_0);
public static final Version V_2_18_1 = new Version(2180199, org.apache.lucene.util.Version.LUCENE_9_12_0);
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_12_0);
public static final Version V_2_19_0 = new Version(2190099, org.apache.lucene.util.Version.LUCENE_9_12_0);
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_12_1);
public static final Version CURRENT = V_3_0_0;

public static Version fromId(int id) {
Expand Down

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d8e4716dab6d829e7b37a8b185cbd242650aeb9e
2 changes: 1 addition & 1 deletion plugins/ingest-attachment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {
api "org.apache.poi:poi:${versions.poi}"
api "org.apache.poi:poi-ooxml-lite:${versions.poi}"
api "commons-codec:commons-codec:${versions.commonscodec}"
api 'org.apache.xmlbeans:xmlbeans:5.2.2'
api 'org.apache.xmlbeans:xmlbeans:5.3.0'
api 'org.apache.commons:commons-collections4:4.4'
// MS Office
api "org.apache.poi:poi-scratchpad:${versions.poi}"
Expand Down
1 change: 0 additions & 1 deletion plugins/ingest-attachment/licenses/xmlbeans-5.2.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/ingest-attachment/licenses/xmlbeans-5.3.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f93c3ba820d7240b7fec4ec5bc35e7223cc6fc1f
1 change: 0 additions & 1 deletion server/licenses/lucene-analysis-common-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-analysis-common-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
86836497e35c1ab33259d9864ceb280c0016075e
1 change: 0 additions & 1 deletion server/licenses/lucene-backward-codecs-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-backward-codecs-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d0e79d06a0ed021663737e4df777ab7b80cd28c4
1 change: 0 additions & 1 deletion server/licenses/lucene-core-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-core-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
91447c90c1180122142773b5baddaf8547124794
1 change: 0 additions & 1 deletion server/licenses/lucene-grouping-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-grouping-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e4bc3d0aa7eec4f41b4f350de0263a8d5625d2b3
1 change: 0 additions & 1 deletion server/licenses/lucene-highlighter-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-highlighter-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2eeedfcec47dd65969f36e88931ed452291dd43e
1 change: 0 additions & 1 deletion server/licenses/lucene-join-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-join-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3c5e9ff2925a8373ae0d35c1d0a7b2465cebec9f
1 change: 0 additions & 1 deletion server/licenses/lucene-memory-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-memory-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e80eecfb1dcc324140387c8357c81e12c2a01937
1 change: 0 additions & 1 deletion server/licenses/lucene-misc-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-misc-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4e65d01d1c23f3f49dc325d552701bbefafee7ee
1 change: 0 additions & 1 deletion server/licenses/lucene-queries-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-queries-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14f24315041b686683dba4bc679ca7dc6a505906
1 change: 0 additions & 1 deletion server/licenses/lucene-queryparser-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-queryparser-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aa6df09a99f8881d843e9863aa1713dc9f3ed24f
1 change: 0 additions & 1 deletion server/licenses/lucene-sandbox-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-sandbox-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1a66485629d60779f039fc26360f4374ef1496e7
1 change: 0 additions & 1 deletion server/licenses/lucene-spatial-extras-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-spatial-extras-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0a7379410eff21676472adc8ea76a57891ec83c2
1 change: 0 additions & 1 deletion server/licenses/lucene-spatial3d-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-spatial3d-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2fdea4edabb1f616f494999651c43abfd0aa124
1 change: 0 additions & 1 deletion server/licenses/lucene-suggest-9.12.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions server/licenses/lucene-suggest-9.12.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0660e0996ec7653fe0c13c608137e264645eecac
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private GetTermVersionResponse buildResponse(GetTermVersionRequest request, Clus
ClusterStateTermVersion termVersion = new ClusterStateTermVersion(state);
if (discovery instanceof Coordinator) {
Coordinator coordinator = (Coordinator) discovery;
if (coordinator.isRemotePublicationEnabled()) {
if (coordinator.canDownloadFullStateFromRemote()) {
return new GetTermVersionResponse(termVersion, coordinator.isRemotePublicationEnabled());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1906,4 +1906,12 @@ public boolean isRemotePublicationEnabled() {
}
return false;
}

public boolean canDownloadFullStateFromRemote() {
if (remoteClusterStateService != null) {
return remoteClusterStateService.isRemotePublicationEnabled() && remoteClusterStateService.canDownloadFromRemoteForReadAPI();
}
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,17 @@ void balance() {
final Map<String, Integer> nodePrimaryShardCount = calculateNodePrimaryShardCount(remoteRoutingNodes);
int totalPrimaryShardCount = nodePrimaryShardCount.values().stream().reduce(0, Integer::sum);

totalPrimaryShardCount += routingNodes.unassigned().getNumPrimaries();
int avgPrimaryPerNode = (totalPrimaryShardCount + routingNodes.size() - 1) / routingNodes.size();
int unassignedRemotePrimaryShardCount = 0;
for (ShardRouting shard : routingNodes.unassigned()) {
if (RoutingPool.REMOTE_CAPABLE.equals(RoutingPool.getShardPool(shard, allocation)) && shard.primary()) {
unassignedRemotePrimaryShardCount++;
}
}
totalPrimaryShardCount += unassignedRemotePrimaryShardCount;
final int avgPrimaryPerNode = (totalPrimaryShardCount + remoteRoutingNodes.size() - 1) / remoteRoutingNodes.size();

ArrayDeque<RoutingNode> sourceNodes = new ArrayDeque<>();
ArrayDeque<RoutingNode> targetNodes = new ArrayDeque<>();
final ArrayDeque<RoutingNode> sourceNodes = new ArrayDeque<>();
final ArrayDeque<RoutingNode> targetNodes = new ArrayDeque<>();
for (RoutingNode node : remoteRoutingNodes) {
if (nodePrimaryShardCount.get(node.nodeId()) > avgPrimaryPerNode) {
sourceNodes.add(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ public ClusterState state() {
return clusterState;
}

/**
* Returns true if the appliedClusterState is not null
*/
public boolean isStateInitialised() {
return this.state.get() != null;
}

/**
* Returns true if the appliedClusterState is not null
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ public ClusterState state() {
return clusterApplierService.state();
}

/**
* Returns true if the state in appliedClusterState is not null
*/
public boolean isStateInitialised() {
return clusterApplierService.isStateInitialised();
}

/**
* The state that is persisted to store but may not be applied to cluster.
* @return ClusterState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ public void apply(Settings value, Settings current, Settings previous) {
RemoteClusterStateCleanupManager.REMOTE_CLUSTER_STATE_CLEANUP_INTERVAL_SETTING,
RemoteClusterStateService.REMOTE_CLUSTER_STATE_ENABLED_SETTING,
RemoteClusterStateService.REMOTE_PUBLICATION_SETTING,
RemoteClusterStateService.REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API,

INDEX_METADATA_UPLOAD_TIMEOUT_SETTING,
GLOBAL_METADATA_UPLOAD_TIMEOUT_SETTING,
METADATA_MANIFEST_UPLOAD_TIMEOUT_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public class RemoteClusterStateService implements Closeable {
* Gates the functionality of remote publication.
*/
public static final String REMOTE_PUBLICATION_SETTING_KEY = "cluster.remote_store.publication.enabled";
public static final String REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API_KEY = "cluster.remote_state.download.serve_read_api.enabled";

public static final Setting<Boolean> REMOTE_PUBLICATION_SETTING = Setting.boolSetting(
REMOTE_PUBLICATION_SETTING_KEY,
Expand All @@ -137,6 +138,13 @@ public class RemoteClusterStateService implements Closeable {
Property.Dynamic
);

public static final Setting<Boolean> REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API = Setting.boolSetting(
REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API_KEY,
true,
Property.NodeScope,
Property.Dynamic
);

/**
* Used to specify if cluster state metadata should be published to remote store
*/
Expand Down Expand Up @@ -235,6 +243,9 @@ public static RemoteClusterStateValidationMode parseString(String mode) {
+ "indices, coordination metadata updated : [{}], settings metadata updated : [{}], templates metadata "
+ "updated : [{}], custom metadata updated : [{}], indices routing updated : [{}]";
private volatile AtomicBoolean isPublicationEnabled;

private volatile AtomicBoolean downloadFromRemoteForReadAPI;

private final String remotePathPrefix;

private final RemoteClusterStateCache remoteClusterStateCache;
Expand Down Expand Up @@ -281,6 +292,8 @@ public RemoteClusterStateService(
&& RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured(settings)
);
clusterSettings.addSettingsUpdateConsumer(REMOTE_PUBLICATION_SETTING, this::setRemotePublicationSetting);
this.downloadFromRemoteForReadAPI = new AtomicBoolean(clusterSettings.get(REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API));
clusterSettings.addSettingsUpdateConsumer(REMOTE_STATE_DOWNLOAD_TO_SERVE_READ_API, this::setRemoteDownloadForReadAPISetting);
this.remotePathPrefix = CLUSTER_REMOTE_STORE_STATE_PATH_PREFIX.get(settings);
this.remoteRoutingTableService = RemoteRoutingTableServiceFactory.getService(
repositoriesService,
Expand Down Expand Up @@ -1124,6 +1137,14 @@ private void setRemotePublicationSetting(boolean remotePublicationSetting) {
}
}

private void setRemoteDownloadForReadAPISetting(boolean remoteDownloadForReadAPISetting) {
this.downloadFromRemoteForReadAPI.set(remoteDownloadForReadAPISetting);
}

public boolean canDownloadFromRemoteForReadAPI() {
return this.downloadFromRemoteForReadAPI.get();
}

// Package private for unit test
RemoteRoutingTableService getRemoteRoutingTableService() {
return this.remoteRoutingTableService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,12 @@ public String startVerification() {
*/
private BlobContainer testContainer(String seed) {
BlobPath testBlobPath;
if (prefixModeVerification == true) {

if (prefixModeVerification == true
&& (clusterService.isStateInitialised() == false
|| clusterService.state().nodes().getMinNodeVersion().onOrAfter(Version.V_2_17_0))) {
// During the remote store node bootstrap, the cluster state is not initialised
// Otherwise, the cluster state is initialised and available with the min node version information
PathInput pathInput = PathInput.builder().basePath(basePath()).indexUUID(seed).build();
testBlobPath = PathType.HASHED_PREFIX.path(pathInput, FNV_1A_COMPOSITE_1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public AllocationService createRemoteCapableAllocationService() {
}

public AllocationService createRemoteCapableAllocationService(String excludeNodes) {
Settings settings = Settings.builder().put("cluster.routing.allocation.exclude.node_id", excludeNodes).build();
Settings settings = Settings.builder().put("cluster.routing.allocation.exclude._id", excludeNodes).build();
return new MockAllocationService(
randomAllocationDeciders(settings, EMPTY_CLUSTER_SETTINGS, random()),
new TestGatewayAllocator(),
Expand Down
Loading

0 comments on commit a44b06a

Please sign in to comment.