Skip to content

storage: improve EndTransaction's AbortSpan declaration#28799

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/endTxnSpanSet
Aug 18, 2018
Merged

storage: improve EndTransaction's AbortSpan declaration#28799
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/endTxnSpanSet

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Aug 18, 2018

Fixes #24285.

We no longer declare a write on the abort span key if the
EndTransaction is not trying to abort the transaction with
poison=true.

Release note: None

Fixes cockroachdb#24285.

We no longer declare a write on the abort span key if the
EndTransaction is not trying to abort the transaction with
poison=true.

Release note: None
@nvb nvb requested review from a team and tbg August 18, 2018 20:06
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 18, 2018

TFTR!

bors r+

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 18, 2018

bors r-

@craig
Copy link
Copy Markdown
Contributor

craig Bot commented Aug 18, 2018

Canceled

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 18, 2018

This actually brings up an interesting question. Why isn't

// If the poison arg is set, make sure to set the abort span entry.
if args.Poison && txn.Status == roachpb.ABORTED {
if err := SetAbortSpan(ctx, evalCtx, batch, ms, txn.TxnMeta, true /* poison */); err != nil {
return nil, err
}
}

written as:

if txn.Status == roachpb.ABORTED {
	if err := SetAbortSpan(ctx, evalCtx, batch, ms, txn.TxnMeta, args.Poison); err != nil {
		return nil, err
	}
}

The effect of this is that we currently never remove abort span entries if they exist when the TxnCoordSender sends an EndTransactionRequest(Commit=false). My understanding of Poison and its interaction with the AbortSpan is that it is safe to remove the entry when Poison=false because that implies an acknowlegement from the TxnCoordSender of the transaction's aborted disposition. I wonder if this has any implications on #25233.

cc. @tschottdorf @bdarnell

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 18, 2018

That question doesn't need to hold up this PR though, so...

bors r+

craig Bot pushed a commit that referenced this pull request Aug 18, 2018
28737: opt: add colstats flag to opttester r=RaduBerinde a=RaduBerinde

Adding a flag that triggers the calculation of a column statistic for
the root expression. This is useful for testing statistics that
otherwise aren't calculated; in particular, we have code for
multi-column stats but they are not used yet.

Release note: None

28799: storage: improve EndTransaction's AbortSpan declaration r=nvanbenschoten a=nvanbenschoten

Fixes #24285.

We no longer declare a write on the abort span key if the
EndTransaction is not trying to abort the transaction with
poison=true.

Release note: None

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig Bot commented Aug 18, 2018

Build succeeded

@craig craig Bot merged commit 3a3ca38 into cockroachdb:master Aug 18, 2018
@tbg
Copy link
Copy Markdown
Member

tbg commented Aug 20, 2018

I think this comes (came?) down to a lack of trust in that TxnCoordSender was doing the right thing with respect to its "async aborts". Could a txn be aborted (unbeknownst to it) and dispatch a read (which needs to hit the abort span for correctness) that would be "passed" by an async abort but would still return its value to the client? If so, clearing the abort span from the async abort would let the read return something incorrect (i.e. not read what you wrote).

I agree that we should revisit this and that it has a likely connection to #25233!

@nvb nvb deleted the nvanbenschoten/endTxnSpanSet branch August 27, 2018 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants