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

FIX Assign shard logic #4184

Closed
fulmicoton opened this issue Nov 22, 2023 · 0 comments
Closed

FIX Assign shard logic #4184

fulmicoton opened this issue Nov 22, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@fulmicoton
Copy link
Contributor

fulmicoton commented Nov 22, 2023

We need a way for the indexer node (this is done in the IndexingService) to apply the indexing plan that is assigned to us by the control plane.

For the new ingest v2 indexing pipelines, we added a concept of shards.

One pipeline is now source_uid + set of shards.

The MultiFetchStream offers the flexibility of making it possible to add new shards dynamically (without restarting the pipeline).

Shards that are removed, but have reached EOF can also be removed safely.
(ask Adrien: right now when a stream has reached EOF, do we need to do something in the multi fetch stream?).

A quick and dirty solution could be :

  • out of the existing pipelines, identify the one matching the given list of shards the best.
  • send the Indexing pipeline assign shards.
  • assign shard updates the state of the indexing pipeline params (this is not done today).
    The point is that we want the list of shards to be remember if the pipeline has to be respawned due to regular supervision, and also we need a state to expose through chitchat.
  • We update the running pipeline without restarting it:
    If there was only shard additions and EOF shard deletion
  • the source received a AddShards message and subscribes to the missing shards.
  • if the published position was EOF nothing needs to be done (need check from Adrien)

If there is a removal of a shard that has not reached EOF. As a temporary fix, we respawn the entire pipeline.
With the current scheduling logic, this should be rare, but it can happen when the load associated to shards has increased. That temporary fix could still yield to a publish error if the race condition gods are against us:

  • new shard owner acquires the publish locks and starts indexing before old shard owner 2 have received the memo, and old shard owner attempts to publish.

Ideally we would like to make it entirely impossible and have the control plane close/reopen shard when that happens, but keep the shard assigned to the same pipeline until it reaches EOF.


Existing bug today

  • fails if it happens in the middle of a pipeline respawn. (handle_opt is none)
  • in presence of a change in the list of shards, a pipeline respawn does not know the list of shards (unsure)
  • in presence of a change in the list of shards, the pipeline is not restarted. The problem is complicated, but I suspect we end up reindexing from the last commit for the shard we used to index, and would hit the publish lock in the likely presence of a conflict. (unsure)
@fulmicoton fulmicoton added the bug Something isn't working label Nov 22, 2023
@fulmicoton fulmicoton changed the title Assign shard logic FIX Assign shard logic Nov 22, 2023
@fulmicoton fulmicoton self-assigned this Nov 22, 2023
fulmicoton added a commit that referenced this issue Dec 1, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
fulmicoton added a commit that referenced this issue Dec 1, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
fulmicoton added a commit that referenced this issue Dec 1, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
fulmicoton added a commit that referenced this issue Dec 2, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
fulmicoton added a commit that referenced this issue Dec 2, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
fulmicoton added a commit that referenced this issue Dec 2, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 2, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 2, 2023
If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
Bugfix: IndexPipeline remembers list of shards and applies it after respawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
Bugfix: IndexPipeline remembers list of shards and applies it after respawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
Bugfix: IndexPipeline remembers list of shards and applies it after respawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
…espawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
…espawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 4, 2023
…espawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
fulmicoton added a commit that referenced this issue Dec 5, 2023
…espawn

Bugfix Assign shard logic.

If no shard is removed, we just kill the pipeline.
If shards are added we reinitiate the shards.
The pipeline supervisor keeps track of the shard, and reassigns them if
the pipeline is respawned.

Closes #4184
Closes #4174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant