- 13 Apr, 2017 32 commits
-
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
* master: A+C: Add information about my contributions
-
Kirill Smelkov authored
splitX bugfix test + simplification In the process of going through b code I've noticed that splitX bug fix (commit 5c732b36) handling logic was not covered by tests for edge cases and that this edge-handling logic itself can be simplified. Please find patches which add corresponding test and do the simplification attached. The simplified logic will be handy for upcoming work. Please see details in individual commit messages. Thanks beforehand, Kirill
-
Kirill Smelkov authored
As requested by @cznic add information about me and my company to AUTHORS and CONTRIBUTORS. Btw, I'm not a lawyer and maybe there are country differences, but I used to think that: - author is the person who actually creates the work. - copyright holder is who owns the copyright on that work (i.e. the person, or company he is working for or someone else). The `AUTHORS` file however gets it the other way - it says to put there information about who is "copyright holder" which goes counterwise above classification. ---- I understand however that the exact A+C approach is taken from the Go project so let's also continue following it here.
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
- 12 Apr, 2017 4 commits
-
-
Kirill Smelkov authored
We are simplyfing commit 5c732b36 (Fix splitX bug.) here: By always passing to splitX i of index entry that is actually going to be used for traversal(*) we don't need to consider edge cases, such as when to move to next slot, inside splitX itself and this way there is no need to keep relookup logic there. So inside splitX it becomes very simple: - i <= kx -> go left - i > kx -> go right The logic to advance i by 1 on exact key hits was already there in Set and Put so it is natural for them to pass correct slot index to splitX. (*) i.e. index of next slot on exact index entry key hit - see previous patch for explanation
-
Kirill Smelkov authored
Commit 5c732b36 (Fix splitX bug.) in particular modified splitX to redo the search on current level when key hits exactly kx slot in splitted X. However this is not tested at all as with current tests nothing breaks with the following patch: @@ -546,10 +546,11 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { i, ok := t.find(q, k) if ok { switch x := q.(type) { case *x: if x.c > 2*kx { + panic("splitX ; ok=T") x, i = t.splitX(p, x, pi, i) } pi = i + 1 p = x q = x.x[i+1].ch The relookup handling is needed exactly for ok=true case bacause if key is in xk slot there are 2 cases: 1) key < x.x[xk].k : here splitX is ok to let search follow left split child 2) key = x.x[xk].k : here splitX needs to let search follow right split child (*) and splitX, when knowing key comes from xk entry, does not bother itself with deciding which way to go (1 or 2) and for this case just follows up to make the search relookup current level after split. We can make existing tests cover this logic by raising N in TestSetGet2. However for kx=32, kd=32 N has to be increased more than 100x which, on my computer, increases the time to run TestSetGet2 from 0.5s to more than 200s, and still with it it only covers case when X does not have a parent. So instead of increasing N to be very large and slow down testing, let's add explicit test for this particular case. (*) reminder: `i, ok := find(q, k)` finds i corresponding to entry in q with min(k' : k <= k') (entry at i=q.c is always handled as with k'=∞) NOTE the "or-equal" in comparision. However keys in data (d) and index (x) page entries are treated differently. When find finds an entry with exact match (ok=true): - for d: d[i] is used https://github.com/cznic/b/blob/aaaa43c9/btree.go#L409 https://github.com/cznic/b/blob/aaaa43c9/btree.go#L558 - for x: x[i+1] is used: https://github.com/cznic/b/blob/aaaa43c9/btree.go#L406 https://github.com/cznic/b/blob/aaaa43c9/btree.go#L555 in other words keys located at index page entries says: all keys in child are strictly less than this key. This is probably so organized to help splitting - so split can pick lowest data entry from right data page and use its key as key in parent index entry for left data sibling directly.
-
Kirill Smelkov authored
example/int.go receives updates from aaaa43c9 (Fix Prev() to behave like Next() in reverse). We have to also update example/all_test.go because otherwise tests stop passing in example/ as the above commit changed both Prev and test logic. There are more missed updates to example/all_test.go - here I pick only minimum to keep tests passing in example/ .
-
Kirill Smelkov authored
-
- 11 Apr, 2017 4 commits
-
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-