Implementation of InternalPushTxn operation.

 The details of the op are spelled out in detail in the Range.InternalPushTxn comments and in the
api.proto comments. Unittests provides full code test coverage including
all error conditions.

Changed MVCC.ResolveWriteIntent to no longer accept a Commit parameter.
Instead, we use more of the provided Txn parameter's fields to correctly
update the MVCC metadata / versioned value. The missing piece here was
handling the case of the timestamp being pushed forward instead of just
having the underlying transaction committed or aborted. In the case of
pushing the timestamp, the MVCC metadata txn field is not set to nil,
it's just updated. We also will end up removing the versioned value with
the previous timestamp and create a new one with the updated timestamp.

Cleaned up TODO file.
Unfortunately, I can't see what you're referring to. None of your comments
show up in the code and the snippet in the email doesn't make any sense.
Could you comment directly in the most recent code? We never abort a
transaction without persisting its transaction record!

On Thu, Sep 18, 2014 at 11:43 AM, jiangmingyang <notifications@github.com>
wrote:

> In storage/range.go:
>
> > +		reply.SetGoError(err)
> > +		return
> > +	}
> > +	if ok {
> > +		// Start with the persisted transaction record as final transaction.
> > +		reply.PushTxn = gogoproto.Clone(existTxn).(*proto.Transaction)
> > +		// Upgrade the epoch and timestamp as necessary.
> > +		if reply.PushTxn.Epoch < args.PushTxn.Epoch {
> > +			reply.PushTxn.Epoch = args.PushTxn.Epoch
> > +		}
> > +		if reply.PushTxn.Timestamp.Less(args.PushTxn.Timestamp) {
> > +			reply.PushTxn.Timestamp = args.PushTxn.Timestamp
> > +		}
> > +	} else {
> > +		// The transaction doesn't exist yet on disk; use the supplied version.
> > +		reply.PushTxn = gogoproto.Clone(&args.PushTxn).(*proto.Transaction)
>
> In the case above, the current code won't persistent the txn-1's record
> after aborting it.
>
> first of all, it will violate your new checking:
>
> args.PusheeTxn.Status != proto.PENDING
>
> secondly, If Txn-1 try to commit itself, it won't know it is already
> aborted. I doubt if it is safe to not persistent the previous abort
> decision?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/cockroachdb/cockroach/pull/65/files#r17735273>.
>