-
Notifications
You must be signed in to change notification settings - Fork 547
fix: Handle concurrent map writes #18538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| objKey := c.spec.ReplacePathVariables(table.Name, uuid.NewString(), time.Now().UTC(), c.syncID) | ||
| // if object was already initialized, use the same key | ||
| // We don't need any locking here because all messages for the same table are processed sequentially | ||
| c.initializedTablesLock.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can use a RWMutex sync we want the entire operation to be atomic
| table := msg.GetTable() | ||
| objKey := c.spec.ReplacePathVariables(table.Name, uuid.NewString(), time.Now().UTC(), c.syncID) | ||
| // if object was already initialized, use the same key | ||
| // We don't need any locking here because all messages for the same table are processed sequentially |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this assumption not true anymore? Or was it never true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the batch code (even before cloudquery/plugin-sdk#1719) I'm not sure we ever had a guarantee that WriteTable is not called from multiple Go routines
|
We decided to ship this hot fix for s3 then look at the SDK code to see what's causing |
🤖 I have created a release *beep* *boop* --- ## [7.2.8](plugins-destination-s3-v7.2.7...plugins-destination-s3-v7.2.8) (2024-07-09) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.49.3 ([#18513](#18513)) ([d12da90](d12da90)) * Handle concurrent map writes ([#18538](#18538)) ([34fb27a](34fb27a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Fixes https://github.com/cloudquery/cloudquery-issues/issues/1999 (hopefully).
While the comment in the code is correct and all messages for the same table are processed sequentially, I don't think there's a guarantee that
WriteTableis not called from multiple concurrent Go routines