This code example throw exception with RocksDbSharp.StringComparator but without it works correctly.
var options = new RocksDbSharp.DbOptions()
.SetCreateIfMissing(true)
.SetCreateMissingColumnFamilies(true);
var bbto = new RocksDbSharp.BlockBasedTableOptions()
.SetFilterPolicy(RocksDbSharp.BloomFilterPolicy.Create(20, false))
.SetWholeKeyFiltering(false)
.SetCacheIndexAndFilterBlocks(true);
var columnFamilies = new RocksDbSharp.ColumnFamilies
{
{ "cf1", new RocksDbSharp.ColumnFamilyOptions()
.SetCompression(RocksDbSharp.CompressionTypeEnum.rocksdb_no_compression)
.SetComparator( new RocksDbSharp.StringComparator(StringComparer.InvariantCultureIgnoreCase)) //if commented - works fine
.SetBlockBasedTableFactory(bbto)
},
};
using (var db = RocksDbSharp.RocksDb.Open(options, dbPath, columnFamilies))
{
Random rand = new Random(42);
var cf1 = db.GetColumnFamily("cf1");
for (int i = 0; i < 100000; ++i)
{
string k = rand.Next(100000000).ToString();
byte[] key = Encoding.UTF8.GetBytes(k);
byte[] value = db.Get(key, cf1);
if (value == null)
{
db.Put(key, BitConverter.GetBytes(i), cf1);
}
else
Console.WriteLine(BitConverter.ToInt32(value, 0));
}
}
This error is not always reproduced!!!
PS Windows x64
This code example throw exception with RocksDbSharp.StringComparator but without it works correctly.
This error is not always reproduced!!! PS Windows x64