I used tikvTxn to write the key-value data into TiKV directly and skip the TiDB.
db, err := driver.Open("tikv://127.0.0.1:2379?disableGC=true")
txn, _:= db.Begin()
txn.set(key, value)
txn.commit(context.Background())
...
I can't clean the data in TiKV by drop the tables in TiDB.
How can I delete all the data that I inserted to TiKV?
To delete the data inserted via txnkv API, you can:
Txnkv is based on MVCC, so
Delete
will not reclaim disk space. Instead, it inserts a special version which indicates the key has been deleted.If there is a TiDB in your cluster, and it enables GC, then the key will be deleted physically and automatically after a GC interval.
Otherwise you need to run GC job to delete it from disk.