Conversation
go/vt/srvtopo/resolver.go
Outdated
There was a problem hiding this comment.
@sougou we need a TODO to clean this up. Wha't s the best way to word it?
|
I removed the checks that were preventing replica transactions in various places. However, I believe we need some other checks to ensure that we are allowing replica transactions only if we have a pinned tablet to route the subsequent queries to. |
903fd9a to
fc7c11e
Compare
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com> Signed-off-by: deepthi <deepthi@planetscale.com>
2d1aaf1 to
65a8a5c
Compare
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
5cf4cba to
031527c
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…ction Signed-off-by: Andres Taylor <andres@planetscale.com>
…orrect tablet Signed-off-by: deepthi <deepthi@planetscale.com>
go/vt/vtgate/tx_conn.go
Outdated
| return err | ||
| } | ||
| } | ||
| // TODO(deepthi): TransactionId should be set to 0 only if the commit succeeded |
There was a problem hiding this comment.
I don't feel this is correct. If we tried and failed to commit, we should not trust that we still have an open transaction on this connection. I think we should set the tx_id to 0 and close the connection, since we can't trust it
There was a problem hiding this comment.
That is valid. I think we got it exactly backwards in the first attempt to fix it.
The way this should work is:
- Commit is successful. All shardSession transactions have ended, so set all TransactionID = 0
- There was an error from one or more shards. Rollback the other shards. Rollback should only operate on the shards that did not fail. So set TransactionID=0 on failed shards so that we attempt rollback only on successful shards. There is no need to explicitly set TransactionID = 0 on the successful shards at the end of rollback. the defer call to session.Reset takes care of that.
Signed-off-by: Andres Taylor <andres@planetscale.com>
ff85a4a to
be11233
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
… shards if a subset fails Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
| @@ -132,7 +132,7 @@ func TestTxConnCommitOrderFailure1(t *testing.T) { | |||
| utils.MustMatch(t, &wantSession, session.Session, "Session") | |||
| assert.EqualValues(t, 1, sbc0.CommitCount.Get(), "sbc0.CommitCount") | |||
| // When the commit fails, we try to clean up by issuing a rollback | |||
There was a problem hiding this comment.
We should add assertions about sbc1.CommitCount here, and sbc0.RollbackCount in the next test to make it clearer
There was a problem hiding this comment.
Added assertions though I'm not sure I understand them :)
| } | ||
|
|
||
| var qs queryservice.QueryService | ||
| if UsingLegacyGateway() { |
There was a problem hiding this comment.
We really need to remove the legacy gateway, or add more capabilities to it. these checks are really not good to spread out like this
| qr, err := conn.ExecuteFetch(query, 1000, true) | ||
| require.Nil(t, err) | ||
| if expectError == "" { | ||
| require.Nil(t, err) |
There was a problem hiding this comment.
When checking for errors, we get better assertion error messages if we use require.NoError instead of require.Nil
There was a problem hiding this comment.
+1. I was looking for this, but thought it was something like NilError.
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
7a73eab to
f13b506
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
| return shardVars | ||
| } | ||
|
|
||
| func allowOnlyMaster(rss ...*srvtopo.ResolvedShard) error { |
Signed-off-by: deepthi <deepthi@planetscale.com>
…nd works Signed-off-by: deepthi <deepthi@planetscale.com>
…st healthcheck Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
|
opened vitessio#6244. closing this one. |
creating a PR to get feedback