curiosity-ai / rocksdb-sharp

.net bindings for the rocksdb by facebook
BSD 2-Clause "Simplified" License
155 stars 38 forks source link

Calling the merge function (the overload that takes string parameters) doesn't result in MergeOperator implementation being invoked #19

Open kalyanaj opened 2 years ago

kalyanaj commented 2 years ago

I was trying out this library for a merge scenario. I used the RocksDB.Merge(string, string value...) overload. I also specified a custom MergeOperator and set some breakpoints in the partial/full merge functions. However, I wasn't seeing those breakpoints getting hit even though I had called RocksDB.Merge with same keys and had triggered a compaction etc. Upon reading the code at https://github.com/curiosity-ai/rocksdb-sharp/blob/0b78c86b9b6ea41c37d9768acc665d789b2a139b/csharp/src/RocksDb.cs#L333, I see that it calls Native.Instance.rocksdb_put() and I don't see any difference between this and the RocksDB.Put(string key, string value, ...) call. Wanted to check if this is a typo in this Merge implementation or if I am missing anything else (I haven't had the chance yet to investigate/go deeper into understanding this repo).

    public void Merge(string key, string value, ColumnFamilyHandle cf = null, WriteOptions writeOptions = null, Encoding encoding = null)
    {
        Native.Instance.rocksdb_put(Handle, (writeOptions ?? DefaultWriteOptions).Handle, key, value, cf, encoding ?? DefaultEncoding);
    }