func CheckPushResult( ctx context.Context, db *kv.DB, txn roachpb.Transaction, expResolution ExpectedTxnResolution, pushExpectation PushExpectation, ) error
CheckPushResult pushes the specified txn and checks that the pushee's resolution is the expected one.
StrToCPutExistingValue takes a string that was written using, say, a Put and returns the bytes that can be passed to a Batch.CPut() as the expected value resulting from said Put.
ExpectedTxnResolution expresses an expectation for CheckPushResult about the outcome of the push.
const ( // ExpectAborted means that the pushee is expected to have been aborted. Note // that a committed txn that has been cleaned up also results in an ABORTED // result for a pusher. ExpectAborted ExpectedTxnResolution = iota // ExpectCommitted means that the pushee is expected to have found the pushee // to be committed - or STAGING in which case the push will have performed // successful transaction recovery. ExpectCommitted )
PushExpectation expresses an expectation for CheckPushResult about what the push did.
const ( // ExpectPusheeTxnRecovery means we're expecting transaction recovery to be // performed (after finding a STAGING txn record). ExpectPusheeTxnRecovery PushExpectation = iota // ExpectPusheeTxnRecordNotFound means we're expecting the push to not find the // pushee txn record. ExpectPusheeTxnRecordNotFound // DontExpectAnything means we're not going to check the state in which the // pusher found the pushee's txn record. DontExpectAnything )