killbill/killbill-commons

STICKY_EVENTS optimization for the cloud

pierre opened this issue · 0 comments

To make #29 work with the STICKY_EVENTS configuration (bus only), we also need to review the behavior of finding orphan entries.

Instead of simply logging:

log.warn(DB_QUEUE_LOG_ID + "Detected unprocessed bus event {}, may need to restart server...", previousLowestOrphanEntry);

we now need to re-insert such orphan ids in the in-memory inflightEvents queue.

Looking at the code written for STICKY_POLLING, there is an easier approach to this:

  • Keep the orphan code as-is
  • In the reapEntries method, instead of simply calling transactional.insertEntries, do something similar to insertEntryFromTransaction, i.e. write the entries to disk and add them to the inflight queue in bulk on success. Because of the LAST_INSERT_ID logic, we wouldn't be able to insert them in bulk in that case though

For testing:

  • Additional tests to write in TestDBBackedQueue
  • Manual testing: you could have one Kill Bill server running in STICKY_EVENTS and insert a dummy bus event entry for another fictive node (other creator name). That event should eventually be picked up by the server