-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SortedLedgerStorage supports multiple dirs #3493
SortedLedgerStorage supports multiple dirs #3493
Conversation
d736bf8
to
d201d74
Compare
0848afb
to
ecd4eb2
Compare
interleavedLedgerStorage.checkpointer.startCheckpoint(cp); | ||
for (InterleavedLedgerStorage s : interleavedLedgerStorageList) { | ||
try { | ||
LOG.info("Started flushing mem table."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will be logged multiple times. Can we log something about 's'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finished:
print log's dir
s.checkpointer.startCheckpoint(cp); | ||
} | ||
} catch (Exception e) { | ||
s.getStateManager().transitionToReadOnlyMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finished:
print log's dir
|
||
public DefaultEntryLogger getEntryLogger() { | ||
return interleavedLedgerStorage.getEntryLogger(); | ||
public List<DefaultEntryLogger> getEntryLogger() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDefaultEntryLoggers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finished
} | ||
|
||
@Override | ||
public void forceGC() { | ||
interleavedLedgerStorage.forceGC(); | ||
interleavedLedgerStorageList.forEach(s -> s.forceGC()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one of the instances throws an error we won't process the others.
I suggest to wrap the error and continue processing.
Then, if one error occurred we throw it in the end.
The same here and in other similar methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finished:
exception handling optimization
} | ||
|
||
@Override | ||
public LedgerStorage getUnderlyingLedgerStorage() { | ||
return interleavedLedgerStorage; | ||
return interleavedLedgerStorageList.get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that this is correct.
Is this method only for tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finished:
this is mistake,I have updated
} | ||
|
||
@VisibleForTesting | ||
protected SortedLedgerStorage(InterleavedLedgerStorage ils) { | ||
interleavedLedgerStorage = ils; | ||
protected SortedLedgerStorage(String interleavedLedgerStorageClazz) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we pass a class name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please provide more details - what's the bug / how it affects BK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
LOG.info("ledgerStorage({}) started flushing mem table.", | ||
getEntryLogDirPath(s.getEntryLogger())); | ||
s.getEntryLogger().prepareEntryMemTableFlush(); | ||
memTable.flush(SortedLedgerStorage.this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to do memetable.flush for each interleaved storage, Sorted storage should fan flush out.
s.getEntryLogger().prepareEntryMemTableFlush(); | ||
memTable.flush(SortedLedgerStorage.this); | ||
|
||
if (s.getEntryLogger().commitEntryMemTableFlush()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is possible that only some interleaved storages / entry loggers actually got data (e.g. memetaable had data for one ledger only). What's the side-effect of the prepare/commit flush without any actual data? Do we have tests for this?
s.checkpointer.startCheckpoint(cp); | ||
} | ||
} catch (Exception e) { | ||
s.getStateManager().transitionToReadOnlyMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we create interleaved storages (ILS) per directory (ledgerDirsManager.getAllLedgerDirs().size()
)
Entry log manager (EntryLogManagerBase, getCurrentLogForLedgerForAddEntry/createNewLog/selectDirForNextEntryLog) still rotates entry logs across all available directories (the only reason why transition to read only on one ILS failing write is acceptable.) Also there is entry log per ledger.
It looks like it implicitly introduces parallelism (N ILSs for N dirs -> will write to N entry loggers, possibly at the same dir) which might not be ok for rotational disks
i do not have clear picture of what specifically you are trying to achieve so this per my best understanding.
@dlg99 thank you for your comments, I will sort it out and reply to you later |
Temporarily close first, and reopen after improvement |
Descriptions of the changes in this PR:
Motivation
planning for multiple dirs: mail talking
stage 1 :
the condition that the bug triggers:
1) conf.getLedgerDirs are multiple dirs
2) ledgerStorageClass=org.apache.bookkeeper.bookie.SortedLedgerStorage
Changes