Don't link snapshots

If a snapshot breaks a penciller clone, this shouldn't crash the main process.
This commit is contained in:
Martin Sumner 2018-07-10 10:25:20 +01:00
parent 082eabb65b
commit c4e376ece5
3 changed files with 16 additions and 2 deletions

View file

@ -916,12 +916,12 @@ snapshot_store(LedgerCache, Penciller, Inker, SnapType, Query, LongRunning) ->
snapshot_query = Query,
snapshot_longrunning = LongRunning,
bookies_mem = BookiesMem},
{ok, LedgerSnapshot} = leveled_penciller:pcl_start(PCLopts),
{ok, LedgerSnapshot} = leveled_penciller:pcl_snapstart(PCLopts),
case SnapType of
store ->
InkerOpts = #inker_options{start_snapshot=true,
source_inker=Inker},
{ok, JournalSnapshot} = leveled_inker:ink_start(InkerOpts),
{ok, JournalSnapshot} = leveled_inker:ink_snapstart(InkerOpts),
{ok, LedgerSnapshot, JournalSnapshot};
ledger ->
{ok, LedgerSnapshot, null}

View file

@ -94,6 +94,7 @@
terminate/2,
code_change/3,
ink_start/1,
ink_snapstart/1,
ink_put/4,
ink_mput/3,
ink_get/3,
@ -171,6 +172,12 @@
ink_start(InkerOpts) ->
gen_server:start_link(?MODULE, [InkerOpts], []).
-spec ink_snapstart(inker_options()) -> {ok, pid()}.
%% @doc
%% Don't link on startup as snapshot
ink_snapstart(InkerOpts) ->
gen_server:start(?MODULE, [InkerOpts], []).
-spec ink_put(pid(),
leveled_codec:ledger_key(),
any(),

View file

@ -170,6 +170,7 @@
code_change/3]).
-export([
pcl_snapstart/1,
pcl_start/1,
pcl_pushmem/2,
pcl_fetchlevelzero/2,
@ -310,6 +311,12 @@
pcl_start(PCLopts) ->
gen_server:start_link(?MODULE, [PCLopts], []).
-spec pcl_snapstart(penciller_options()) -> {ok, pid()}.
%% @doc
%% Don't link to the bookie - this is a snpashot
pcl_snapstart(PCLopts) ->
gen_server:start(?MODULE, [PCLopts], []).
-spec pcl_pushmem(pid(), bookies_memory()) -> ok|returned.
%% @doc
%% Load the contents of the Bookie's memory of recent additions to the Ledger