index icon indicating copy to clipboard operation
index copied to clipboard

Updated values are not seen in RO instances

Open edwintorok opened this issue 1 year ago • 1 comments

Using 'index.1.6.2' on OCaml 4.14.1:

$ cat >testme.ml <<EOF
#require "index.unix";;
module L = struct let length = 4 end;;
module I = Index_unix.Make(Index.Key.String_fixed(L))(Index.Value.String_fixed(L))(Index.Cache.Noop);;
let path = "testme.ocamlindex"
let t = I.v path ~log_size:16384;;
let ro = I.v path ~readonly:true ~log_size:16384;;
I.replace t "1234" "aaaa";
I.flush t; I.sync ro;;
I.find ro "1234" |> print_endline;;

I.replace t "1234" "aaab";
I.flush t; I.sync ro;;
I.find ro "1234" |> print_endline
EOF

$ utop testme.ml
aaaa
aaaa

Maybe I misunderstand how Index should be used, but it does notice that new keys are added, but then it doesn't notice that a key's value has been changed.

How can I get the updated value from t to ro, am I missing some setting/call, or is this a bug?

edwintorok avatar May 24 '24 13:05 edwintorok

It's a bug indeed, many thanks for the short repro!

art-w avatar May 24 '24 15:05 art-w