feat(spool): add default methods to CloudMessageSpool for fast startu… - #1834
Draft
saranyailla wants to merge 1 commit into
Draft
feat(spool): add default methods to CloudMessageSpool for fast startu…#1834saranyailla wants to merge 1 commit into
saranyailla wants to merge 1 commit into
Conversation
…p sync Add getMaxMessageId() and getAllMessageIdsWithSizes() as default methods on the CloudMessageSpool interface to support DiskSpooler startup optimization (issue #1832).
|
Binary incompatibility detected for commit eb5d231. com.aws.greengrass.mqttclient.spool.CloudMessageSpool is binary incompatible and is source incompatible because of METHOD_NEW_DEFAULT Produced by binaryCompatability.py |
|
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against eb5d231 |
|
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against eb5d231 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…p sync
Add
getMaxMessageId()andgetAllMessageIdsWithSizes()as default methods on theCloudMessageSpoolinterface to support DiskSpooler startup optimization (issue #1832).Problem
When the Greengrass Nucleus boots with Disk spooler storage configured, the Spool constructor calls
persistentQueueSync()which iterates every persisted message and callsgetMessageById()for each one. This reads the full message payload from SQLite only to extract payload.length for capacity tracking. The payload itself is discarded immediately.See: #1832 (#1832)
Changes
Add two default methods to the
CloudMessageSpoolinterface:getMaxMessageId()— Returns the highest message ID stored in the spool. The nucleus uses this to set its nextId counter without iterating all rows. Spooler plugin reads this from DB.getAllMessageIdsWithSizes()— Returns an ordered list of [messageId, payloadSizeInBytes] pairs. The nucleus uses this to populate its dispatch queue and track capacity in a single pass without reading any payload blobs. The DiskSpooler plugin can implement this asSELECT message_id, LENGTH(payload) FROM spooler ORDER BY message_id ASCa single table scan where LENGTH() reads from SQLite row headers, not blob content.Default values
Both methods have default implementations on the interface:
(existing behavior).
background thread (the slow path, but still improved over blocking the main thread).
The DiskSpooler plugin is deployed independently of the nucleus. Customers may upgrade their nucleus without upgrading the spooler plugin (or vice versa). Default
methods ensure:
Testing
Existing tests pass (39/39). No behavioral change in this PR — the nucleus does not yet consume these methods. The consuming logic will be in a follow-up PR.
How was this change tested:
Any additional information or context required to review the change:
Documentation Checklist:
Compatibility Checklist:
any deprecated method or type.
Refer to Compatibility Guidelines for more information.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.