Skip to content

Conversation

@gwbrown
Copy link
Contributor

@gwbrown gwbrown commented Jun 30, 2021

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in #74687.

@gwbrown gwbrown marked this pull request as ready for review July 6, 2021 18:35
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jul 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@williamrandolph williamrandolph left a comment

Choose a reason for hiding this comment

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

Great work, and tests look good. I've got a handful of small suggestions; otherwise, LGTM.

return false;
case RESTRICTED:
return resolver.getSystemIndexAccessPredicate().test(indexAbstraction.getName());
case NON_NET_NEW_ONLY:
Copy link
Contributor

Choose a reason for hiding this comment

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

NON_NET_NEW_ONLY is a little but clunky as a name. I have a few alternate suggestion:

  • BWC_SYSTEM_INDICES_ONLY or BACKWARDS_COMPATIBLE_ONLY - makes clear that this behavior is bwc-related
  • LEGACY_BEHAVIOR or LEGACY_ONLY - I don't love introducing the term "legacy," because the indices themselves aren't legacies.
  • DEPRECATED_ACCESS_ONLY - fairly clear, right? This one indicates that access will disappear, which I like.

What do you think? If we keep the current name, I would want to put Javadoc on its enum entry so that confused devs can click through for an explanation of what the level means.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wrote the above review comment earlier; if it's urgent to merge I think we can avoid a back-and-forth discussion and stick with NON_NET_NEW_ONLY.

Copy link
Contributor Author

@gwbrown gwbrown Jul 14, 2021

Choose a reason for hiding this comment

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

I changed this to BACKWARDS_COMPATIBLE_ONLY as well as adding some javadoc: 26cbb39

I like that name much better, I knew NET_NEW_ONLY was bad I just didn't know what to do instead.

throw systemIndices.netNewSystemIndexAccessException(threadPool.getThreadContext(), List.of(indexName));
}
} else {
// NON_NET_NEW_ONLY should never be a possibility here, as it cannot be returned from getSystemIndexAccessLevel.
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's not a possibility, should we assert on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's an assert immediately below this line that the access level should be NONE, which includes that it shouldn't be BACKWARDS_COMPATIBLE_ONLY by implication. I also added asserts to other places this method is used, though, and a comment in getSystemIndexAccessLevel noting it's intentional that it can't be returned from that method: 8bd9f81

assertThat(result.get("logs-foo"), contains(new DataStreamAlias("logs", List.of("logs-bar", "logs-foo"), null)));
}

public void testNetNetSystemIndicesDontErrorWhenNotRequested() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void testNetNetSystemIndicesDontErrorWhenNotRequested() {
public void testNetNewSystemIndicesDontErrorWhenNotRequested() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@gwbrown
Copy link
Contributor Author

gwbrown commented Jul 14, 2021

Test failures appear to be caused by #74358 and #75221.

@elasticmachine run elasticsearch-ci/part-1

@gwbrown
Copy link
Contributor Author

gwbrown commented Jul 14, 2021

Another instance of #75221.

@elasticmachine run elasticsearch-ci/part-1

@gwbrown gwbrown merged commit 26ad7e4 into elastic:master Jul 14, 2021
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Jul 14, 2021
…et-new indices (elastic#74803)

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in elastic#74687.
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Jul 14, 2021
…et-new indices (elastic#74803)

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in elastic#74687.
gwbrown added a commit that referenced this pull request Jul 15, 2021
…et-new indices (#74803)

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in #74687.
gwbrown added a commit that referenced this pull request Jul 15, 2021
…et-new indices (#74803)

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in #74687.
masseyke pushed a commit to masseyke/elasticsearch that referenced this pull request Jul 16, 2021
…et-new indices (elastic#74803)

This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in elastic#74687.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v7.14.0 v7.15.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants