Open seiya-annie opened 2 years ago
This is caused by the json.Marshall
function in the lock view, not the get_lock function. Here is a quick patch to demonstrate:
diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go
index 8131402ab..d9e39bbc7 100644
--- a/executor/infoschema_reader.go
+++ b/executor/infoschema_reader.go
@@ -2391,6 +2391,7 @@ func (r *dataLockWaitsTableRetriever) retrieve(ctx context.Context, sctx session
} else {
decodedKeyStr = string(decodedKeyBytes)
}
+ fmt.Printf("#### decodedKey: %#v, decodedKeyStr: %#v, \n", decodedKey, decodedKeyStr)
} else {
logutil.BgLogger().Warn("decode key failed", zap.Error(err))
}
Outputs:
#### decodedKey: keydecoder.DecodedKey{DbID:3, DbName:"mysql", TableID:67, TableName:"advisory_locks", PartitionID:0, PartitionName:"", HandleType:"", IsPartitionHandle:false, HandleValue:"", IndexID:1, IndexName:"PRIMARY", IndexValues:[]string{"!@#$%^&()_+"}}, decodedKeyStr: "{\"db_id\":3,\"db_name\":\"mysql\",\"table_id\":67,\"table_name\":\"advisory_locks\",\"index_id\":1,\"index_name\":\"PRIMARY\",\"index_values\":[\"!@#$%^\\u0026()_+\"]}",
You can see that in the non-json string, the encoding is with '&'. Because this is caused by a go library ("encoding/json"), it might be difficult to fix.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
lock name in KEY_INFO should be : "indexvalues":["!@#$%^&()+"]}
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
| Release Version: v6.1.0-alpha Edition: Community Git Commit Hash: 2c19f0a116143fd8a5cefc9dcb5f3d9c6c894372 Git Branch: heads/refs/tags/v6.1.0-alpha UTC Build Time: 2022-05-05 14:58:11 GoVersion: go1.18 Race Enabled: false TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false |