1559924775 opened a new pull request, #3605:
URL: https://github.com/apache/bookkeeper/pull/3605

   … write process
   
   Descriptions of the changes in this PR:
   add a synchronized createNewLog method in EntryLogManagerForSingleEntryLog.
   
   
   ### Motivation
   
   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.
   
![14e56f8a3e057508f446abb1ccd7b687](https://user-images.githubusercontent.com/35036009/199918343-ce3f5648-6851-4d82-b093-e0605ea9a02a.png)
   
![ae141da9c0fa6d51373775c19e0860ad](https://user-images.githubusercontent.com/35036009/199918357-d0124ed3-d7d7-4563-bef1-64ab62d553dc.png)
   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+entryData1
   entrySize2+entryData2
   ...
   entrySizen+entryDatan
   ledgersMap
   
   The wrong entrylog is as follows:
   header
   entrySize1+entryData1
   entrySize2+entryData2
   ...
   entrySizen
   ledgersMap
   entryDatan
   
   ### Changes
   
   add a synchronized createNewLog method in EntryLogManagerForSingleEntryLog.
   
   Master Issue: #3604
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to