Edge event table - added sequential ID column to handle properly heavy load and cluster cases #8830
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.
Pull Request description
Motivation: This pull request addresses two potential issues that could arise from improper message delivery to the edge, particularly under heavy load or in cluster mode.
The 'edge_event' table is currently processed by sorting via the 'createdTime' column. Under heavy load, it's possible for multiple events to have identical 'createdTime' values. In such cases, some events might be missed and not sent to the edge under certain conditions, or conversely, some events might be sent twice.
In cluster mode, 'createdTime' is generated on a specific cluster node. If there is a time difference between nodes, or if there are issues in the steps to save events, resulting in delayed delivery, certain events can be missed and not delivered to the edge.
To resolve these issues, a new sequential column has been added to the 'edge_event' table. This column will be used to track which events have already been sent and which are yet to be delivered. By using this approach, PostgreSQL becomes the single point for generating this sequence number, even in the case of cluster mode.
General checklist
Front-End feature checklist
Back-End feature checklist