Simplify txn commits and aborts (#2491)
Txn: - Commits have been separated into CommitToMemory and CommitToDisk. This logic is a lot simpler and clearer than before. In particular, CommitToDisk does not try to generate any state. It just serializes the posting list stored at startTs and pushes that to Badger. - Multiple txns doing CommitToDisk can now be batched up into fewer transactions and use callbacks to execute quickly. Added a helper struct for that. - Remove the concept of activeTxns in posting/list.go. It's a repetition. - Simplify txn.deltas, and removed as much as I could. - Removed abortMutation methods from txn (mvcc.go) and posting/list.go Zero: - TryAbort returns OracleDelta, which can be directly proposed in the group. - abortOldTransactions uses this to ensure that in case we missed a transaction update, the result of the abort can then be proposed to the group, so group snapshot doesn't get stuck.
Showing
- dgraph/cmd/server/http_test.go 7 additions, 1 deletiondgraph/cmd/server/http_test.go
- dgraph/cmd/zero/oracle.go 10 additions, 5 deletionsdgraph/cmd/zero/oracle.go
- posting/index.go 8 additions, 8 deletionsposting/index.go
- posting/index_test.go 6 additions, 2 deletionsposting/index_test.go
- posting/list.go 47 additions, 48 deletionsposting/list.go
- posting/list_test.go 26 additions, 27 deletionsposting/list_test.go
- posting/mvcc.go 37 additions, 123 deletionsposting/mvcc.go
- posting/oracle.go 6 additions, 13 deletionsposting/oracle.go
- protos/intern/internal.pb.go 193 additions, 194 deletionsprotos/intern/internal.pb.go
- protos/internal.proto 1 addition, 1 deletionprotos/internal.proto
- query/common_test.go 1 addition, 1 deletionquery/common_test.go
- worker/draft.go 57 additions, 27 deletionsworker/draft.go
- worker/mutation.go 5 additions, 31 deletionsworker/mutation.go
- worker/predicate_test.go 5 additions, 1 deletionworker/predicate_test.go
- x/badger.go 48 additions, 0 deletionsx/badger.go
Loading
Please register or sign in to comment