TeaEngineering / libchronicle

Shared-memory interprocess communication from C using OpenHFT's chronicle-queue protocol
Apache License 2.0
14 stars 10 forks source link

rollover leaves previous queuefile without EOF entry #21

Closed shuckc closed 2 years ago

shuckc commented 2 years ago

Our append function does not write EOF to the current queuefile when rolling to the next. So our own tailer will get stuck on the last entry of the old queuefile, even though the appender has continued ahead.

We consult the clock before polling the appender, and will switch queuefiles in preparation for the next write. This is not correct. instead:

  1. take write lock from the current queuefile
  2. sample the clock
  3. no roll:
    • write entry normally and release lock
  4. roll:
    • create new queuefile,
    • update global maxcycle, current cycle
    • write EOF to the current queuefile, releasing the writelock
    • re-attempt the write from step 1