Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor indices aliases #2

Conversation

joegallo
Copy link
Collaborator

Please don't actually merge this. I'd rather we use git trickery to update your branch without merging this PR. But I did want some easy way to say "look at what I've done here since we last spoke" and this is a half decent way of doing that.

Annoyingly there's some (IMHO) unnecessary noise because I merged master in.

In conclusion, reiterating: please don't actually merge this.

❤️

jrodewig and others added 19 commits November 15, 2021 10:42
* Reorganizes the 8.0.0 and 8.1.0 breaking changes and deprecations into component-based categories.
* Adds an ESS icon to cluster settings on the ESS user settings allowlist.
* Adds tips for sections that aren't relevant to Cloud users.
* Updates the labels for some items to provide better context.

Co-authored-by: debadair <debadair@elastic.co>
…80696)

We currently throw a message that always refers to the `_parent` field,
even though it could be throw from any metadata field, and indeed the
`_parent` field hasn't existed for several versions now.
Includes command line tool deprecations in the notable changes tag.
getIndices() and getAliases() go through indices() and aliases(), so
do that here, too.
Makes several changes to consolidate snapshot and backup-related docs.

Highlights:

* Adds info about supported ESS snapshot repository types
* Adds docs for Kibana's Snapshot and Restore feature
* Combines tutorial pages related to taking and managing snapshots
* Consolidates explanations of the snapshot process
* Incorporates SLM into the snapshot tutorial
* Removes duplicate "back up a cluster" pages
Update the notes in TESTING.asciidoc about how to build a distribution of Elasticsearch.
public ImmutableOpenMap<String, IndexTemplateMetadata> templates() {
return this.templates;
}

public ImmutableOpenMap<String, IndexTemplateMetadata> getTemplates() {
return this.templates;
return templates();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely unrelated, see 7f25f49.

previousIndicesLookup = null;

List<Index> indices = new ArrayList<>(aliases.getOrDefault(alias, List.of()));
indices.remove(index); // TODO what if it wasn't in the list already?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe:

if (indices.remove(index) == false) {
   return this;
}

Which would make this a no-op.

previousIndicesLookup = null;

List<Index> indices = new ArrayList<>(aliases.getOrDefault(alias, List.of()));
indices.add(index); // TODO what if it's a duplicate? maybe use a Set<Index> instead?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it easier if we make we change the aliases map to contain a Set instead of if List.

and also maybe:

if (indices.add(index) == false) {
    return this;
}

to make this a no-op in case .

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++, I'll make the List<Index> --> Set<Index> change throughout, and let's see what that gets us.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually, I just remembered -- https://github.com/elastic/elasticsearch/blob/fed20aa74b48b2220870c782027a69de305bf56c/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java#L1147-L1150 makes me think there's existing semantics around the order of the aliases for an index, might we want to preserve something that like here? That is, is there value in having List semantics rather than Set semantics or no?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is the case, once an index and its aliases are created.

.blocks(ClusterBlocks.builder().addBlocks(idxMetadata))
.build();

ClusterState after = service.deleteIndices(before, Set.of(before.metadata().getIndices().get(index).getIndex()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe check that that before the delete call an alias entry does exist?

@@ -124,6 +124,13 @@ public ClusterState deleteIndices(ClusterState currentState, Set<Index> indices)
metadataBuilder.put(parent.removeBackingIndex(index));
}
}
// delete associated aliases from the cluster state
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe inline this into Metadata.Builder#remove(...) method? If an IndexMetadata has aliases then we always need to invoke the remobeAlias() method (and we don't need to check whether aliases have changed).

@joegallo joegallo closed this Nov 16, 2021
martijnvg pushed a commit that referenced this pull request Oct 17, 2023
…c#100592)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.
martijnvg pushed a commit that referenced this pull request Oct 17, 2023
….10 (elastic#100805)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute
martijnvg pushed a commit that referenced this pull request Oct 17, 2023
* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute

* Restore version skipping for position fields

* Restore version skip for synthetic source
martijnvg pushed a commit that referenced this pull request Oct 18, 2023
….10 (elastic#100805) (elastic#100814)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute
martijnvg pushed a commit that referenced this pull request Oct 18, 2023
…c#100823)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute

* Restore version skipping for position fields

* Restore version skip for synthetic source
martijnvg pushed a commit that referenced this pull request Mar 20, 2024
When we run the csv-spec tests for ESQL against a real http endpoint we
actually run them twice - once async and once sync. But the names of the
tests didn't reflect that - they just looked like they were accidentally
duplicated. This updates the format. So this:
```
test {string.Trim}
test {string.Trim #2}
```

becomes:
```
test {string.Trim ASYNC}
test {string.Trim SYNC}
```
martijnvg pushed a commit that referenced this pull request Jul 4, 2024
…8.7 - 8.10 (elastic#100805) (elastic#100815)

* [TEST] Mute all tsdb tests in mixedClusterTests, for versions 8.7 - 8.10 (elastic#100805)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute

* Fix skip for position fields
martijnvg pushed a commit that referenced this pull request Jul 4, 2024
…rce (elastic#100827)

* [TEST] Mute all tsdb tests in mixedClusterTests, for versions 8.7 - 8.10 (elastic#100805)

* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e8156.

* Revert "Don't print synthetic source in mapping for bwc tests (elastic#100572)"

This reverts commit 9322ab9.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute

* Fix skip for position fields

* Restore version skip for synthetic source
martijnvg pushed a commit that referenced this pull request Aug 14, 2024
martijnvg pushed a commit that referenced this pull request Sep 3, 2024
…alCentroidTests testAggregateIntermediate {TestCase=<geo_point> #2} elastic#112461
martijnvg pushed a commit that referenced this pull request Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants