Skip to content

Handle deletion of swapped out node in a background periodic task#786

Merged
mattisonchao merged 6 commits intooxia-db:mainfrom
merlimat:delete-shard-in-background
Oct 25, 2025
Merged

Handle deletion of swapped out node in a background periodic task#786
mattisonchao merged 6 commits intooxia-db:mainfrom
merlimat:delete-shard-in-background

Conversation

@merlimat
Copy link
Copy Markdown
Collaborator

@merlimat merlimat commented Oct 24, 2025

#845

After a SwapNode() initiated leader election, let's not wait until the removed node has deleted the shard since this is delaying the leader election time.

Instead, move the logic out to a periodic task with retries.

Note: the node is immediately moved to a different category in the status and marked in the PendingDeleteShardNodes list. This is because it will not participate anymore in the newTermQuorum.

Signed-off-by: Matteo Merli <mmerli@apache.org>
Signed-off-by: Matteo Merli <mmerli@apache.org>

chanBufferSize = 100

DefaultPeriodicTasksInterval = 1 * time.Minute
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think delaying the shard deletion by 1 min is ok and should never be a problem. If any backoff, I'd do a backoff from 1 min -> 1h -> 1day for this kind of operations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NO, we shouldn't do a 1-day backoff. The shard deletion will be delayed for a very long time. :)

Signed-off-by: Matteo Merli <mmerli@apache.org>
Signed-off-by: Matteo Merli <mmerli@apache.org>
Signed-off-by: Matteo Merli <mmerli@apache.org>
@merlimat merlimat force-pushed the delete-shard-in-background branch from 779fb53 to aeb509a Compare October 24, 2025 22:42
@mattisonchao mattisonchao merged commit 35976dc into oxia-db:main Oct 25, 2025
5 checks passed
@merlimat merlimat deleted the delete-shard-in-background branch October 25, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants