Repository: pingcap/tidb (Go)

Issue:
query got tikv error "other error: [components/tidb_query_expr/src/types/expr_builder.rs:74]: Unsupported expression type MysqlEnum"
## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
``` SQL
CREATE TABLE `3d4cb6ef-0f1d-4251-8bfa-597151b12faf` (
  `4f7b3506-819c-4d2a-b9f7-83d435afcbfa` smallint(6) NOT NULL DEFAULT '-5122',
  `ed811e32-79ef-407f-b0aa-c26cfab07039` decimal(31,5) NOT NULL DEFAULT '-58273067513829223182570619.25537',
  PRIMARY KEY (`4f7b3506-819c-4d2a-b9f7-83d435afcbfa`,`ed811e32-79ef-407f-b0aa-c26cfab07039`) /*T![clustered_index] CLUSTERED */
);

CREATE TABLE `19034a25-1533-4252-8b25-abbdd6969f26` (
  `2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8` mediumint(9) NOT NULL DEFAULT '-4139846',
  `1593583d-41c7-4143-b6a3-ccd5220fad20` enum('j50s','8','4a3yi','kv','lf5b','j','ky76i','q','el','xy','9') DEFAULT 'q',
  `ba579924-abe2-42b3-8f78-b3aad6369dfc` enum('n0pr','u7x','qt','0msar','zrr4','b2b3n','t','xv6','rnw','7cqno','x3elq') DEFAULT 'b2b3n',
  `279ef64e-beab-41cf-acac-998f925c1da1` timestamp DEFAULT '2014-09-29 07:13:02',
  `f4e3f70d-6654-43bd-8ac4-9249ea076743` enum('c','3','he','p2','pww','ux9ib','xk1fg','ws1n','mgiz1','2','j8vj') NOT NULL DEFAULT 'pww',
  `4f52ced6-03a4-48d5-a875-899e78069dc9` decimal(45,23) DEFAULT '7130795821065799090555.21999951481601315693236',
  `4f06def2-7f89-4fab-9567-fa29aa828993` year(4) DEFAULT '1968',
  PRIMARY KEY (`f4e3f70d-6654-43bd-8ac4-9249ea076743`,`2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8`) /*T![clustered_index] CLUSTERED */,
  KEY `6abfc501-2a14-40ce-ac53-20b10798b194` (`f4e3f70d-6654-43bd-8ac4-9249ea076743`),
  KEY `0350a244-83ba-4377-9045-a0a9c1483346` (`4f52ced6-03a4-48d5-a875-899e78069dc9`),
  KEY `b972c93b-78c6-42f1-9f30-2b139429b36d` (`f4e3f70d-6654-43bd-8ac4-9249ea076743`,`2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8`,`4f52ced6-03a4-48d5-a875-899e78069dc9`,`1593583d-41c7-4143-b6a3-ccd5220fad20`,`279ef64e-beab-41cf-acac-998f925c1da1`),
  UNIQUE KEY `f981fc15-052a-49e7-9ae7-4c9904e80379` (`f4e3f70d-6654-43bd-8ac4-9249ea076743`,`279ef64e-beab-41cf-acac-998f925c1da1`,`2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8`)
) ENGINE=InnoDB DEFAULT CHARSET=ascii COLLATE=ascii_bin COMMENT='f5d35eed-b7c8-4acc-a3dc-cfdb3c70f576'
PARTITION BY HASH (`2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8`) PARTITIONS 6;

INSERT INTO `19034a25-1533-4252-8b25-abbdd6969f26` VALUES (-7186257,'ky76i','u7x','1985-07-19 16:00:00','p2',62465.40000000000000000000000,1973),(5449941,'el','zrr4','1993-11-18 16:00:00','ws1n',46929.20000000000000000000000,2006),(-4139846,'el','t','2025-06-27 16:00:00','',7130795821065799090555.21999951481601315693236,1996),(4562822,'lf5b','b2b3n','2016-04-15 16:00:00','ux9ib',55415.20000000000000000000000,2021),(4841120,'q','b2b3n','2025-06-27 16:00:00','2',7130795821065799090555.21999951481601315693236,1968),(-209341,'el','t','2025-06-27 16:00:00','',0.09000000000000000000000,1982),(-1047955,'el','t','2025-06-27 16:00:00','c',0.50000000000000000000000,1983),(-7984447,'el','t','1979-10-23 16:00:00','xk1fg',2.30600000000000000000000,2011),(3699259,'j50s','n0pr','1979-12-09 16:00:00','xk1fg',367.70340000000000000000000,2028),(-7625501,'8','t','2030-01-05 16:00:00','c',12864.00000000000000000000000,2025),(-2982875,'lf5b','t','1981-04-02 16:00:00','c',42.00000000000000000000000,2000),(2030843,'xy',NULL,'2013-07-08 16:00:00','he',3446.40000000000000000000000,2004),(7599611,'el','t','2025-06-27 16:00:00','ws1n',7130795821065799090555.21999951481601315693236,1968);

INSERT INTO `3d4cb6ef-0f1d-4251-8bfa-597151b12faf` VALUES (-26167,-71962604850603508117163388.41295),(-20311,35958677810997277612112850.64947),(-10584,7.04220),(-10584,903981.60700),(-10584,96361735411871213251545173.82569),(-5122,68904.10000),(5999,7.04220),(29452,7.04220);

select  field( `19034a25-1533-4252-8b25-abbdd6969f26`.`279ef64e-beab-41cf-acac-998f925c1da1` , `19034a25-1533-4252-8b25-abbdd6969f26`.`279ef64e-beab-41cf-acac-998f925c1da1` , `19034a25-1533-4252-8b25-abbdd6969f26`.`2285ff2b-896f-4dfe-a7d5-b7f7fd7a8bc8` )
as r0 from `19034a25-1533-4252-8b25-abbdd6969f26` where not( `19034a25-1533-4252-8b25-abbdd6969f26`.`f4e3f70d-6654-43bd-8ac4-9249ea076743` in ( select `ed811e32-79ef-407f-b0aa-c26cfab07039` from `3d4cb6ef-0f1d-4251-8bfa-597151b12faf` where `19034a25-1533-4252-8b25-abbdd6969f26`.`1593583d-41c7-4143-b6a3-ccd5220fad20` in ( select `ed811e32-79ef-407f-b0aa-c26cfab07039` from `3d4cb6ef-0f1d-4251-8bfa-597151b12faf` where `19034a25-1533-4252-8b25-abbdd6969f26`.`ba579924-abe2-42b3-8f78-b3aad6369dfc` >= 'qt' and not( `19034a25-1533-4252-8b25-abbdd6969f26`.`ba579924-abe2-42b3-8f78-b3aad6369dfc` <> 'u7x' ) ) and not( `19034a25-1533-4252-8b25-abbdd6969f26`.`f4e3f70d-6654-43bd-8ac4-9249ea076743` between 'mgiz1' and 'ws1n' ) ) );
```

