JanWielemaker/rocksdb

Incompatible word-length error

Closed this issue · 4 comments

After the first merge, RocksDB gives the following error upon enumeration:

PL_recorded_external(): Incompatible word-length (64)

Here is a reproducible case (reproducible on the LOD machine):

:- use_module(library(filesex)).
:- use_module(library(ordsets)).
:- use_module(library(rocksdb)).

test :-
  absolute_file_name(tmp, Dir, [access(write),file_type(directory)]),
  delete_directory_contents(Dir),
  setup_call_cleanup(
    rocks_open(Dir, Db, [key(atom),merge(merge0),value(term)]),
    (
      rocks_merge(Db, x, [x]),
      forall(
	rocks_enum(Db, A, B),
	writeln(A-B)
      )
    ),
    rocks_close(Db)
  ).

merge0(partial, _, A, B, C) :- ord_union(A, B, C).

You have no merge rule for full. If we add (as the example states):

merge0(full, Key, Initial, Additions, Result) :-
  append([Initial|Additions], List),
  sort(List, Result).

All seems to work fine. Unfortunately (AFAIK), the merger cannot forward errors to RocksDB.

@JanWielemaker Is it always required to define both? IIUC rocks_merge(Db, x, [x]) should only use the partial variant?

Thanks! That clears things up for me. I'll update the docs to reflect RocksDB's requirement.