martinsumner/leveled

Snapshot and root_path

Closed this issue · 0 comments

When reading the documentation https://github.com/martinsumner/leveled/blob/master/docs/STARTUP_OPTIONS.md there is no reference to the option {snapshot_bookie, Pid | undefined}. This option is documented in the source code of leveled_bookie, though.

snapshot_bookie, undefined|pid()} |
            % Is the bookie being started required to a be a snapshot of an
            % existing bookie, rather than a new bookie.  The bookie to be
            % snapped should have its pid passed as the startup option in this
            % case

If this option is used in startup together with a root_path it crashes with

{case_clause,{<0.285.0>,"./leveled_data"}},
                    [{leveled_bookie,init,1,
                                     [{file,"/Users/thomas/Quviq/.../leveled/_build/eqc/lib/leveled/src/leveled_bookie.erl"},
                                      {line,1106}]},

It is assumed in the code that a snapshot does not have its root_path set.
This seems the right choice, because the Pid one is taking the snapshot of knows where it has its data, saying anything else seems wrong.

But then the comment

% information. May be undefined is snapshot_bookie is a pid()

should be adjusted to state: "should be undefined if ..."