Rolback hash|no_hash and batch journal compaction

The no_hash option in CDB files became too hard to manage, in particular
the need to scan the whole file to find the last_key rather than cheat
and use the index.  It has been removed for now.

The writing to the journal during journal compaction has now been
enhanced by a mput option on the CDB file write - so it can write each
batch as one pwrite operation.
This commit is contained in:
martinsumner 2016-10-26 11:39:27 +01:00
parent 97087a6b2b
commit 2a47acc758
5 changed files with 103 additions and 68 deletions

View file

@ -382,14 +382,13 @@ start_from_file(InkOpts) ->
put_object(LedgerKey, Object, KeyChanges, State) ->
NewSQN = State#state.journal_sqn + 1,
{JournalKey, JournalBin, HashOpt} = leveled_codec:to_inkerkv(LedgerKey,
NewSQN,
Object,
KeyChanges),
{JournalKey, JournalBin} = leveled_codec:to_inkerkv(LedgerKey,
NewSQN,
Object,
KeyChanges),
case leveled_cdb:cdb_put(State#state.active_journaldb,
JournalKey,
JournalBin,
HashOpt) of
JournalBin) of
ok ->
{ok, State#state{journal_sqn=NewSQN}, byte_size(JournalBin)};
roll ->
@ -405,8 +404,7 @@ put_object(LedgerKey, Object, KeyChanges, State) ->
State#state.root_path),
ok = leveled_cdb:cdb_put(NewJournalP,
JournalKey,
JournalBin,
HashOpt),
JournalBin),
io:format("Put to new active journal " ++
"with manifest write took ~w microseconds~n",
[timer:now_diff(os:timestamp(),SW)]),