-
Notifications
You must be signed in to change notification settings - Fork 961
Description
BUG REPORT
Describe the bug
we use SortedLedgerStorage+EntryLogManagerForSingleEntryLog.
When the entrylog file managed by EntryLogManagerForSingleEntryLog reaches the upper limit, the createNewLog method is executed. This operation is not locked, which will conflict with the addEntry executed in the compaction process, resulting in disordered entryLog file data.


There is a concurrency problem with the two operations shown above.
In our case we found this code execution order:
1.logChannel.flush();
2.logChannel.write(sizeBuffer);
3.logChannel.appendLedgersMap();
4.logChannel.write(entry);
The correct entryLog file format should be like this:
header
entrySize1+ledgerId1+entryData1
entrySize2+ledgerId2+entryData2
...
entrySizen+ledgerIdn+entryDatan
ledgersMap
The wrong entrylog is as follows:
header
entrySize1+ledgerId1+entryData1
entrySize2+ledgerId2+entryData2
...
entrySizen
ledgersMap
ledgerIdn+entryDatan
I used the scanEntryLog method in EntryLogger to parse an error file. The phenomenon is as follows:

