[1.x] Reduce chances of missing Pulse records due to deadlocks when not using Redis #271
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.
It's possible (but rare) for Pulse to get a deadlock if two processes upsert the same data concurrently when there is no existing row to update.
Pulse catches the exception, so the application is not impacted. However, it will result in Pulse missing records.
It's already possible to solve the issue by using the Redis ingest, as it removes concurrent upserts, but this PR aims to reduce the chances for those not using Redis. It does this by:
We replicated the issue locally by running multiple processes, all capturing the same data repeatedly in a loop. Prior to the change, we could reproduce the issue every 2-3 minutes using 8 concurrent processes. After increasing the attempts, we didn't see the issue in the 30 minutes we left it running.