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

[BUG] Alias filter updates don't get propagated to follower clusters #490

Closed
krishna-ggk opened this issue Aug 22, 2022 · 0 comments
Closed
Assignees
Labels
bug Something isn't working must_fix v2.x v2.3.0 'Issues and PRs related to version v2.3.0'

Comments

@krishna-ggk
Copy link
Collaborator

What is the bug?

Alias filter changes aren't getting replicated to follower cluster.

On inspecting code, the logic to replicate alias is missing code to replicate filter. This results in inconsistent alias on the follower end whenever an alias filter is updated.

                    for (alias in toAdd) {
                        log.info("Adding alias ${alias.alias} from $followerIndexName")
                        // Copying writeIndex from leader doesn't cause any issue as writes will be blocked anyways
                        request.addAliasAction(AliasActions.add().index(followerIndexName)
                                .alias(alias.alias)
                                .indexRouting(alias.indexRouting)
                                // Missing filter
                                .searchRouting(alias.searchRouting)
                                .writeIndex(alias.writeIndex())
                                .isHidden(alias.isHidden)
                        )
                    }

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Created a simple index with term filter on leader
curl -XPOST "$LEADER/_aliases" \
-H 'Content-Type: application/json' \
-d '{
  "actions": [
    {
      "add": {
        "index": "test_index",
        "alias": "test_alias",
        "filter": {
          "term": {
            "value": "8"
          }
        }
      }
    }
  ]
}'
  1. Start replication.
curl -XPUT "${FOLLOWER}/_plugins/_replication/test_index/_start?pretty" -H 'Content-Type: application/json' -d '{"leader_alias":"my-leader-1", "leader_index": "test_index", "use_roles": { "leader_cluster_role": "all_access", "follower_cluster_role": "all_access" } }'
  1. Check alias on follower
curl -XGET "$FOLLOWER/_alias/test_alias?pretty"

{
    "test_index": {
        "aliases": {
            "test_alias": {
                "filter": {
                    "term": {
                        "value": "8"
                    }
                }
            }
        }
    }
}
  1. Now change the alias filter term query
curl -XPOST "$LEADER/_aliases" \
-H 'Content-Type: application/json' \
-d '{
  "actions": [
    {
      "add": {
        "index": "test_index",
        "alias": "test_alias",
        "filter": {
          "term": {
            "value": "6"
          }
        }
      }
    }
  ]
}'
  1. Check alias on follower
curl -XGET "$FOLLOWER/_alias/test_alias?pretty"

## Got 404 a few times and later got following

{
    "test_index": {
        "aliases": {
            "test_alias": {}
        }
    }
}

What is the expected behavior?
The term filter changes should propagate to follower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working must_fix v2.x v2.3.0 'Issues and PRs related to version v2.3.0'
Projects
None yet
Development

No branches or pull requests

4 participants