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