More reliable trigger for security index migration#139028
More reliable trigger for security index migration#139028tvernum merged 2 commits intoelastic:mainfrom
Conversation
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
|
Pinging @elastic/es-security (Team:Security) |
|
Hi @tvernum, I've created a changelog YAML for you. |
jfreden
left a comment
There was a problem hiding this comment.
LGTM! Thanks for fixing this!
| return new ClusterChangedEvent("test-event", clusterState, EMPTY_CLUSTER_STATE); | ||
| } | ||
|
|
||
| public void testStateChangeListenerIsCalledIfMigrationIsRequired() { |
There was a problem hiding this comment.
It would be nice to add an assertion in this test that makes sure that the listener isn't called if the migration is running and the state is unchanged, since that protects the listener from being called on every cluster state change until the target migration version has been applied.
There was a problem hiding this comment.
Fair, I can add that in a followup PR (or leave it to you if you want to get one in today).
I don't think we want to hold up the fix waiting for the test (since the code does check for an in-progress migration)
💔 Backport failed
You can use sqren/backport to manually backport by running |
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event Co-authored-by: Tim Vernum <tim@adjective.org>
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event (cherry picked from commit ac2e0b0) # Conflicts: # x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java # x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/support/SecurityIndexManagerTests.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event
We always want to trigger an index migration if one is required. However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task. Now, we say that if a security index exists, and it requires migration then it also triggers a change event (cherry picked from commit ac2e0b0) # Conflicts: # x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java # x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/support/SecurityIndexManagerTests.java Co-authored-by: Tim Vernum <tim@adjective.org>
We always want to trigger an index migration if one is required.
However, we previously would only do that if we detected a change to the state of the security index on the master node. But a rolling upgrade might not cause a detectable change in index state - for example, in a cluster with dedicated masters nodes, if those nodes were upgraded last, then all index relocation would happen before the masters knew about the new migration (so they couldn't trigger it) and once the masters were upgraded they would detect that nothing had changed so never send a "security index changed" event and never trigger the migration task.
Now, we say that if a security index exists, and it requires migration then it also triggers a change event