Skip to content

Add breadth-first AAE exchange#628

Closed
jtuple wants to merge 1 commit into
developfrom
feature/aae-exchange-bfs
Closed

Add breadth-first AAE exchange#628
jtuple wants to merge 1 commit into
developfrom
feature/aae-exchange-bfs

Conversation

@jtuple
Copy link
Copy Markdown
Contributor

@jtuple jtuple commented Sep 18, 2014

This commit ports the breath-first exchange algorithm from the synctree code in riak_ensemble to the hashtree code here in riak_core. This level-by-level exchange is necessary to support streaming and/or pipelined AAE exchange -- an approach that underpins the new AAE-based fullsync replication protocol in Riak Enterprise.

Sibling pull-requests: basho/riak_kv#1023, basho/riak_repl#616

This commit ports the breath-first exchange algorithm from the
synctree code in riak_ensemble to the hashtree code here in riak_core.
This level-by-level exchange is necessary to support streaming and/or
pipelined AAE exchange -- an approach that will soon underpin the new
AAE-based fullsync replication protocol in Riak.
Comment thread src/hashtree.erl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why have Diffs, why not do the same as exchange_final?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good observation. riak_ensemble_util:orddict_delta/2 returns [ {'$none', any()} | {any(), '$none'} | {any(), any()} ]. Thus, if the local cluster has some missing sub-buckets or segments as compared to the remote cluster; the result of this function (line below) would include some '$none's. How does the next level in the recursion handle that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just meant there was an unnecessary variable being set, it looks like the exchange_level/6 usage strips the difference on L842 and knows that it needs to recurse to the next level if there are any differences.

@jonmeredith
Copy link
Copy Markdown
Contributor

Ran coverage tests and confirmed compare2 was covered by EQC.

I did notice that there was a local orddict_delta as well as the version called from ensemble. Seems confusing to keep both around. Also seems weird that it's in ensemble rather than a utils library.

Not critical for merge, but if left as it is should add a comment saying what the plan for it is.

@jonmeredith
Copy link
Copy Markdown
Contributor

I suppose we have lost test coverage for compare/4 which is still called by yz_index_hastree, riak_core_metadata_exchange_fsm and riak_kv_2i_aae.

Comment thread src/hashtree.erl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What I mean is that maybe this line should read

 [BK || {BK, _} <- Diffs, BK =/= '$none']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BK is the key in the orddict, so I think it will be keyed as Bucket. Here's an example of orddict_delta showing how the key is separate from the '$none' so you can see BK will not be set to it.

(riak@127.0.0.1)87> riak_ensemble_util:orddict_delta(orddict:from_list([{a,1},{b,2},{c,3}]),orddict:from_list([{b,2},{c,5},{d,4}])).
[{a,{1,'$none'}},{c,{3,5}},{d,{'$none',4}}]

@jonmeredith
Copy link
Copy Markdown
Contributor

Code inspection looks good - only issues are minor. Will complete other PR reviews before giving final approval

@jonmeredith
Copy link
Copy Markdown
Contributor

+1 to merge - but this should be against 2.0 so not telling bors to do it.

Ran with this and sibling branches and got through riak_tests.

jtuple referenced this pull request Sep 22, 2014
This commit ports the breath-first exchange algorithm from the
synctree code in riak_ensemble to the hashtree code here in riak_core.
This level-by-level exchange is necessary to support streaming and/or
pipelined AAE exchange -- an approach that will soon underpin the new
AAE-based fullsync replication protocol in Riak.
@jonmeredith
Copy link
Copy Markdown
Contributor

@jtuple I think this should be closed against develop and just merge the 2.0 branch in. Can you confirm?

@martincox martincox closed this Jun 14, 2019
@martincox martincox deleted the feature/aae-exchange-bfs branch June 14, 2019 09:47
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.

4 participants