Tikv DefaultNotFound

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

Original topic: tikv DefaultNotFount

| username: wyang134

[TiDB Usage Environment] Production Testing
[TiDB Version] 7.1.1
[Reproduction Path] Operations performed that led to the issue
[Encountered Issue: Phenomenon and Impact]
client.go executes txn.Iter(key, nil)
key=[123 178 130 29 239 117 120 155 20 114 63 188 157 244 0 50 120 82 35 102]
The following error occurs:
[2023/09/05 11:16:42.202 +00:00] [ERROR] [errors.rs:435] [“txn aborts”] [err_code=KV:Storage:DefaultNotFound] [err=“Error(Txn(Error(Mvcc(Error(DefaultNotFound { key: [123, 224, 73, 224, 46, 206, 254, 46, 255, 44, 178, 227, 27, 248, 82, 10, 246, 255, 107, 148, 186, 50, 48, 48, 48, 49, 255, 46, 112, 97, 114, 116, 0, 0, 0, 252, 249, 214, 130, 65, 53, 75, 255, 197] })))))”]

tikv error log
[mod.rs:429] [“default value not found”] [hint=near_load_data_by_write] [key=xxxx]
How should this be fixed?

| username: redgame | Original post link

Are the keys used in the transaction correct? Also, are the keys passed to txn.Iter correct, and do the keys exist in the database?

| username: xfworld | Original post link

The transaction aborts and automatically rolls back, so there’s no need to handle it.

However, you need to check if the key exists.

| username: wyang134 | Original post link

The key for Iter doesn’t necessarily have to exist, right? The error I encountered above is that Iter traversed to a DefaultNotFound entry. In what kind of situation would this occur?

| username: TiDBer_vfJBUcxl | Original post link

The key of the iterator should exist

| username: wyang134 | Original post link

Why is the key I passed into Iter different from the key reported by DefaultNotFound? My goal is to find the kv with the prefix key.

| username: wyang134 | Original post link

May I ask, when using a startkey in client-go, an error occurs with txn.Iter scan, but there is no issue with tikv-ctl scan. Where could the problem be? Does the startKey for txn.Iter have to exist?