More work on timeout
This commit is contained in:
parent
86af99e511
commit
8f0a096dd2
2 changed files with 6 additions and 3 deletions
|
@ -265,7 +265,9 @@ mergefile_selector(Manifest, Level) ->
|
||||||
end_key = LastKey}.
|
end_key = LastKey}.
|
||||||
|
|
||||||
add_snapshot(Manifest, Pid, Timeout) ->
|
add_snapshot(Manifest, Pid, Timeout) ->
|
||||||
SnapEntry = {Pid, Manifest#manifest.manifest_sqn, Timeout},
|
{MegaNow, SecNow, _} = os:timestamp(),
|
||||||
|
TimeToTimeout = MegaNow * 1000000 + SecNow + Timeout,
|
||||||
|
SnapEntry = {Pid, Manifest#manifest.manifest_sqn, TimeToTimeout},
|
||||||
SnapList0 = [SnapEntry|Manifest#manifest.snapshots],
|
SnapList0 = [SnapEntry|Manifest#manifest.snapshots],
|
||||||
MinDelSQN = min(Manifest#manifest.delete_sqn, Manifest#manifest.manifest_sqn),
|
MinDelSQN = min(Manifest#manifest.delete_sqn, Manifest#manifest.manifest_sqn),
|
||||||
Manifest#manifest{snapshots = SnapList0, delete_sqn = MinDelSQN}.
|
Manifest#manifest{snapshots = SnapList0, delete_sqn = MinDelSQN}.
|
||||||
|
@ -292,9 +294,10 @@ ready_to_delete(Manifest, Filename) ->
|
||||||
{P, infinity} ->
|
{P, infinity} ->
|
||||||
{false, P};
|
{false, P};
|
||||||
{P, DeleteSQN} ->
|
{P, DeleteSQN} ->
|
||||||
|
{MegaNow, SecNow, _} = os:timestamp(),
|
||||||
{ready_to_delete(Manifest#manifest.snapshots,
|
{ready_to_delete(Manifest#manifest.snapshots,
|
||||||
DeleteSQN,
|
DeleteSQN,
|
||||||
os:timestamp()),
|
MegaNow * 1000000 + SecNow),
|
||||||
P}
|
P}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
-define(COIN_SIDECOUNT, 5).
|
-define(COIN_SIDECOUNT, 5).
|
||||||
-define(SLOW_FETCH, 20000).
|
-define(SLOW_FETCH, 20000).
|
||||||
-define(ITERATOR_SCANWIDTH, 4).
|
-define(ITERATOR_SCANWIDTH, 4).
|
||||||
-define(SNAPSHOT_TIMEOUT, 3600 * 1000).
|
-define(SNAPSHOT_TIMEOUT, 3600).
|
||||||
|
|
||||||
-record(state, {manifest, % a manifest record from the leveled_manifest module
|
-record(state, {manifest, % a manifest record from the leveled_manifest module
|
||||||
persisted_sqn = 0 :: integer(), % The highest SQN persisted
|
persisted_sqn = 0 :: integer(), % The highest SQN persisted
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue