Skip to content

Conversation

@martijnvg
Copy link
Member

Closes #70903 #70861

@martijnvg martijnvg added the :Data Management/Data streams Data streams and their lifecycles label Mar 26, 2021
assertThat(backingIndices.stream().map(Index::getName).collect(Collectors.toList()), contains(expectedBackingIndexName));
}

public void testSnapshotAndRestoreInPlace() throws Exception {
Copy link
Member Author

@martijnvg martijnvg Mar 29, 2021

Choose a reason for hiding this comment

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

This test will pas when #70934 is merged.
(the restore fails, because after a snapshot was taken, a rollover happened, which created a new backing index, when restoring the version of the data stream where this didn't happen, the restore fails because a unrelated index is in the data stream's namespace)

})) {
@Override
public ClusterState execute(ClusterState currentState) {
List<String> writeIndices = new ArrayList<>();
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't add a unit test for this, because currently for this code no unit tests exist.
The Cannot freeze write index for data stream yaml test does test this.

@martijnvg martijnvg marked this pull request as ready for review March 29, 2021 09:08
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Mar 29, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@danhermann
Copy link
Contributor

@elasticmachine update branch

Copy link
Contributor

@danhermann danhermann left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @martijnvg!

@martijnvg martijnvg merged commit 633b66f into elastic:master Mar 30, 2021
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Mar 30, 2021
Backport of elastic#70908 to 7.x branch.

Prior to this commit when attempting to close a data stream a validation error is returned indicating that it is forbidden to close a write index of a data stream. The idea behind that is to ensure that a data stream always can accept writes. For the same reason deleting a write index is not allowed (the write index can only be deleted when deleting the entire data stream).

However closing an index isn't as destructive as deleting an index (an open index request makes the write index available again) and there are other cases where a data stream can't accept writes. For example when primary shards of the write index are not available. So the original reasoning for not allowing to close a write index isn't that strong.

On top of this is that this also avoids certain administrative operations from being performed. For example restoring a snapshot containing data streams that already exist in the cluster (in place restore).

Closes elastic#70903 elastic#70861
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Mar 30, 2021
Backport of elastic#70908 to 7.12 branch.

Prior to this commit when attempting to close a data stream a validation error is returned indicating that it is forbidden to close a write index of a data stream. The idea behind that is to ensure that a data stream always can accept writes. For the same reason deleting a write index is not allowed (the write index can only be deleted when deleting the entire data stream).

However closing an index isn't as destructive as deleting an index (an open index request makes the write index available again) and there are other cases where a data stream can't accept writes. For example when primary shards of the write index are not available. So the original reasoning for not allowing to close a write index isn't that strong.

On top of this is that this also avoids certain administrative operations from being performed. For example restoring a snapshot containing data streams that already exist in the cluster (in place restore).

Closes elastic#70903 elastic#70861
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Mar 30, 2021
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Mar 30, 2021
martijnvg added a commit that referenced this pull request Mar 30, 2021
martijnvg added a commit that referenced this pull request Mar 30, 2021
Backport of #70908 to 7.x branch.

Prior to this commit when attempting to close a data stream a validation error is returned indicating that it is forbidden to close a write index of a data stream. The idea behind that is to ensure that a data stream always can accept writes. For the same reason deleting a write index is not allowed (the write index can only be deleted when deleting the entire data stream).

However closing an index isn't as destructive as deleting an index (an open index request makes the write index available again) and there are other cases where a data stream can't accept writes. For example when primary shards of the write index are not available. So the original reasoning for not allowing to close a write index isn't that strong.

On top of this is that this also avoids certain administrative operations from being performed. For example restoring a snapshot containing data streams that already exist in the cluster (in place restore).

Closes #70903 #70861

* Update docs that closing a data stream's write index is allowed
See #70908

* iter

* iter
martijnvg added a commit that referenced this pull request Mar 31, 2021
Backport of #70908 to 7.12 branch.

Prior to this commit when attempting to close a data stream a validation error is returned indicating that it is forbidden to close a write index of a data stream. The idea behind that is to ensure that a data stream always can accept writes. For the same reason deleting a write index is not allowed (the write index can only be deleted when deleting the entire data stream).

However closing an index isn't as destructive as deleting an index (an open index request makes the write index available again) and there are other cases where a data stream can't accept writes. For example when primary shards of the write index are not available. So the original reasoning for not allowing to close a write index isn't that strong.

On top of this is that this also avoids certain administrative operations from being performed. For example restoring a snapshot containing data streams that already exist in the cluster (in place restore).

Closes #70903 #70861
jrodewig added a commit that referenced this pull request May 12, 2021
With #70908, you can now close a write index in 7.12.1 and later versions.
This removes an outdated reference from the data stream overview docs.
jrodewig added a commit that referenced this pull request May 12, 2021
…73008)

With #70908, you can now close a write index in 7.12.1 and later versions.
This removes an outdated reference from the data stream overview docs.
jrodewig added a commit that referenced this pull request May 12, 2021
…73009)

With #70908, you can now close a write index in 7.12.1 and later versions.
This removes an outdated reference from the data stream overview docs.
jrodewig added a commit that referenced this pull request May 12, 2021
…73010)

With #70908, you can now close a write index in 7.12.1 and later versions.
This removes an outdated reference from the data stream overview docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow closing a write index of a data stream

4 participants