verifyFailoverLog checks for VbUUID changes when failOnRollback is set, and writes the failover log to the client metadata store. If previous VbUUID is zero, it's not considered a rollback - it's not required to initialize vbUUIDs into meta.
(vbID uint16, f []gocbcore.FailoverEntry)
| 549 | // writes the failover log to the client metadata store. If previous VbUUID is zero, it's |
| 550 | // not considered a rollback - it's not required to initialize vbUUIDs into meta. |
| 551 | func (dc *DCPClient) verifyFailoverLog(vbID uint16, f []gocbcore.FailoverEntry) error { |
| 552 | |
| 553 | if dc.failOnRollback { |
| 554 | previousMeta := dc.metadata.GetMeta(vbID) |
| 555 | // Cases where VbUUID and StartSeqNo aren't set aren't considered rollback |
| 556 | if previousMeta.VbUUID == 0 && previousMeta.StartSeqNo == 0 { |
| 557 | return nil |
| 558 | } |
| 559 | |
| 560 | currentVbUUID := getLatestVbUUID(f) |
| 561 | // if previousVbUUID hasn't been set yet (is zero), don't treat as rollback. |
| 562 | if previousMeta.VbUUID != currentVbUUID { |
| 563 | return ErrVbUUIDMismatch |
| 564 | } |
| 565 | } |
| 566 | return nil |
| 567 | } |
| 568 | |
| 569 | func (dc *DCPClient) deactivateVbucket(vbID uint16) { |
| 570 | dc.activeVbucketLock.Lock() |
no test coverage detected