Quality review
Minor test fix-up and quality changes
This commit is contained in:
parent
0e6ee486f8
commit
311179964a
5 changed files with 19 additions and 41 deletions
|
@ -403,15 +403,7 @@ handle_info(_Info, State) ->
|
||||||
terminate(Reason, State) ->
|
terminate(Reason, State) ->
|
||||||
io:format("Bookie closing for reason ~w~n", [Reason]),
|
io:format("Bookie closing for reason ~w~n", [Reason]),
|
||||||
WaitList = lists:duplicate(?SHUTDOWN_WAITS, ?SHUTDOWN_PAUSE),
|
WaitList = lists:duplicate(?SHUTDOWN_WAITS, ?SHUTDOWN_PAUSE),
|
||||||
ok = case shutdown_wait(WaitList, State#state.inker) of
|
ok = shutdown_wait(WaitList, State#state.inker),
|
||||||
false ->
|
|
||||||
io:format("Forcing close of inker following wait of "
|
|
||||||
++ "~w milliseconds~n",
|
|
||||||
[lists:sum(WaitList)]),
|
|
||||||
leveled_inker:ink_forceclose(State#state.inker);
|
|
||||||
true ->
|
|
||||||
ok
|
|
||||||
end,
|
|
||||||
ok = leveled_penciller:pcl_close(State#state.penciller).
|
ok = leveled_penciller:pcl_close(State#state.penciller).
|
||||||
|
|
||||||
code_change(_OldVsn, State, _Extra) ->
|
code_change(_OldVsn, State, _Extra) ->
|
||||||
|
@ -503,7 +495,7 @@ shutdown_wait([], _Inker) ->
|
||||||
shutdown_wait([TopPause|Rest], Inker) ->
|
shutdown_wait([TopPause|Rest], Inker) ->
|
||||||
case leveled_inker:ink_close(Inker) of
|
case leveled_inker:ink_close(Inker) of
|
||||||
ok ->
|
ok ->
|
||||||
true;
|
ok;
|
||||||
pause ->
|
pause ->
|
||||||
io:format("Inker shutdown stil waiting for process to complete" ++
|
io:format("Inker shutdown stil waiting for process to complete" ++
|
||||||
" with further wait of ~w~n", [lists:sum(Rest)]),
|
" with further wait of ~w~n", [lists:sum(Rest)]),
|
||||||
|
|
|
@ -164,7 +164,7 @@ handle_cast({compact, Checker, InitiateFun, FilterFun, Inker, _Timeout},
|
||||||
Candidates = scan_all_files(Manifest, FilterFun, FilterServer, MaxSQN),
|
Candidates = scan_all_files(Manifest, FilterFun, FilterServer, MaxSQN),
|
||||||
BestRun0 = assess_candidates(Candidates, MaxRunLength),
|
BestRun0 = assess_candidates(Candidates, MaxRunLength),
|
||||||
case score_run(BestRun0, MaxRunLength) of
|
case score_run(BestRun0, MaxRunLength) of
|
||||||
Score when Score > 0 ->
|
Score when Score > 0.0 ->
|
||||||
BestRun1 = sort_run(BestRun0),
|
BestRun1 = sort_run(BestRun0),
|
||||||
print_compaction_run(BestRun1, MaxRunLength),
|
print_compaction_run(BestRun1, MaxRunLength),
|
||||||
{ManifestSlice,
|
{ManifestSlice,
|
||||||
|
@ -372,8 +372,6 @@ sort_run(RunOfFiles) ->
|
||||||
lists:sort(CompareFun, RunOfFiles).
|
lists:sort(CompareFun, RunOfFiles).
|
||||||
|
|
||||||
|
|
||||||
compact_files([], _CDBopts, _FilterFun, _FilterServer, _MaxSQN, _RStrategy) ->
|
|
||||||
{[], 0};
|
|
||||||
compact_files(BestRun, CDBopts, FilterFun, FilterServer, MaxSQN, RStrategy) ->
|
compact_files(BestRun, CDBopts, FilterFun, FilterServer, MaxSQN, RStrategy) ->
|
||||||
BatchesOfPositions = get_all_positions(BestRun, []),
|
BatchesOfPositions = get_all_positions(BestRun, []),
|
||||||
compact_files(BatchesOfPositions,
|
compact_files(BatchesOfPositions,
|
||||||
|
|
|
@ -107,7 +107,6 @@
|
||||||
ink_updatemanifest/3,
|
ink_updatemanifest/3,
|
||||||
ink_print_manifest/1,
|
ink_print_manifest/1,
|
||||||
ink_close/1,
|
ink_close/1,
|
||||||
ink_forceclose/1,
|
|
||||||
build_dummy_journal/0,
|
build_dummy_journal/0,
|
||||||
simple_manifest_reader/2,
|
simple_manifest_reader/2,
|
||||||
clean_testdir/1,
|
clean_testdir/1,
|
||||||
|
@ -165,10 +164,7 @@ ink_confirmdelete(Pid, ManSQN) ->
|
||||||
gen_server:call(Pid, {confirm_delete, ManSQN}, 1000).
|
gen_server:call(Pid, {confirm_delete, ManSQN}, 1000).
|
||||||
|
|
||||||
ink_close(Pid) ->
|
ink_close(Pid) ->
|
||||||
gen_server:call(Pid, {close, false}, infinity).
|
gen_server:call(Pid, close, infinity).
|
||||||
|
|
||||||
ink_forceclose(Pid) ->
|
|
||||||
gen_server:call(Pid, {close, true}, infinity).
|
|
||||||
|
|
||||||
ink_loadpcl(Pid, MinSQN, FilterFun, Penciller) ->
|
ink_loadpcl(Pid, MinSQN, FilterFun, Penciller) ->
|
||||||
gen_server:call(Pid, {load_pcl, MinSQN, FilterFun, Penciller}, infinity).
|
gen_server:call(Pid, {load_pcl, MinSQN, FilterFun, Penciller}, infinity).
|
||||||
|
@ -324,11 +320,11 @@ handle_call(compaction_complete, _From, State) ->
|
||||||
{reply, ok, State#state{compaction_pending=false}};
|
{reply, ok, State#state{compaction_pending=false}};
|
||||||
handle_call(compaction_pending, _From, State) ->
|
handle_call(compaction_pending, _From, State) ->
|
||||||
{reply, State#state.compaction_pending, State};
|
{reply, State#state.compaction_pending, State};
|
||||||
handle_call({close, Force}, _From, State) ->
|
handle_call(close, _From, State) ->
|
||||||
case {State#state.compaction_pending, Force} of
|
case State#state.compaction_pending of
|
||||||
{true, false} ->
|
true ->
|
||||||
{reply, pause, State};
|
{reply, pause, State};
|
||||||
_ ->
|
false ->
|
||||||
{stop, normal, ok, State}
|
{stop, normal, ok, State}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -562,8 +558,6 @@ remove_from_manifest(Manifest, Entry) ->
|
||||||
io:format("File ~s to be removed from manifest~n", [FN]),
|
io:format("File ~s to be removed from manifest~n", [FN]),
|
||||||
lists:keydelete(SQN, 1, Manifest).
|
lists:keydelete(SQN, 1, Manifest).
|
||||||
|
|
||||||
find_in_manifest(_SQN, []) ->
|
|
||||||
error;
|
|
||||||
find_in_manifest(SQN, [{LowSQN, _FN, Pid}|_Tail]) when SQN >= LowSQN ->
|
find_in_manifest(SQN, [{LowSQN, _FN, Pid}|_Tail]) when SQN >= LowSQN ->
|
||||||
Pid;
|
Pid;
|
||||||
find_in_manifest(SQN, [_Head|Tail]) ->
|
find_in_manifest(SQN, [_Head|Tail]) ->
|
||||||
|
@ -720,18 +714,11 @@ simple_manifest_writer(Manifest, ManSQN, RootPath) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
manifest_printer(Manifest) ->
|
manifest_printer(Manifest) ->
|
||||||
lists:foreach(fun(X) ->
|
lists:foreach(fun({SQN, FN, _PID}) ->
|
||||||
{SQN, FN} = case X of
|
io:format("At SQN=~w journal has filename ~s~n",
|
||||||
{A, B, _PID} ->
|
|
||||||
{A, B};
|
|
||||||
{A, B} ->
|
|
||||||
{A, B}
|
|
||||||
end,
|
|
||||||
io:format("At SQN=~w journal has filename ~s~n",
|
|
||||||
[SQN, FN]) end,
|
[SQN, FN]) end,
|
||||||
Manifest).
|
Manifest).
|
||||||
|
|
||||||
|
|
||||||
initiate_penciller_snapshot(Bookie) ->
|
initiate_penciller_snapshot(Bookie) ->
|
||||||
{ok,
|
{ok,
|
||||||
{LedgerSnap, LedgerCache},
|
{LedgerSnap, LedgerCache},
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
all() -> [
|
all() -> [
|
||||||
% simple_put_fetch_head_delete,
|
simple_put_fetch_head_delete,
|
||||||
% many_put_fetch_head,
|
many_put_fetch_head,
|
||||||
journal_compaction %,
|
journal_compaction,
|
||||||
% fetchput_snapshot,
|
fetchput_snapshot,
|
||||||
% load_and_count,
|
load_and_count,
|
||||||
% load_and_count_withdelete,
|
load_and_count_withdelete,
|
||||||
% space_clear_ondelete
|
space_clear_ondelete
|
||||||
].
|
].
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ simple_put_fetch_head_delete(_Config) ->
|
||||||
ok = leveled_bookie:book_delete(Bookie3, "Bucket1", "Key2",
|
ok = leveled_bookie:book_delete(Bookie3, "Bucket1", "Key2",
|
||||||
[{remove, "Index1", "Term1"}]),
|
[{remove, "Index1", "Term1"}]),
|
||||||
not_found = leveled_bookie:book_get(Bookie3, "Bucket1", "Key2"),
|
not_found = leveled_bookie:book_get(Bookie3, "Bucket1", "Key2"),
|
||||||
|
not_found = leveled_bookie:book_head(Bookie3, "Bucket1", "Key2"),
|
||||||
ok = leveled_bookie:book_close(Bookie3),
|
ok = leveled_bookie:book_close(Bookie3),
|
||||||
{ok, Bookie4} = leveled_bookie:book_start(StartOpts2),
|
{ok, Bookie4} = leveled_bookie:book_start(StartOpts2),
|
||||||
not_found = leveled_bookie:book_get(Bookie4, "Bucket1", "Key2"),
|
not_found = leveled_bookie:book_get(Bookie4, "Bucket1", "Key2"),
|
||||||
|
|
|
@ -15,7 +15,7 @@ retain_strategy(_Config) ->
|
||||||
cache_size=1000,
|
cache_size=1000,
|
||||||
max_journalsize=5000000,
|
max_journalsize=5000000,
|
||||||
reload_strategy=[{?RIAK_TAG, retain}]},
|
reload_strategy=[{?RIAK_TAG, retain}]},
|
||||||
BookOptsAlt = BookOpts#bookie_options{max_run_length=6,
|
BookOptsAlt = BookOpts#bookie_options{max_run_length=8,
|
||||||
max_journalsize=100000},
|
max_journalsize=100000},
|
||||||
{ok, Spcl3, LastV3} = rotating_object_check(BookOpts, "Bucket3", 800),
|
{ok, Spcl3, LastV3} = rotating_object_check(BookOpts, "Bucket3", 800),
|
||||||
ok = restart_from_blankledger(BookOpts, [{"Bucket3", Spcl3, LastV3}]),
|
ok = restart_from_blankledger(BookOpts, [{"Bucket3", Spcl3, LastV3}]),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue