Skip to content

Commit

Permalink
Optimize RocksDb startup (neo-project#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored and 陈志同 committed Oct 13, 2020
1 parent 9a5c289 commit e522943
Showing 1 changed file with 10 additions and 2 deletions.
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)))
{
families.Add(new ColumnFamilies.Descriptor(family, new ColumnFamilyOptions()));
}
}
catch { }

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

ColumnFamilyHandle defaultFamily = db.GetDefaultColumnFamily();
Expand Down

0 comments on commit e522943

Please sign in to comment.