-
- Downloads
Avoid race condition between predicate move and commit (#2392)
- The reason for bug #2338 was that there was a race condition between a mutation and predicate move. Zero was not checking if a predicate is under move before allowing a commit. Thus, a mutation could get proposed in a group, then a move starts, and get committed by Zero (after the move starts). - This change this issue by ensuring that Zero checks if a predicate is being moved, before allowing commit. - Any pending transactions are also cancelled once the move starts, so this would only happen as part of a race condition and not afterward. Mechanism: - Send the real keys back to Zero, as part of Transaction Context. - Zero uses these keys to parse the predicate, and checks if that predicate is currently moving. If so, it would abort the transaction. - Also, check for `_predicate_` being moved. For some reason, if we don't consider this predicate, we could still lose data. - Before doing a mutation in Dgraph alpha, check if that tablet can be written to. - Loop until all transactions corresponding to the predicate move are aborted. Only then start the move. Tangential changes: - Update the port number for bank integration test. - Remove the separate key value or clean channel. Make it run as part of the main Node.Run loop. - Add a max function. - Small refactoring here and there.
Showing
- contrib/integration/bank/main.go 1 addition, 1 deletioncontrib/integration/bank/main.go
- dgraph/cmd/zero/oracle.go 33 additions, 0 deletionsdgraph/cmd/zero/oracle.go
- dgraph/cmd/zero/tablet.go 5 additions, 0 deletionsdgraph/cmd/zero/tablet.go
- posting/index.go 2 additions, 4 deletionsposting/index.go
- posting/mvcc.go 5 additions, 4 deletionsposting/mvcc.go
- worker/draft.go 12 additions, 42 deletionsworker/draft.go
- worker/groups.go 8 additions, 0 deletionsworker/groups.go
- worker/mutation.go 4 additions, 7 deletionsworker/mutation.go
- worker/predicate_move.go 33 additions, 30 deletionsworker/predicate_move.go
- x/keys.go 2 additions, 0 deletionsx/keys.go
- x/x.go 7 additions, 0 deletionsx/x.go
Loading
Please register or sign in to comment