<!-- a step by step guide for reproducing the bug. -->

### 2. What did you expect to see? (Required)
No error 
### 3. What did you see instead (Required)
other error: [components/tidb_query_expr/src/types/expr_builder.rs:74]: Unsupported expression type MysqlEnum
### 4. What is your TiDB version? (Required)
master
<!-- Paste the output of SELECT tidb_version() -->





Fix (patch):
diff --git a/domain/domain.go b/domain/domain.go
index f0e99c0e73b91..d2070a6e5d6b3 100644
--- a/domain/domain.go
+++ b/domain/domain.go
@@ -576,6 +576,7 @@ func (do *Domain) Close() {
 	if do.etcdClient != nil {
 		terror.Log(errors.Trace(do.etcdClient.Close()))
 	}
+
 	do.sysSessionPool.Close()
 	do.slowQuery.Close()
 	do.wg.Wait()
@@ -885,6 +886,7 @@ func (do *Domain) handleEvolvePlanTasksLoop(ctx sessionctx.Context) {
 		for {
 			select {
 			case <-do.exit:
+				owner.Cancel()
 				return
 			case <-time.After(bindinfo.Lease):
 			}
@@ -1023,6 +1025,7 @@ func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager)
 		select {
 		case <-do.exit:
 			statsHandle.FlushStats()
+			owner.Cancel()
 			return
 			// This channel is sent only by ddl owner.
 		case t := <-statsHandle.DDLEventCh():
diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go
index 55ed70d573aa9..3f1bbcbf980d7 100644
--- a/store/tikv/2pc.go
+++ b/store/tikv/2pc.go
@@ -764,7 +764,7 @@ func (action actionPessimisticLock) handleSingleBatch(c *twoPhaseCommitter, bo *
 			} else {
 				// the lockWaitTime is set, we should return wait timeout if we are still blocked by a lock
 				if time.Since(lockWaitStartTime).Milliseconds() >= action.LockWaitTime {
-					return ErrLockWaitTimeout
+					return errors.Trace(ErrLockWaitTimeout)
 				}
 			}
 			atomic.StoreInt32(&action.LockCtx.PessimisticLockWaited, 1)
@@ -778,7 +778,7 @@ func (action actionPessimisticLock) handleSingleBatch(c *twoPhaseCommitter, bo *
 			// actionPessimisticLock runs on each region parallelly, we have to consider that
 			// the error may be dropped.
 			if atomic.LoadUint32(action.Killed) == 1 {
-				return ErrQueryInterrupted
+				return errors.Trace(ErrQueryInterrupted)
 			}
 		}
 	}