Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1773)

Unified Diff: filter/txnBuf/context.go

Issue 1434873003: Fix races in txnBuf (Closed) Base URL: https://github.com/luci/gae.git@race_tests
Patch Set: fix stuff Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | filter/txnBuf/doc.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/txnBuf/context.go
diff --git a/filter/txnBuf/context.go b/filter/txnBuf/context.go
index c6007319b1566c941cabc5b55b2e5ce48c7a6e66..39433350865ee0cb3638fbc20b3e0baa1070efd3 100644
--- a/filter/txnBuf/context.go
+++ b/filter/txnBuf/context.go
@@ -8,13 +8,13 @@ import (
"golang.org/x/net/context"
ds "github.com/luci/gae/service/datastore"
- "github.com/luci/gae/service/info"
)
type key int
var (
- dsTxnBufParent key
+ dsTxnBufParent key
+ dsTxnBufHaveLock key = 1
)
// FilterRDS installs a transaction buffer datastore filter in the context.
@@ -23,9 +23,10 @@ func FilterRDS(c context.Context) context.Context {
// transaction to, transitively.
return ds.AddRawFilters(c, func(c context.Context, rds ds.RawInterface) ds.RawInterface {
if par, _ := c.Value(dsTxnBufParent).(*txnBufState); par != nil {
- return &dsTxnBuf{c, par}
+ haveLock, _ := c.Value(dsTxnBufHaveLock).(bool)
+ return &dsTxnBuf{c, par, haveLock}
}
- return &dsBuf{rds, info.Get(c).GetNamespace()}
+ return &dsBuf{rds}
})
}
« no previous file with comments | « no previous file | filter/txnBuf/doc.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698