mudderjs icon indicating copy to clipboard operation
mudderjs copied to clipboard

Rebalancing keys?

Open fasiha opened this issue 5 years ago • 2 comments

Consider LexoRank in Jira that requires periodic rebalancing to respace the lexical space.

Can Mudder or a higher-level library help with that?

fasiha avatar May 11 '19 18:05 fasiha

(I misread the issue number in the above commits—I haven't made any commits addressing this issue.)

One issue with rebalancing keys in a key-value databaes is, the database will have to be locked to outside writes during rebalancing keys, to prevent an application writing a new key while existing keys are being shifted.

E.g., if you had keys '9' and '99', and a not-yet-extant rebalancing module advised you to move '99' to '91', and that move happened at the exact same time that an application inserted a new document with key '95' between these two existing keys, the documents will have incorrect ordering.

Having to lock the database during rebalancing, either wholly or parts of the keyspace (is this even possible?), makes rebalancing a very inelegant activity 😢.

fasiha avatar May 24 '19 01:05 fasiha

You probably already know that but will leave here just in case someone stumbles on this issue. https://youtu.be/OjQv9xMoFbg They do 3 buckets trick to overcome this it seems

dearlordylord avatar Dec 03 '22 04:12 dearlordylord