Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify error message when transaction not found in numbered pool #15760

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/pools/numbered.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (nu *Numbered) Get(id int64, purpose string) (val any, err error) {
if unreg, ok := nu.recentlyUnregistered.Get(fmt.Sprintf("%v", id)); ok {
return nil, fmt.Errorf("ended at %v (%v)", unreg.timeUnregistered.Format("2006-01-02 15:04:05.000 MST"), unreg.reason)
}
return nil, fmt.Errorf("not found")
return nil, fmt.Errorf("not found (potential transaction timeout)")
}
if nw.inUse {
return nil, fmt.Errorf("in use: %s", nw.purpose)
Expand Down
2 changes: 1 addition & 1 deletion go/pools/numbered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestNumberedGeneral(t *testing.T) {

p.Put(id)
_, err = p.Get(1, "test2")
assert.Contains(t, "not found", err.Error())
assert.ErrorContains(t, err, "not found (potential transaction timeout)")
p.Unregister(1, "test") // Should not fail
p.Unregister(0, "test")
// p is now empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestActivePoolGetConnNonExistentTransaction(t *testing.T) {
params := dbconfigs.New(db.ConnParams())
pool.Open(params, params, params)
_, err := pool.GetAndLock(12345, "for query")
require.EqualError(t, err, "not found")
require.EqualError(t, err, "not found (potential transaction timeout)")
}

func TestExecWithAbortedCtx(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/tabletserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func TestTabletServerCommiRollbacktFail(t *testing.T) {

target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY}
_, err := tsv.Commit(ctx, &target, -1)
want := "transaction -1: not found"
want := "transaction -1: not found (potential transaction timeout)"
require.Equal(t, want, err.Error())
_, err = tsv.Rollback(ctx, &target, -1)
require.Equal(t, want, err.Error())
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/tx_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ func TestTxEngineFailReserve(t *testing.T) {

nonExistingID := int64(42)
_, err = te.Reserve(ctx, options, nonExistingID, nil)
assert.EqualError(t, err, "transaction 42: not found")
assert.EqualError(t, err, "transaction 42: not found (potential transaction timeout)")

txID, _, _, err := te.Begin(ctx, nil, 0, nil, options)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/tx_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestTxExecutorPrepareNotInTx(t *testing.T) {
defer db.Close()
defer tsv.StopService()
err := txe.Prepare(0, "aa")
require.EqualError(t, err, "transaction 0: not found")
require.EqualError(t, err, "transaction 0: not found (potential transaction timeout)")
}

func TestTxExecutorPreparePoolFail(t *testing.T) {
Expand Down
Loading