Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into hadoop-3.3.5
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Apr 6, 2023
2 parents 7760cc9 + 8b34e5f commit 690447c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Change http code on create index API with bad input raising NotXContentException from 500 to 400 ([#4773](https://github.com/opensearch-project/OpenSearch/pull/4773))
- Change http code for DecommissioningFailedException from 500 to 400 ([#5283](https://github.com/opensearch-project/OpenSearch/pull/5283))
- Improve summary error message for invalid setting updates ([#4792](https://github.com/opensearch-project/OpenSearch/pull/4792))
- Changed `opensearch-env` to respect already set `OPENSEARCH_HOME` environment variable ([#6956](https://github.com/opensearch-project/OpenSearch/pull/6956/))

### Deprecated

Expand Down Expand Up @@ -130,8 +131,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Added equals/hashcode for named DocValueFormat.DateTime inner class ([#6357](https://github.com/opensearch-project/OpenSearch/pull/6357))
- Fixed bug for searchable snapshot to take 'base_path' of blob into account ([#6558](https://github.com/opensearch-project/OpenSearch/pull/6558))
- Fix fuzziness validation ([#5805](https://github.com/opensearch-project/OpenSearch/pull/5805))
- Fix GetSnapshots to not return non-existent snapshots with ignore_unavailable=true ([#6839](https://github.com/opensearch-project/OpenSearch/pull/6839))

### Security

[Unreleased 3.0]: https://github.com/opensearch-project/OpenSearch/compare/2.x...HEAD
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.5...2.x
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.5...2.x
24 changes: 13 additions & 11 deletions distribution/src/bin/opensearch-env
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ while [ -h "$SCRIPT" ] ; do
fi
done

# determine OpenSearch home; to do this, we strip from the path until we find
# bin, and then strip bin (there is an assumption here that there is no nested
# directory under bin also named bin)
OPENSEARCH_HOME=`dirname "$SCRIPT"`

# now make OPENSEARCH_HOME absolute
OPENSEARCH_HOME=`cd "$OPENSEARCH_HOME"; pwd`

while [ "`basename "$OPENSEARCH_HOME"`" != "bin" ]; do
if [[ -z "$OPENSEARCH_HOME" ]]; then
# determine OpenSearch home; to do this, we strip from the path until we find
# bin, and then strip bin (there is an assumption here that there is no nested
# directory under bin also named bin)
OPENSEARCH_HOME=`dirname "$SCRIPT"`

# now make OPENSEARCH_HOME absolute
OPENSEARCH_HOME=`cd "$OPENSEARCH_HOME"; pwd`

while [ "`basename "$OPENSEARCH_HOME"`" != "bin" ]; do
OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"`
done
OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"`
done
OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"`
fi

# now set the classpath
OPENSEARCH_CLASSPATH="$OPENSEARCH_HOME/lib/*"
Expand Down
14 changes: 8 additions & 6 deletions distribution/src/bin/opensearch-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ set SCRIPT=%0
rem determine OpenSearch home; to do this, we strip from the path until we
rem find bin, and then strip bin (there is an assumption here that there is no
rem nested directory under bin also named bin)
for %%I in (%SCRIPT%) do set OPENSEARCH_HOME=%%~dpI
if not defined OPENSEARCH_HOME (
for %%I in (%SCRIPT%) do set OPENSEARCH_HOME=%%~dpI

:opensearch_home_loop
for %%I in ("%OPENSEARCH_HOME:~1,-1%") do set DIRNAME=%%~nxI
if not "%DIRNAME%" == "bin" (
:opensearch_home_loop
for %%I in ("%OPENSEARCH_HOME:~1,-1%") do set DIRNAME=%%~nxI
if not "%DIRNAME%" == "bin" (
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
goto opensearch_home_loop
)
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
goto opensearch_home_loop
)
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI

rem now set the classpath
set OPENSEARCH_CLASSPATH=!OPENSEARCH_HOME!\lib\*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,17 @@ public void testGetSnapshotsRequest() throws Exception {
.get();
assertEquals(1, getSnapshotsResponse.getSnapshots().size());
assertEquals("snap-on-empty-repo", getSnapshotsResponse.getSnapshots().get(0).snapshotId().getName());

// there is an in-progress snapshot, make sure we return empty result when getting a non-existing snapshot with setting
// ignore_unavailable to true
getSnapshotsResponse = client.admin()
.cluster()
.prepareGetSnapshots("test-repo")
.setIgnoreUnavailable(true)
.addSnapshots("non-existent-snapshot")
.get();
assertEquals(0, getSnapshotsResponse.getSnapshots().size());

unblockNode(repositoryName, initialBlockedNode); // unblock node
admin().cluster().prepareDeleteSnapshot(repositoryName, "snap-on-empty-repo").get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,11 @@ private List<SnapshotInfo> snapshots(
repositoryName,
snapshotIdsToIterate.stream().map(SnapshotId::getName).collect(Collectors.toList())
);
// filter and incorporate the snapshots in progress
for (SnapshotsInProgress.Entry entry : entries) {
snapshotSet.add(new SnapshotInfo(entry));
snapshotIdsToIterate.remove(entry.snapshot().getSnapshotId());
if (snapshotIdsToIterate.remove(entry.snapshot().getSnapshotId())) {
snapshotSet.add(new SnapshotInfo(entry));
}
}
// then, look in the repository
final Repository repository = repositoriesService.repository(repositoryName);
Expand Down

0 comments on commit 690447c

Please sign in to comment.