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] Data loss during primary relocation for remote-backed indexes #6214

Closed
ashking94 opened this issue Feb 7, 2023 · 3 comments · Fixed by #6314
Closed

[BUG] Data loss during primary relocation for remote-backed indexes #6214

ashking94 opened this issue Feb 7, 2023 · 3 comments · Fixed by #6314
Assignees
Labels
bug Something isn't working Storage:Durability Issues and PRs related to the durability framework v2.6.0 'Issues and PRs related to version v2.6.0'

Comments

@ashking94
Copy link
Member

ashking94 commented Feb 7, 2023

Describe the bug
During primary-primary relocation, encountering data loss when indexing is happening at high TPS. This specifically is starting after initiateTracking happens for the new primary shard. A subset of docs are missing after relocation completes. Also noticing that after relocation handoff is completed, indexing landing on new primary shard uses seq no that has been assigned after initiateTracking happened.

To Reproduce
Step 1 - Register repo for segments and translogs.

In environment variables -

path.repo=/usr/share/opensearch/repo

Run below curl -

curl -X PUT "localhost:9200/_snapshot/rem?pretty" -H 'Content-Type: application/json' -d'
{
  "type": "fs",
  "settings": {
    "location": "/usr/share/opensearch/repo/rem"
  }
}'

curl -X PUT "localhost:9200/_snapshot/seg?pretty" -H 'Content-Type: application/json' -d'
{
  "type": "fs",
  "settings": {
    "location": "/usr/share/opensearch/repo/seg"
  }
}'

Step 2 - Create index

curl -X PUT "localhost:9200/test-index?pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0,
    "replication.type" : "SEGMENT",
    "index.remote_store.enabled": true,
    "index.remote_store.repository" : "seg",
    "index.remote_store.translog.enabled" : true,
    "index.remote_store.translog.repository" : "rem",
    "index.translog.durability" : "async",
    "refresh_interval": "1000s"
  }
}
'

Step 3 - Index docs and trigger relocation immediately just after starting index

Index -

for i in {1..1000}
do                
   curl --location --request POST "localhost:9202/test-index/_doc" \
    --header 'Content-Type: application/json' \
    --data-raw "{
      \"name\":\"abc${i}\"
    }"
    echo "$i\n"
done

Relocate -

curl -XPUT localhost:9201/test-index/_settings -H 'Content-Type: application/json' -d '    
{
  "index.routing.allocation.include._name": "opensearch-node1"
}'

Expected Behaviour
Docs count should be exactly how many docs were indexed

@ashking94 ashking94 added enhancement Enhancement or improvement to existing feature or request untriaged bug Something isn't working Storage:Durability Issues and PRs related to the durability framework v2.6.0 'Issues and PRs related to version v2.6.0' and removed untriaged enhancement Enhancement or improvement to existing feature or request labels Feb 7, 2023
@ashking94 ashking94 self-assigned this Feb 7, 2023
@dblock
Copy link
Member

dblock commented Feb 8, 2023

@ashking94 Can you please provide more details?

@ashking94 ashking94 changed the title [Remote Store] Data loss (inconsistency) during primary relocation [BUG] Data loss (inconsistency) during primary relocation for remote-backed indexes Feb 9, 2023
@ashking94 ashking94 changed the title [BUG] Data loss (inconsistency) during primary relocation for remote-backed indexes [BUG] Data loss during primary relocation for remote-backed indexes Feb 9, 2023
@ashking94
Copy link
Member Author

@ashking94 Can you please provide more details?

Added more details in the description itself. I will be coming with the fix soon.

@ashking94
Copy link
Member Author

Fix in #6314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Storage:Durability Issues and PRs related to the durability framework v2.6.0 'Issues and PRs related to version v2.6.0'
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants