Skip to content

Commit

Permalink
496: Added one extra line in changelog. Removed method for getting th…
Browse files Browse the repository at this point in the history
…e filters as string

Signed-off-by: Stevan Buzejic <[email protected]>
  • Loading branch information
stevanbz committed Sep 20, 2022
1 parent 0b2f42d commit b7ad349
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed flaky test `ResourceAwareTasksTests.testTaskIdPersistsInThreadContext` ([#4484](https://github.com/opensearch-project/OpenSearch/pull/4484))
- Fixed the ignore_malformed setting to also ignore objects ([#4494](https://github.com/opensearch-project/OpenSearch/pull/4494))
- [Bug]: Alias filter lost after rollover ([#4499](https://github.com/opensearch-project/OpenSearch/pull/4499))

### Security
- CVE-2022-25857 org.yaml:snakeyaml DOS vulnerability ([#4341](https://github.com/opensearch-project/OpenSearch/pull/4341))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,15 @@ static List<AliasAction> rolloverAliasToNewIndex(
AliasMetadata aliasMetada,
String alias
) {
String filterAsString = aliasMetada.getFilter() != null ? aliasMetada.getFilter().string() : null;

if (explicitWriteIndex) {
return Collections.unmodifiableList(
Arrays.asList(
new AliasAction.Add(
newIndex,
alias,
aliasMetada.getFilterAsString(),
filterAsString,
aliasMetada.getIndexRouting(),
aliasMetada.getSearchRouting(),
true,
Expand All @@ -327,7 +329,7 @@ static List<AliasAction> rolloverAliasToNewIndex(
new AliasAction.Add(
oldIndex,
alias,
aliasMetada.getFilterAsString(),
filterAsString,
aliasMetada.getIndexRouting(),
aliasMetada.getSearchRouting(),
false,
Expand All @@ -341,7 +343,7 @@ static List<AliasAction> rolloverAliasToNewIndex(
new AliasAction.Add(
newIndex,
alias,
aliasMetada.getFilterAsString(),
filterAsString,
aliasMetada.getIndexRouting(),
aliasMetada.getSearchRouting(),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ public CompressedXContent getFilter() {
return filter();
}

public String getFilterAsString() {
if (filter == null) {
return null;
}
return filter.string();
}

public boolean filteringRequired() {
return filter != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void testRolloverAliasActionsWithFilterAndExplicitWriteIndex() {
AliasAction.Add addAction = (AliasAction.Add) action;
if (action.getIndex().equals(targetIndex)) {
assertEquals(sourceAlias, addAction.getAlias());
assertEquals(aliasMetadata.getFilterAsString(), addAction.getFilter());
assertEquals(aliasMetadata.filter().string(), addAction.getFilter());
assertEquals(indexRouting, addAction.getIndexRouting());
assertEquals(sourceRouting, addAction.getSearchRouting());

Expand Down Expand Up @@ -299,7 +299,7 @@ public void testRolloverAliasActionsWithFilterAndHiddenAliasAndImplicitWriteInde
assertEquals(sourceAlias, addAction.getAlias());
assertThat(addAction.writeIndex(), nullValue());
assertTrue(addAction.isHidden());
assertEquals(aliasMetadata.getFilterAsString(), addAction.getFilter());
assertEquals(aliasMetadata.filter().string(), addAction.getFilter());
assertEquals(indexRouting, addAction.getIndexRouting());
assertEquals(sourceRouting, addAction.getSearchRouting());
foundAddWrite = true;
Expand Down

0 comments on commit b7ad349

Please sign in to comment.