Now that we apply txn updates via Raft, waiting based on Txn timestamps is sufficient. We don't need to wait for proposals to be applied.
(store *raftwal.DiskStorage, gid uint32, id uint64, myAddr string)
| 254 | // sufficient. We don't need to wait for proposals to be applied. |
| 255 | |
| 256 | func newNode(store *raftwal.DiskStorage, gid uint32, id uint64, myAddr string) *node { |
| 257 | glog.Infof("Node ID: %#x with GroupID: %d\n", id, gid) |
| 258 | |
| 259 | isLearner := x.WorkerConfig.Raft.GetBool("learner") |
| 260 | rc := &pb.RaftContext{ |
| 261 | Addr: myAddr, |
| 262 | Group: gid, |
| 263 | Id: id, |
| 264 | IsLearner: isLearner, |
| 265 | } |
| 266 | glog.Infof("RaftContext: %+v\n", rc) |
| 267 | m := conn.NewNode(rc, store, x.WorkerConfig.TLSClientConfig) |
| 268 | |
| 269 | n := &node{ |
| 270 | Node: m, |
| 271 | ctx: context.Background(), |
| 272 | gid: gid, |
| 273 | // We need a generous size for applyCh, because raft.Tick happens every |
| 274 | // 10ms. If we restrict the size here, then Raft goes into a loop trying |
| 275 | // to maintain quorum health. |
| 276 | applyCh: make(chan []raftpb.Entry, 1000), |
| 277 | closer: z.NewCloser(4), // Matches CLOSER:1 |
| 278 | ops: make(map[op]operation), |
| 279 | cdcTracker: newCDC(), |
| 280 | } |
| 281 | return n |
| 282 | } |
| 283 | |
| 284 | func (n *node) Ctx(key uint64) context.Context { |
| 285 | if pctx := n.Proposals.Get(key); pctx != nil { |