Issues Related to TiDB Code Debugging

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关于tidb代码调试的问题

| username: liul

Currently, I want to see how k-v is generated. I have seen the key generation for table creation using EncodeTablePrefix, but I want to see how the rowkey is generated when inserting records. I added a breakpoint at EncodeRowKey, but for some reason, after adding the breakpoint at this function, it keeps jumping to this breakpoint.

I would like to ask, is it possible that my breakpoint for rowkey generation is incorrect?

Additionally, I want to trace the generation of k-v (tablekey-v, rowkey-v, and indexkey-v). Do you have any suggestions on where to add breakpoints or any other advice?

| username: zhanggame1 | Original post link

Adding logs is also fine.

| username: liul | Original post link

For example, regarding rowid, if you add a breakpoint in EncodeRowKey, it will keep being called and won’t stop. Will adding logs also result in continuous printing?
Secondly, how do you add logs? Is there any related documentation? Thank you.

| username: onlyacat | Original post link

Turn off TiDB’s internal SQL.