Skip to content

Commit 75ffd9e

Browse files
committed
add another alternative and compability issue
Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
1 parent d91583d commit 75ffd9e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

text/0095-add-latest-cf.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ But using latest cf should be triggered explicitly by client. Client should ensu
5555

5656
Take TiDB as an example, it can add a new storage format at table level. Perhaps even add a new DDL job for table to changing the storage format. In the new format, latest cf is always updated. And only trigger TiKV to use latest cf when the target table is fully upgraded to the new format.
5757

58+
As a new cf is added, it needs to be also included in the raft snapshot between replicas.
59+
5860
### Why use a new cf?
5961

6062
If the latest keys are written to write cf instead, then it will break compatibility. It also makes range scan less efficient as more version need to be scanned and skipped.
@@ -69,4 +71,10 @@ On the other hand, the additional write is just a key in a different cf and a va
6971

7072
unistore separates the latest version and other versions by adjust file format. So when flushing or compacting, it will make latest versions key be the first part, and the rest in the second part. This approach doesn't have write overhead, but is not backward compatible in TiKV.
7173

74+
Another proposal has also been discussed in the past that instead of adding latest cf, adding a history cf to store as many as versions. All keys are written to write cf first, and then using compaction filter to move all versions except the latest to history cf. This approach delay the additional writes to background job, so may have less impact on the foreground writes. But it has following shortcomings:
75+
- compaction filter is not reliable. The timing it's triggered can be tricky. We have observed issue that introduced by compaction not in time. tikv/tikv#12729.
76+
- compaction filter only works on SST files, versions in memory are still mixed.
77+
- point get still requires seek unless we switch to user timestamp completely, which is not used in production yet.
78+
- If we remove KV WAL completely, writing in compaction can be expensive as it needs to be either ingested as new SST or triggers flush, otherwise restarting TiKV may lose data.
79+
7280
## Unresolved questions

0 commit comments

Comments
 (0)