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

Avoid change feed rewinds on shard moves #3711

Merged
merged 1 commit into from Aug 26, 2021
Merged

Conversation

nickva
Copy link
Contributor

@nickva nickva commented Aug 24, 2021

When shards are moved to new nodes, and the user supplies a change sequence from the old shard map configuration, attempt to match missing nodes and ranges by inspecting current shard uuids in order to avoid rewinds.

Previously, if a node and range was missing, we randomly picked a node in the appropriate range, so 1/3 of the time we might have hit the exact node, but 2/3 of the time we would end up with a complete changes feed rewind to 0.

Unfortunately, this involves a fabric worker scatter gather operation to all shard copies. This should only happen when we get an old sequence. We rely on that happening rarely, mostly right after the shards moved, then users would get new sequence from the recent shard map.

@nickva nickva force-pushed the check-for-moved-shards branch 6 times, most recently from 6e42f23 to 21ca354 Compare August 25, 2021 23:28
@nickva nickva marked this pull request as ready for review August 25, 2021 23:29
@nickva nickva force-pushed the check-for-moved-shards branch 5 times, most recently from c617864 to b8e648d Compare August 26, 2021 16:22
Copy link
Contributor

@jaydoane jaydoane left a comment

Choose a reason for hiding this comment

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

LGTM, with just some minor formatting nits, typos, and a few questions about possible name improvements.

src/fabric/src/fabric_view_changes.erl Outdated Show resolved Hide resolved
src/fabric/src/fabric_db_uuids.erl Outdated Show resolved Hide resolved
src/fabric/test/eunit/fabric_moved_shards_seq_tests.erl Outdated Show resolved Hide resolved
src/fabric/test/eunit/fabric_moved_shards_seq_tests.erl Outdated Show resolved Hide resolved
% Since we are doing a best-effort approach to match moved shards,
% tollerate and log errors. This should also handle cases when the
% cluster is partially upgraded, as some nodes will not have the
% newer get_uuid fabric_rpc handler.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a very nice feature!

src/fabric/src/fabric_view_changes.erl Outdated Show resolved Hide resolved
src/fabric/src/fabric_view_changes.erl Outdated Show resolved Hide resolved
src/fabric/src/fabric_view_changes.erl Outdated Show resolved Hide resolved
src/fabric/src/fabric_view_changes.erl Outdated Show resolved Hide resolved
@nickva nickva force-pushed the check-for-moved-shards branch 4 times, most recently from aa179e2 to 7945755 Compare August 26, 2021 20:47
When shards are moved to new nodes, and the user supplies a change sequence
from the old shard map configuration, attempt to match missing nodes and ranges
by inspecting current shard uuids in order to avoid rewinds.

Previously, if a node and range was missing, we randomly picked a node in the
appropriate range, so 1/3 of the time we might have hit the exact node, but 2/3
of the time we would end up with a complete changes feed rewind to 0.

Unfortunately, this involves a fabric worker scatter gather operation to all
shard copies. This should only happen when we get an old sequence. We rely on
that happening rarely, mostly right after the shards moved, then users would
get new sequence from the recent shard map.
@nickva nickva merged commit e83935c into 3.x Aug 26, 2021
@nickva nickva deleted the check-for-moved-shards branch August 26, 2021 21:56
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.

None yet

2 participants