diff options
author | Martin Kobetic <mkobetic@gmail.com> | 2014-04-17 22:01:16 +0000 |
---|---|---|
committer | Martin Kobetic <mkobetic@gmail.com> | 2014-04-17 22:01:16 +0000 |
commit | 9a3d0db1b2f46e79f391c1cd839c7fce6bfb8918 (patch) | |
tree | b1c15a26a3537de0a00f700005b68251947ef4c7 /c/cursor.go | |
parent | hide the cursor stack details behind function calls (pop/push/current) (diff) | |
download | dedo-9a3d0db1b2f46e79f391c1cd839c7fce6bfb8918.tar.gz dedo-9a3d0db1b2f46e79f391c1cd839c7fce6bfb8918.tar.xz |
trying to fix large seek
Diffstat (limited to 'c/cursor.go')
-rw-r--r-- | c/cursor.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/c/cursor.go b/c/cursor.go index e3495b3..189d385 100644 --- a/c/cursor.go +++ b/c/cursor.go @@ -163,7 +163,8 @@ void bolt_cursor_seek(bolt_cursor *c, bolt_val seek, bolt_val *key, bolt_val *va return; }; - // Set the key/value for the current position. + // Find first leaf and return key/value. + cursor_first_leaf(c); cursor_key_value(c, key, value, flags); } @@ -243,6 +244,7 @@ void cursor_search(bolt_cursor *c, bolt_val key, pgid id) { // Push page onto the cursor stack. elem_ref *ref = cursor_push(c, id); + printf("search page id=%d depth=%d\n", (int)id, c->top); // If we're on a leaf page/node then find the specific node. if (ref->page->flags & PAGE_LEAF) { cursor_search_leaf(c, key); @@ -290,7 +292,9 @@ void cursor_search_branch(bolt_cursor *c, bolt_val key) { if (key.size == 0 || (rc == 0 && key.size >= elem->ksize) || rc < 0) { ref->index = i; cursor_search(c, key, elem->pgid); - return; + if (cursor_current(c) == ref) ref->index++; + if (ref->index < ref->page->count) return; + break; } } |