The GitHub Actions job "CI" on kvrocks.git has failed.
Run started by GitHub user git-hulk (triggered by git-hulk).

Head commit for run:
bfa1d0ddf60cb372514211eb37f369690d2f2011 / git-hulk <hulk.webs...@gmail.com>
Implement an unify key-value iterator for Kvrocks

Currently, we need to iterate all keys in the database in different places like
the cluster migration and kvrocks2redis, but don't have an iterator for this 
purpose.
It's very error-prone to implement this in different places since Kvrocks may 
add
a new column family in the future, and we must be careful to iterate all keys 
in all column families.
This would be a burden for maintenance, So we want to implement an iterator for 
iterating keys.

```C++

DBIter iter(storage, read_option);
for (iter.Seek(); iter.Valid(); iter.Next()) {
    if (iter.Type() == kRedisString || iter.Type() == kRedisJSON) {
        // the string/json type didn't have subkeys
        continue;
    }

    auto subkey_iter = iter.GetSubKeyIterator();
    for (subkey_iter.Seek(); subkey_iter.Valid(); subkey_iter.Next()) {
        // handle its subkey and value here
    }
}

```

When using this iterator, it will iterate the metadata column family first and 
check its type,
if it's not a string or json, then it will iterate the corresponding column 
family to get subkeys.
That said, if we have a key foo with type hash, then the iterator will iterate 
foo and foo:field1, foo:field2, and so on.

This solution can bring those benefits:

- The codes look more intutive
- Can reuse this iterator if we want to iterate keys only

Report URL: https://github.com/apache/kvrocks/actions/runs/7488824959

With regards,
GitHub Actions via GitBox

Reply via email to