-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BlockBasedTableConfig is not loaded from Options file #5297
Comments
@sagar0 @adamretter Is this still an issue? |
@mrambacher I could take a look at this in the next few days if you want confirmation? |
@caronzh03 I think there are two issues here:
The C++ API does not allow you to directly retrieve the options for the TableFactory, it does allow you to print out the options that have been loaded though. I wrote out some C++ which is equivalent to your Java and that shows that the options are loaded from your options file: #include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "rocksdb/options.h"
#include "rocksdb/utilities/options_util.h"
#include "table/block_based/block_based_table_factory.h"
#include <cstring>
#include <iostream>
#include <string>
using namespace ROCKSDB_NAMESPACE;
using namespace std;
int main(int /*argv*/, char*[] /*argc[]*/) {
string options_file_name("/tmp/rocksdb_options_file.ini");
Env* env = Env::Default();
DBOptions* db_options = new DBOptions();
vector<ColumnFamilyDescriptor>* cf_descs = new vector<ColumnFamilyDescriptor>();
//LoadLatestOptions
Status s = LoadOptionsFromFile(options_file_name, env, db_options, cf_descs);
cout << "OK=" << s.ok() << endl;
// check if `TableFormatConfig` object is correctly populated in each `ColumnFamilyOption`
ColumnFamilyDescriptor default_cf = cf_descs->at(0);
shared_ptr<TableFactory> table_factory = default_cf.options.table_factory;
cout << "table_factory(is null)=" << (table_factory.get() == nullptr) << endl;
cout << "## table_factory: " << table_factory->Name() << endl;
if (strcmp(table_factory->Name(), TableFactory::kBlockBasedTableName()) == 0) {
auto* block_base_table_factory = reinterpret_cast<BlockBasedTableFactory*>(table_factory.get());
string printable_options = block_base_table_factory->GetPrintableOptions();
cout << "### printable_options" << endl;
cout << printable_options << endl;
} else {
cout << "## NOT IMPLEMENTED" << endl;
}
return 0;
} I think it would be best here to align the Java API to that of the C++ API, and I have opened a new issue for that - #9101 If the C++ API needs to offer more in future than it does currently, then I think it would be better to discuss that as a separate issue. |
@adamretter You can do (instead of reinterpret_cast). Additionally, you can get at the underlying options object (but are not allowed to modify it): I do agree that the C++ and Java APIs have strayed and should be unified. |
### Motivation Fix #3734 (comment) We have two rocksDB tables, one for the ledger index, and another for the entry log location. - ledger index RocksDB table: Use the default table option, and the checksum is `kCRC32c` - entry log location RocksDb table: Use configured table option, and the checksum is `kxxHash` When we upgrade the RocksDB version from 6.10.2 to 7.9.2, the new RocksDB version's default table checksum has changed from `kCRC32c` to `kXXH3`, and `kXXH3` only supported since RocksDB 6.27. The RocksDB version rollback to 6.10.2 will be failed due to RocksDB 6.10.2 doesn't support the `kXXH3` checksum type. ### Modifications In this PR, I make the RocksDB checksum type configurable. But there is one change that will change the ledger index RocksDB table's checksum type from the default `kCRC32c` to `kxxHash`. I have tested the compatibility of the two checksum types in and between multiple RocksDB versions, it works fine. After setting the two RocksDB table's checksum type to `kxxHash`, the RocksDB's version upgraded from 6.10.2 to 7.9.2, and rolling back to 6.10.2 works fine. ### More to discuss When writing the unit test to read the table checksum type from RocksDB configuration files, it failed. I found the related issue on RocksDB: facebook/rocksdb#5297 The related PR: facebook/rocksdb#10826 It means we still can't load RocksDB table options from configuration files. Maybe I missed some parts about reading RocksDB table options from the configuration file. If this issue exists, we do **NOT** recommend users configure RocksDB configurations through configuration files. @merlimat @eolivelli @dlg99 Please help take a look, thanks.
### Motivation Fix apache#3734 (comment) We have two rocksDB tables, one for the ledger index, and another for the entry log location. - ledger index RocksDB table: Use the default table option, and the checksum is `kCRC32c` - entry log location RocksDb table: Use configured table option, and the checksum is `kxxHash` When we upgrade the RocksDB version from 6.10.2 to 7.9.2, the new RocksDB version's default table checksum has changed from `kCRC32c` to `kXXH3`, and `kXXH3` only supported since RocksDB 6.27. The RocksDB version rollback to 6.10.2 will be failed due to RocksDB 6.10.2 doesn't support the `kXXH3` checksum type. ### Modifications In this PR, I make the RocksDB checksum type configurable. But there is one change that will change the ledger index RocksDB table's checksum type from the default `kCRC32c` to `kxxHash`. I have tested the compatibility of the two checksum types in and between multiple RocksDB versions, it works fine. After setting the two RocksDB table's checksum type to `kxxHash`, the RocksDB's version upgraded from 6.10.2 to 7.9.2, and rolling back to 6.10.2 works fine. ### More to discuss When writing the unit test to read the table checksum type from RocksDB configuration files, it failed. I found the related issue on RocksDB: facebook/rocksdb#5297 The related PR: facebook/rocksdb#10826 It means we still can't load RocksDB table options from configuration files. Maybe I missed some parts about reading RocksDB table options from the configuration file. If this issue exists, we do **NOT** recommend users configure RocksDB configurations through configuration files. @merlimat @eolivelli @dlg99 Please help take a look, thanks. (cherry picked from commit 3844bf1)
### Motivation Fix apache#3734 (comment) We have two rocksDB tables, one for the ledger index, and another for the entry log location. - ledger index RocksDB table: Use the default table option, and the checksum is `kCRC32c` - entry log location RocksDb table: Use configured table option, and the checksum is `kxxHash` When we upgrade the RocksDB version from 6.10.2 to 7.9.2, the new RocksDB version's default table checksum has changed from `kCRC32c` to `kXXH3`, and `kXXH3` only supported since RocksDB 6.27. The RocksDB version rollback to 6.10.2 will be failed due to RocksDB 6.10.2 doesn't support the `kXXH3` checksum type. ### Modifications In this PR, I make the RocksDB checksum type configurable. But there is one change that will change the ledger index RocksDB table's checksum type from the default `kCRC32c` to `kxxHash`. I have tested the compatibility of the two checksum types in and between multiple RocksDB versions, it works fine. After setting the two RocksDB table's checksum type to `kxxHash`, the RocksDB's version upgraded from 6.10.2 to 7.9.2, and rolling back to 6.10.2 works fine. ### More to discuss When writing the unit test to read the table checksum type from RocksDB configuration files, it failed. I found the related issue on RocksDB: facebook/rocksdb#5297 The related PR: facebook/rocksdb#10826 It means we still can't load RocksDB table options from configuration files. Maybe I missed some parts about reading RocksDB table options from the configuration file. If this issue exists, we do **NOT** recommend users configure RocksDB configurations through configuration files. @merlimat @eolivelli @dlg99 Please help take a look, thanks. (cherry picked from commit 3844bf1)
### Motivation Fix apache#3734 (comment) We have two rocksDB tables, one for the ledger index, and another for the entry log location. - ledger index RocksDB table: Use the default table option, and the checksum is `kCRC32c` - entry log location RocksDb table: Use configured table option, and the checksum is `kxxHash` When we upgrade the RocksDB version from 6.10.2 to 7.9.2, the new RocksDB version's default table checksum has changed from `kCRC32c` to `kXXH3`, and `kXXH3` only supported since RocksDB 6.27. The RocksDB version rollback to 6.10.2 will be failed due to RocksDB 6.10.2 doesn't support the `kXXH3` checksum type. ### Modifications In this PR, I make the RocksDB checksum type configurable. But there is one change that will change the ledger index RocksDB table's checksum type from the default `kCRC32c` to `kxxHash`. I have tested the compatibility of the two checksum types in and between multiple RocksDB versions, it works fine. After setting the two RocksDB table's checksum type to `kxxHash`, the RocksDB's version upgraded from 6.10.2 to 7.9.2, and rolling back to 6.10.2 works fine. ### More to discuss When writing the unit test to read the table checksum type from RocksDB configuration files, it failed. I found the related issue on RocksDB: facebook/rocksdb#5297 The related PR: facebook/rocksdb#10826 It means we still can't load RocksDB table options from configuration files. Maybe I missed some parts about reading RocksDB table options from the configuration file. If this issue exists, we do **NOT** recommend users configure RocksDB configurations through configuration files. @merlimat @eolivelli @dlg99 Please help take a look, thanks.
Expected behavior
Given an options file auto-generated by a previously built rocksdb instance,
OptionsUtil.loadLatestOptions()
should load that options file and deserialize the[TableOptions/BlockBasedTable "default"]
section into aBlockBasedTableConfig
object.Actual behavior
OptionsUtil.loadLatestOptions()
does not parse the[TableOptions/BlockBasedTable "default"]
section of a given Options file. As a result, theTableFormatConfig
field in eachColumnFamilyOption
isnull
.Steps to reproduce the behavior
I'm using rocksdb's Java library.
Here's the auto-generated Options file: https://gist.github.com/caronzh03/317e2e703a0261f1710c50a79ba5d81e
According to wiki, the
BlockBasedTableOptions
should be deserialized, no?The text was updated successfully, but these errors were encountered: