mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* perf(storage): append WAL batches once and skip compaction of an unchanged store A putAll batch was N locked appends and N flushes; it is now one contiguous run of records and one flush. Compaction rewrote the snapshot on every tick even when nothing had changed since the last one, so an idle store kept rewriting its file; the store now tracks whether it changed and compaction returns early otherwise. Entries replayed from the log at load mark the store changed so the next compaction folds them in. * fix(storage): recover from a corrupt WAL tail instead of failing boot The replay reader trusted the signed length headers it read: a negative length threw IllegalArgumentException out of load() and failed the owning service at boot, and a length past the end of the file read to EOF. After any stop, the writer reopened behind the unreadable bytes, so every entry appended after a torn tail was lost on the next load until a compaction happened. Lengths are now bounded by the bytes left in the file, every framing or decode failure stops replay with a warning, and the unreadable tail is cut off before the writer reopens. An unreadable snapshot is quarantined to a .corrupt sibling like the other file-backed stores do, instead of being overwritten by the next compaction. * fix(storage): journal append-heavy stores under persistent mode PersistentStorage rewrites the whole store file on every mutation, so the cost of a write grows with the store. A store can now declare an APPEND_HEAVY write profile on StorageFactory.create; under persistent mode such a store is backed by WalStorage with the store's own JSON file as the snapshot and a .wal file next to it. The snapshot layout means an existing store file is picked up as the first snapshot and the file is current again after a clean shutdown, so no migration is needed in either direction. The other modes ignore the profile. * fix(cloudwatchlogs): journal log events under persistent storage Every PutLogEvents batch rewrote the whole cwlogs-events.json file under persistent mode, so the cost of one batch grew with the number of stored events. The events store now declares the APPEND_HEAVY write profile: a batch is appended to cwlogs-events.wal and the JSON file is rewritten on the WAL compaction interval and at shutdown. Groups, streams, filters and policies keep the file that is rewritten on every call. Closes #2500 * docs(storage): describe journaled stores under persistent mode Explain that CloudWatch Logs events are journaled to cwlogs-events.wal under persistent mode, that the compaction interval now governs that store too, and that the JSON file is current after a clean shutdown and up to one interval behind while running. Also corrects the documented CloudWatch Logs flush interval default from 5000 to 15000, which is what EmulatorConfig ships. * docs(storage): describe journaled stores as append-heavy The pages said the CloudWatch Logs event store only ever grows, but the 20,000-event cap, retention pruning and DeleteLogStream all remove events. What qualifies a store for journaling is its write pattern, which is what WriteProfile.APPEND_HEAVY says, so the pages now say that.