0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-20 03:43:47 +02:00

ircd::db: Fix workaround for reverse prefix iteration.

This commit is contained in:
Jason Volk 2023-04-16 12:39:18 -07:00
parent 6e7d63ce6d
commit ef27ae50dc

View file

@ -2358,15 +2358,20 @@ ircd::db::seek(domain::const_iterator_base &it,
{ {
switch(p) switch(p)
{ {
// This is inefficient as per RocksDB's prefix impl.
case pos::BACK: case pos::BACK:
{ {
// This is inefficient as per RocksDB's prefix impl. unknown why char buf[512];
// a seek to NEXT is still needed after walking back one. string_view key;
assert(bool(it)); do
{
assert(size(it.it->key()) <= sizeof(buf));
key = string_view(buf, copy(buf, slice(it.it->key())));
}
while(seek(it, pos::NEXT)); while(seek(it, pos::NEXT));
if(seek(it, pos::PREV))
seek(it, pos::NEXT);
return bool(it); assert(key);
return seek(it, key);
} }
default: default: