Add timeout for inker snapshots

So that they can also be released if they silently crash without closing neatly.
This commit is contained in:
Martin Sumner 2018-12-14 13:53:36 +00:00
parent 8bf36214e1
commit 2741c46daa
4 changed files with 47 additions and 14 deletions

View file

@ -117,8 +117,8 @@
-define(MAX_KEYCHECK_FREQUENCY, 100).
-define(MIN_KEYCHECK_FREQUENCY, 1).
-define(OPEN_LASTMOD_RANGE, {0, infinity}).
-define(PCL_SNAPTIMEOUT_SHORT, 900). % 15 minutes
-define(PCL_SNAPTIMEOUT_LONG, 43200). % 12 hours
-define(SNAPTIMEOUT_SHORT, 900). % 15 minutes
-define(SNAPTIMEOUT_LONG, 43200). % 12 hours
-define(OPTION_DEFAULTS,
[{root_path, undefined},
{snapshot_bookie, undefined},
@ -137,8 +137,8 @@
{log_level, ?LOG_LEVEL},
{forced_logs, []},
{override_functions, []},
{pcl_snapshottimeout_short, ?PCL_SNAPTIMEOUT_SHORT},
{pcl_snapshottimeout_long, ?PCL_SNAPTIMEOUT_LONG}]).
{snapshot_timeout_short, ?SNAPTIMEOUT_SHORT},
{snapshot_timeout_long, ?SNAPTIMEOUT_LONG}]).
-record(ledger_cache, {mem :: ets:tab(),
loader = leveled_tree:empty(?CACHE_TYPE)
@ -334,12 +334,12 @@
{override_functions, list(leveled_head:appdefinable_function_tuple())} |
% Provide a list of override functions that will be used for
% user-defined tags
{pcl_snapshottimeout_short, pos_integer()} |
{snapshot_timeout_short, pos_integer()} |
% Time in seconds before a snapshot that has not been shutdown is
% assumed to have failed, and so requires to be torndown. The
% short timeout is applied to queries where long_running is set to
% false
{pcl_snapshottimeout_long, pos_integer()}
{snapshot_timeout_long, pos_integer()}
% Time in seconds before a snapshot that has not been shutdown is
% assumed to have failed, and so requires to be torndown. The
% short timeout is applied to queries where long_running is set to
@ -1577,8 +1577,8 @@ set_options(Opts) ->
SyncStrat = proplists:get_value(sync_strategy, Opts),
WRP = proplists:get_value(waste_retention_period, Opts),
SnapTimeoutShort = proplists:get_value(pcl_snapshottimeout_short, Opts),
SnapTimeoutLong = proplists:get_value(pcl_snapshottimeout_long, Opts),
SnapTimeoutShort = proplists:get_value(snapshot_timeout_short, Opts),
SnapTimeoutLong = proplists:get_value(snapshot_timeout_long, Opts),
AltStrategy = proplists:get_value(reload_strategy, Opts),
ReloadStrategy = leveled_codec:inker_reload_strategy(AltStrategy),
@ -1619,6 +1619,7 @@ set_options(Opts) ->
singlefile_compactionperc = SFL_CompPerc,
maxrunlength_compactionperc = MRL_CompPerc,
waste_retention_period = WRP,
snaptimeout_long = SnapTimeoutLong,
compression_method = CompressionMethod,
compress_on_receipt = CompressOnReceipt,
cdb_options =