[
https://issues.apache.org/jira/browse/BOOKKEEPER-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sijie Guo updated BOOKKEEPER-177:
---------------------------------
Attachment: BK-177.patch
attach a patch to fix this issue. also move flush single ledger logic into a
function which makes flush logic more readable.
> Index file is lost or some index pages aren't flushed.
> ------------------------------------------------------
>
> Key: BOOKKEEPER-177
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-177
> Project: Bookkeeper
> Issue Type: Bug
> Components: bookkeeper-server
> Reporter: Sijie Guo
> Assignee: Sijie Guo
> Fix For: 4.1.0
>
> Attachments: BK-177.patch, IndexCorruptionTest.java
>
>
> we found that some index files are lost ore some index pages aren't flushed
> after applying BOOKKEEPER-137 patch.
> this issue can be reproduced by following sequence.
> index file missing:
> 1) create ledger 1 without writing any entries
> 2) open ledger 1 which causes a recoveryRead entry(0) sent to bookie server.
> then an empty page is put in pageTable by mistake as below. (we should call
> updatePage first to check whether bookie server has this ledger)
> {code}
> // in ledgerCache#getEntryOffset
> lep = grabCleanPage(ledger, pageEntry);
> synchronized(this) {
> putIntoTable(pages, lep);
> }
> updatePage(lep);
> {code}
> 3) open ledger 2 to write serval entries. a meta entry and several data
> entries would be put in journal.
> 4) SyncThread executes to flush ledger. it first flush ledger 1, although
> ledger 1 has an empty page which is clean, but the code still need to call
> #getFileInfo, which will cause an NoLedgerException fail the flush.
> unfortunately, the SyncThread caught this exception and just output an error
> message then rollLog. the result is ledger 2 is not flushed, and its journal
> entries would not be replayed after restarted.
> {code}
> lastLogMark.markLog();
>
> try {
> ledgerCache.flushLedger(true);
> } catch (IOException e) {
> LOG.error("Exception flushing Ledger", e);
> }
> try {
> entryLogger.flush();
> } catch (IOException e) {
> LOG.error("Exception flushing entry logger", e);
> }
>
> lastLogMark.rollLog();
> {code}
> similar case for some index pages are not flushed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira