Skip to content
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

Optimize RocksDb startup #333

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/RocksDBStore/Plugins/Storage/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ internal class Store : IStore
public Store(string path)
{
var families = new ColumnFamilies();
for (int x = 0; x <= byte.MaxValue; x++)
families.Add(new ColumnFamilies.Descriptor(x.ToString(), new ColumnFamilyOptions()));

try
{
foreach (var family in RocksDb.ListColumnFamilies(Options.Default, Path.GetFullPath(path)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to column families get added after this change? For a newly created RocksDb store, there will be no column families and it doesn't look like you've added a call to CreateColumnFamily anywhere (though I could have missed that)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are created when not found here.

catch (KeyNotFoundException)
{
// Try to create the family
family = db.CreateColumnFamily(new ColumnFamilyOptions(), table.ToString());
_families.Add(table, family);
}

{
families.Add(new ColumnFamilies.Descriptor(family, new ColumnFamilyOptions()));
}
}
catch { }

db = RocksDb.Open(Options.Default, Path.GetFullPath(path), families);

ColumnFamilyHandle defaultFamily = db.GetDefaultColumnFamily();
Expand Down