0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-28 17:52:54 +01: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)
{
// This is inefficient as per RocksDB's prefix impl.
case pos::BACK:
{
// This is inefficient as per RocksDB's prefix impl. unknown why
// a seek to NEXT is still needed after walking back one.
char buf[512];
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));
if(seek(it, pos::PREV))
seek(it, pos::NEXT);
return bool(it);
assert(key);
return seek(it, key);
}
default: