fix data race on lazy tx id#2152
Conversation
summaryInferred base version: v3.136.2 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2152 +/- ##
==========================================
- Coverage 74.89% 71.65% -3.24%
==========================================
Files 428 428
Lines 37432 37572 +140
==========================================
- Hits 28035 26923 -1112
- Misses 8193 9434 +1241
- Partials 1204 1215 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate a reported data race around lazy transaction ID materialization in topic-table transactional workflows (Issue #2151) by making LazyID’s underlying storage concurrency-safe.
Changes:
- Switched
internal/tx.LazyIDfrom a plain*stringfield toatomic.Pointer[string]with atomic load/store inID()/SetTxID(). - Added a CHANGELOG entry describing the data race fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/tx/id.go | Uses atomic load/store for the lazy transaction ID storage. |
| CHANGELOG.md | Documents the fix at the top of the changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…, added topic mock
| } | ||
| txID, err := begin(ctx, tx.s.client, tx.s.ID(), tx.txSettings) | ||
| err = xerrors.WithStackTrace(err) | ||
| tx.SetTxID(txID) |
There was a problem hiding this comment.
тут же все равно возможна гонка между вызовами SetTxID() и ID() из разных горутин
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: #2151
What is the new behavior?
Other information