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

TSO retrieval failure during read TS validation caused by residual txn-scope code #59402

Closed
ekexium opened this issue Feb 11, 2025 · 1 comment
Assignees
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug. type/regression

Comments

@ekexium
Copy link
Member

ekexium commented Feb 11, 2025

Bug Report

Please answer these questions before submitting your issue. Thanks!

Related to #58838

1. Minimal reproduce step (Required)

It can be triggered by either stale read or tidb_replica_read=closest-replicas, but not for closest-adaptive.

func TestTxnScopeAndValidateReadTs(t *testing.T) {
	defer config.RestoreFunc()()
	config.UpdateGlobal(func(conf *config.Config) {
		conf.Labels = map[string]string{
			"zone": "bj",
		}
	})

	store := realtikvtest.CreateMockStoreAndSetup(t)
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("use test")
	tk.MustExec("create table t1 (id int primary key);")
	time.Sleep(time.Second)

	// stale read will fail
	//tk.MustQuery("select * from t1 AS OF TIMESTAMP NOW() where id = 1;").Check(testkit.Rows())

	// replica read
	// fail
	//tk.MustExec("set @@tidb_replica_read = 'closest-replicas';")

	// succeed
	//tk.MustExec("set @@tidb_replica_read = 'follower';")

	// succeed, because of https://github.com/pingcap/tidb/blob/f684d41f3e9e17777f6e19e2f9852457eed00ca6/pkg/sessiontxn/isolation/base.go#L178
	//tk.MustExec("set @@tidb_replica_read = 'closest-adaptive';")
	
	tk.MustExec("begin")
	tk.MustQuery("select * from t1 where id = 1;").Check(testkit.Rows())
}

2. What did you expect to see? (Required)

Test passes.

3. What did you see instead (Required)

error:

fail to validate read timestamp: [PD:client:ErrClientGetTSO]get TSO failed, unknown dc-location bj to the client

4. What is your TiDB version? (Required)

LTS versions in [v6.5, v8.5] which has picked tikv/client-go#1513, for example v8.5.1

@ekexium ekexium added type/bug The issue is confirmed as a bug. severity/major labels Feb 11, 2025
@ekexium ekexium self-assigned this Feb 11, 2025
@ekexium ekexium added affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. labels Feb 11, 2025
@ekexium ekexium removed type/bug The issue is confirmed as a bug. severity/major may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. labels Feb 11, 2025
@ekexium
Copy link
Member Author

ekexium commented Feb 20, 2025

Closing as it does not appear in the master branch

@ekexium ekexium closed this as completed Feb 20, 2025
ti-chi-bot bot pushed a commit to tikv/client-go that referenced this issue Feb 25, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>
ti-chi-bot bot pushed a commit to tikv/client-go that referenced this issue Feb 25, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>
ekexium added a commit to ekexium/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>
ekexium added a commit to ekexium/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>

fix test

Signed-off-by: ekexium <eke@fastmail.com>
ekexium added a commit to ekexium/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>

fix test

Signed-off-by: ekexium <eke@fastmail.com>
ekexium added a commit to ekexium/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>

fix test

Signed-off-by: ekexium <eke@fastmail.com>
ekexium added a commit to ekexium/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>

fix test

Signed-off-by: ekexium <eke@fastmail.com>
ti-chi-bot bot pushed a commit to tikv/client-go that referenced this issue Feb 26, 2025
ref pingcap/tidb#59402

Signed-off-by: ekexium <eke@fastmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug. type/regression
Projects
None yet
Development

No branches or pull requests

2 participants