Repository navigation
Description
Hello and thanks for RocksDB,
LoadLatestOptions (and CheckOptionsCompatibility) fails with "Missing configurable object: memtable_factory" on RDB created with ver <=6.24 after RDB ver 6.25
In particular the behaviour changes with commit beed864 for #8419
Command line reproducer:
Create a RDB with version 6.24.2 code:
> ~/rocksdb_builds/rocksdb-6.24.2/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_24_2
OK
Check the version in the options file:
> grep rocksdb_version /tmp/test_rocksdb_6_24_2/OPTIONS-000007
rocksdb_version=6.24.2
Try and read the RDB using ldb from version 6.26.0 and command line option --try_load_options it will fail.
> ~/rocksdb_builds/rocksdb-6.26.0/ldb scan --db=/tmp/test_rocksdb_6_24_2/ --try_load_options
Failed: Invalid argument: Missing configurable object: memtable_factory
Main prog reproducer
#include <iostream>
#include <fstream>
#include <rocksdb/utilities/options_util.h>
int main(int argc, char **argv){
// created using v6.24.2 using: ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_24_2
std::string db_name("/tmp/test_rocksdb_6_24_2");
rocksdb::DBOptions loaded_db_opt;
std::vector<rocksdb::ColumnFamilyDescriptor> loaded_cf_descs;
rocksdb::Status status = LoadLatestOptions(db_name,
rocksdb::Env::Default(), &loaded_db_opt,
&loaded_cf_descs);
if (status.IsNotFound()) {
std::cout << "Not found OK " << db_name << std::endl;
return(0);
}
if (!status.ok()) {
std::string msg("Failed to LoadLatestOptions from: " + db_name + ": " + status.ToString());
throw std::runtime_error(msg);
} else {
std::cout << "OK LoadLatestOptions " << db_name << std::endl;
return(0);
}
}
When built and run against e40b04e (and before) it returns:
OK LoadLatestOptions /tmp/test_rocksdb_6_24_2
when built and run against beed864 (and after) it returns:
terminate called after throwing an instance of 'std::runtime_error'
what(): Failed to LoadLatestOptions from: /tmp/test_rocksdb_6_24_2: Invalid argument: Missing configurable object: memtable_factory
This was noticed during a RocksDB upgrade when an integration test that uses a RDB from a previous old RDB version started to fail when running CheckOptionsCompatibility.
Thanks
In addition, after running the below:
> ~/rocksdb_builds/rocksdb-6.17.3/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_17_3
OK
> ~/rocksdb_builds/rocksdb-6.20.3/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_20_3
OK
> ~/rocksdb_builds/rocksdb-6.24.2/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_24_2
OK
> ~/rocksdb_builds/rocksdb-6.25.1/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_25_1
OK
> ~/rocksdb_builds/rocksdb-6.25.3/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_25_3
OK
> ~/rocksdb_builds/rocksdb-6.26.0/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_26_0
OK
> ~/rocksdb_builds/rocksdb-6.26.1/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_26_1
OK
> ~/rocksdb_builds/rocksdb-main/ldb put key value --create_if_missing --db=/tmp/test_rocksdb_6_27_0
OK
I noticed:
> ls -1 /tmp/test_rocksdb_6*/OP*
/tmp/test_rocksdb_6_17_3/OPTIONS-000006
/tmp/test_rocksdb_6_20_3/OPTIONS-000007
/tmp/test_rocksdb_6_24_2/OPTIONS-000007
/tmp/test_rocksdb_6_25_1/OPTIONS-000006.dbtmp
/tmp/test_rocksdb_6_25_3/OPTIONS-000006.dbtmp
/tmp/test_rocksdb_6_26_0/OPTIONS-000006.dbtmp
/tmp/test_rocksdb_6_26_1/OPTIONS-000006.dbtmp
/tmp/test_rocksdb_6_27_0/OPTIONS-000006.dbtmp
> grep 'Unnable to persist options' /tmp/test_rocksdb_6*/LOG
/tmp/test_rocksdb_6_25_1/LOG:2021/11/29-09:56:09.019822 7f51e44a8b00 [WARN] [/db_impl/db_impl.cc:4214] Unnable to persist options -- Invalid argument: Missing configurable object: memtable_factory
/tmp/test_rocksdb_6_25_3/LOG:2021/11/29-09:56:16.697449 7f714ff8eb00 [WARN] [/db_impl/db_impl.cc:4214] Unnable to persist options -- Invalid argument: Missing configurable object: memtable_factory
/tmp/test_rocksdb_6_26_0/LOG:2021/11/29-09:56:27.635650 7fc10ca1b340 [WARN] [/db_impl/db_impl.cc:4215] Unnable to persist options -- Invalid argument: Missing configurable object: memtable_factory
/tmp/test_rocksdb_6_26_1/LOG:2021/11/29-09:56:35.806378 7f7596a97b40 [WARN] [/db_impl/db_impl.cc:4215] Unnable to persist options -- Invalid argument: Missing configurable object: memtable_factory
/tmp/test_rocksdb_6_27_0/LOG:2021/11/29-09:57:04.379791 140249826884416 [WARN] [/db_impl/db_impl.cc:4216] Unnable to persist options -- Invalid argument: Missing configurable object: memtable_factory
Activity
akankshamahajan15 commentedon Nov 29, 2021
@mrambacher Hi Mark, Do you more context about this.
ltamasi commentedon Dec 1, 2021
@mrambacher Could you take a look at this?
ltamasi commentedon Dec 1, 2021
@thatsafunnyname For the record, I could not reproduce this using the standard skiplist memtable factory.
Do you use a custom memtable factory by any chance? If so, you might want to update your implementation to fit the
Customizableframework and register it with theObjectRegistry(see how it's done for the built-in factories in #8419).mrambacher commentedon Dec 1, 2021
@thatsafunnyname I cannot reproduce this problem with an options file generated from 6.24.2. I have tried to reproduce this using 6.26, 6.27, and main without luck. Can you send me the OPTIONS file that fails? What is different than one that works? What is different between the failed (dbtmp) Options files and the ones that succeeded?
How are you building RocksDB? Are you using LITE mode or any other switches?
thatsafunnyname commentedon Dec 1, 2021
Steps to reproduce, this is on a "Red Hat Enterprise Linux Server release 7.9 (Maipo)" host, 3.10.0-1160.31.1.el7.x86_64, sorry I did not test on another OS/distro or specify the OS/distro previously.
I tested without
USE_RTTI=1and it behaves the same way.Below is on a CentOS Linux release 8.4.2105 host, 4.18.0-305.19.1.el8_4.x86_64, it does not reproduce:
thatsafunnyname commentedon Dec 1, 2021
When I use
DEBUG_LEVEL=2on the RHEL7 host an assert fails (it does not fail on the CentOS 8 host):pdillinger commentedon Dec 2, 2021
I'm guessing that you would see numerous failures if running RocksDB unit tests (make -j12 check).
This API unfortunately depends on std::regex which we know is a bad state to be in https://github.com/facebook/rocksdb/blob/main/include/rocksdb/utilities/regex.h#L23
And it looks like old GCC have incomplete / buggy std::regex. https://stackoverflow.com/a/12665408/454544
mrambacher commentedon Dec 2, 2021
My guess is that the Regex::Parse in include/rocksb/utilities/object_registry.h is failing. Can you print out the status if it (is not OK) for an LDB run and send me the ones that fail? It might be possible to restructure some of the code to avoid this issue if I knew which regex were causing the problem...
pdillinger commentedon Dec 2, 2021
#8419 introduced the
(:[0-9]*)?part of regex matchingthatsafunnyname commentedon Dec 2, 2021
RocksDB unit tests do show numerous failures when on the RHEL7 host with g++ 4.8.5:
It looks like the
build-linux-gcc-4_8-no_test_runCI test job in.circleci/config.ymlis not running tests, and themake-gcc4.8in.travis.ymlis also not.With the following change in
rocksdb-6.26.1/include/rocksdb/utilities/object_registry.h:With
DEBUG_LEVEL=2on the RHEL7 host with g++ 4.8.5With
DEBUG_LEVEL=0on the RHEL7 host with g++ 4.8.5With g++ version 5.3.1 on the same RHEL7 host
[-]LoadLatestOptions fails with "Missing configurable object: memtable_factory" on RDB created with <=6.24 after RDB ver 6.25[/-][+]LoadLatestOptions fails with "Missing configurable object: memtable_factory" on RDB created with <=6.24 after RDB ver 6.25 with g++ 4.8.5[/+]pdillinger commentedon Jan 4, 2022
If we revert #9264 for now, @ajkr suggested a possible fix along the lines of replacing optional matching parts by ".*", to effectively get prefix matching. This wouldn't work well if someone registers "foo.*" and someone else "foobar.*" (though it would if instead of using regexes, "foo" and "foobar" are registered prefixes and we always select the longest match).
Perhaps the "more than a prefix name" level of detail is intended to protect from cases like fixed in #9343 . @mrambacher thoughts?
ajkr commentedon Jan 9, 2022
I think #9264 doesn't protect against the case of #9343. That's because the non-test use cases of
AddNumber()setoptional == truebeforehand, so the separator/number can still be omitted just the same.It helps prevent matching invalid strings like "rocksdb.CappedPrefix.a", though OTOH I am not sure the reason to expand our support for parameters in the ID string. Isn't this the old way of configuration?
mrambacher commentedon Jan 10, 2022
In #9358, I changed it so that "rocksdb.CappedPrefix" is not valid and will not match.
Remove/Reduce use of Regex in ObjectRegistry/Library (#9264)
Remove/Reduce use of Regex in ObjectRegistry/Library (meta#9264)