Skip to content

Commit

Permalink
*: rollup of in-memory engine commits (#17152)
Browse files Browse the repository at this point in the history
* build: bump tikv pkg version (#17063)

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* resolved_ts: refactor log for the unexpected path (#17064) (#17068)

ref #16818

Refactor logs for the unexpected path, print both the exsiting row and input key/value.

Signed-off-by: cfzjywxk <lsswxrxr@163.com>

Co-authored-by: cfzjywxk <lsswxrxr@163.com>

* chore: add prow OWNERS files for critial configuration files (#17071) (#17108)

close #17004

Signed-off-by: wuhuizuo <wuhuizuo@126.com>

Co-authored-by: wuhuizuo <wuhuizuo@126.com>

* OWNERS: Auto Sync OWNERS files from community membership (#16973) (#17120)

 

Signed-off-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Signed-off-by: Jinpeng Zhang <zzzhangjinpeng@gmail.com>

Co-authored-by: Jinpeng Zhang <zzzhangjinpeng@gmail.com>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>

* In-memory engine: strip off read related code from engine.rs to a separte file (#16792)

ref #16141

strip off read related code from engine.rs to a separte file

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: collector iteration related metrics (#16735)

ref #16141

collector iteration related metrics

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: expose range cache engine configuration (#16791)

ref #16141

expose range cache engine configuration

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: do not load a range overlapped with an unresolved range (#16794)

ref #16141

do not load a range overlapped with an unresolved range

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* server/node: rename Node to MultiRaftServer (#16783)

close #16782

Signed-off-by: zhangjinpeng87 <zzzhangjinpeng@gmail.com>
Signed-off-by: Jinpeng Zhang <zzzhangjinpeng@gmail.com>

Co-authored-by: lucasliang <nkcs_lykx@hotmail.com>

* In-memory engine: add metrics for memory usage (#16822)

ref #16141

add metrics for memory usage

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: Jinpeng Zhang <zzzhangjinpeng@gmail.com>

* In-memory engine: add metrics for gc duration, range load duration, and write duration (#16831)

ref #16141

add metrics for gc duration, range load duration, and write duration

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: delete lock physically rather than writting tombstone (#16852)

ref #16141

delete lock physically rather than writting tombstone

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: fix missing memory record when snapshot loading (#16850)

ref #16141

fix missing memory record when snapshot loading

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-Memory Engine: add a tag to the range for easier troubleshooting (#16816)

ref #16141

In-Memory Engine: add a tag into Range for diagnostics

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>

Co-authored-by: SpadeA-Tang <u6748471@anu.edu.au>
Co-authored-by: Qi Xu <tonyxuqqi@outlook.com>

* In-memory engine: remove out of date pending ranges (#16872)

ref #16141

remove out of date pending ranges

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* compile memory-engine by default and support dynamic config update for memory-engine (#16897)

ref #16141

compile the in-memory-engine by default and support dynamic config update for memory-engine.
The enabled flag would support enabled:true -> enabled:false and soft/hard limit also supports online change. 
But if enabled:false is set initially, the config change to make enabled:true needs the TiKV restart.

Signed-off-by: tonyxuqqi <tonyxuqi@outlook.com>

* In-memory engine: skiplist tombstone should be handled separetely in gc (#16944)

ref #16141

skiplist tombstone should be handled separetely in gc

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: manually implement partial_eq for CacheRange to avoid the consideration of tag (#16959)

ref #16141

manually implement partial_eq for CacheRange to avoid the consideration of tag

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: tonyxuqqi <tonyxuqi@outlook.com>

* In-memory engine: implement core local array and collect read flow statistics (#16945)

ref #16141

implement core local array and collect read flow statistics

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: fix seek does not set self.valid properly (#16991)

ref #16141

fix seek does not set self.valid properly

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: add metrics for different types of iteration operations (#16997)

ref #16141

add metrics for different types of iteration operations

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: add metrics for range count (#16971)

ref #16141

add metrics for range count

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
Signed-off-by: Spade  A <71589810+SpadeA-Tang@users.noreply.github.com>

Co-authored-by: lucasliang <nkcs_lykx@hotmail.com>

* In-memory engine: fix gc worker not used (#17032)

ref #16141

fix gc worker not used

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* raftstore: fix online config change panic for periodic-full-compact-start-time (#17069)

close #17066

fix online config change panic for periodic-full-compact-start-time

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* config: test +HHMM offset in ReadableSchedule (#17081)

close #17080

* Test both formats +HHMM offsets and as well as +HH:MM for ReadableSchedule.

Signed-off-by: Alex Feinberg <alex@strlen.net>

* In-memory engine: mvcc keys with different sequence number should only be handled once in GC (#17083)

ref #16141, close #17060

mvcc keys with different sequen number should only be handled once in GC

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
Signed-off-by: Spade  A <71589810+SpadeA-Tang@users.noreply.github.com>

Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: lucasliang <nkcs_lykx@hotmail.com>

* In-memory engine: enable compaction filter for HybridEngine (#17087)

ref #16141, close #17086

enable compaction filter for HybridEngine

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory Engine: sequence number should be increased for each key (#17122)

ref #16141, close #17114

sequence number should be increased for each key

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: support changing the direction of iteration (#17129)

ref #16141, close #17079

support reverse direction when iterating

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: clean lock cf tombstone in a background worker (#17128)

ref #16141, close #17127

clean lock cf tombstone in a background worker

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory Engine: encode internal key trailer in little endian. (#17125)

close #17082

An internal key trailer is `(sequence_number << 8) | value_type as u64`
and it should be encoded in little endian to be consistent with RocksDB.

Signed-off-by: Neil Shen <overvenus@gmail.com>

* In-memory engine: set boundries when gc (#17145)

ref #16141, close #17143

set boundries when gc

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: encode key for lock cf without mvcc version in delete range (#17142)

ref #16141, close #17140

encode key for lock cf without mvcc version in delete range

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory Engine: get GC safe_point from PD (#17144)

close #17123

The `safe_point` is used to check if a cache is eligible to serve a read request.
If the `safe_point` drifts into the future, for example by 10 minutes, the cache
will not be able to serve any requests for those 10 minutes.

This commit fixes such issue by getting the `safe_point` from PD.

Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-Memory Engine: Eviction, Algorithmic loading (#17023)

ref #16141, ref #16764

In-Memory Engine: Algorithmic Load and Eviction

Signed-off-by: Alex Feinberg <alex@strlen.net>

* In-memory engine: consider range overlaps when eviction (#17137)

ref #16141, close #17131

consider range overlaps when eviction

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: support delete range (#17151)

ref #16141

support delete range

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: evict range should consider loading range (#17154)

close #17153

evict range should consider loading range

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: clear write batch when range load failed (#17156)

ref #16141, close #17103

clear write batch when range load failed

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: fix concurrency issue between delete range and write to memory (#17149)

close #17104

fix concurrency issue between delete range and write to memory

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: add seek duration metrics (#17160)

ref #16141

add seek duration metrics

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: add metrics for prepare for write duration (#17161)

ref #16141

add metrics for prepare for write duration

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: set disk engine when start (#17165)

ref #16141

set disk engine when start

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

* In-memory engine: avoid using snapshot cache (#16863)

ref #16141

avoid using snapshot cache

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: evict range after some raft commands (#17159)

ref #16141

evict range when becomeing follower, merge, and deleting data ranges.

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* In-memory engine: `filter` plus one when any key is removed during GC (#17171)

ref #16141

filter plus one when any key is removed during GC

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
Signed-off-by: Spade  A <71589810+SpadeA-Tang@users.noreply.github.com>

* periodic reload

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* avoid mem negative

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* make period of reload config

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* add overhead for delte entry size

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>

* Fix missing field reload_period

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Fix get_regions_in_range and BackgroundWorker compile

Signed-off-by: Neil Shen <overvenus@gmail.com>

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
Signed-off-by: tonyxuqqi <tonyxuqi@outlook.com>
Signed-off-by: Alex Feinberg <alex@strlen.net>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Spade  A <71589810+SpadeA-Tang@users.noreply.github.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Co-authored-by: cfzjywxk <lsswxrxr@163.com>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>
Co-authored-by: Jinpeng Zhang <zzzhangjinpeng@gmail.com>
Co-authored-by: Spade  A <71589810+SpadeA-Tang@users.noreply.github.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Co-authored-by: lucasliang <nkcs_lykx@hotmail.com>
Co-authored-by: tonyxuqqi <tonyxuqi@outlook.com>
Co-authored-by: SpadeA-Tang <u6748471@anu.edu.au>
Co-authored-by: Qi Xu <tonyxuqqi@outlook.com>
Co-authored-by: Alex Feinberg <alex@strlen.net>
  • Loading branch information
12 people committed Jun 21, 2024
1 parent ba73b0d commit c57aef1
Show file tree
Hide file tree
Showing 107 changed files with 10,506 additions and 3,084 deletions.
31 changes: 20 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tikv"
version = "8.1.0"
version = "8.1.1"
authors = ["The TiKV Authors"]
description = "A distributed transactional key-value database powered by Rust and Raft"
license = "Apache-2.0"
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
SHELL := bash
ENABLE_FEATURES ?=

ENABLE_FEATURES += memory-engine

# Frame pointer is enabled by default. The purpose is to provide stable and
# reliable stack backtraces (for CPU Profiling).
#
Expand Down
76 changes: 76 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- 5kbpers
- AndreMouche
- andylokandy
- breezewish
- brson
- bufferflies
- BusyJay
- cfzjywxk
- Connor1996
- coocood
- disksing
- ekexium
- gengliqi
- glorv
- hicqu
- hunterlxt
- imtbkcat
- innerr
- iosmanthus
- jackysp
- kennytm
- Little-Wallace
- liuzix
- lonng
- LykxSassinator
- lysu
- marsishandsome
- MyonKeminta
- niedhui
- NingLin-P
- nrc
- overvenus
- pingyu
- skyzh
- SpadeA-Tang
- sticnarf
- sunxiaoguang
- tabokie
- TennyZhuang
- tonyxuqqi
- yiwu-arbug
- you06
- youjiali1995
- YuJuncen
- zhangjinpeng87
- zhongzc
- zhouqiang-cl
reviewers:
- 3pointer
- CalvinNeo
- ethercflow
- fredchenbj
- Fullstop000
- gozssky
- haojinming
- hi-rustin
- HuSharp
- jayzhan211
- Jibbow
- JmPotato
- Leavrth
- lhy1024
- longfangsong
- lzmhhh123
- Mossaka
- MrCroxx
- nolouch
- rleungx
- tier-cap
- v01dstar
- wjhuang2016
- wshwsh12
- Xuanwo
- zyguan
13 changes: 13 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sort the member alphabetically.
aliases:
sig-critical-approvers-config-components:
- easonn7
- kevin-xianliu
- zhangjinpeng87
sig-critical-approvers-config-src:
- easonn7
- kevin-xianliu
- cfzjywxk
sig-critical-approvers-config-cdc:
- BenMeadowcroft
- kevin-xianliu
7 changes: 7 additions & 0 deletions components/batch-system/src/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs at https://go.k8s.io/owners
options:
no_parent_owners: true
filters:
"(OWNERS|config\\.rs)$":
approvers:
- sig-critical-approvers-config-components
7 changes: 7 additions & 0 deletions components/cdc/src/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs at https://go.k8s.io/owners
options:
no_parent_owners: true
filters:
"(OWNERS|config\\.rs)$":
approvers:
- sig-critical-approvers-config-cdc
7 changes: 7 additions & 0 deletions components/encryption/src/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs at https://go.k8s.io/owners
options:
no_parent_owners: true
filters:
"(OWNERS|config\\.rs)$":
approvers:
- sig-critical-approvers-config-components
23 changes: 21 additions & 2 deletions components/engine_panic/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.

use engine_traits::{
IterOptions, Iterable, Iterator, KvEngine, Peekable, ReadOptions, Result, SnapshotContext,
SyncMutable, WriteOptions,
IterMetricsCollector, IterOptions, Iterable, Iterator, KvEngine, MetricsExt, Peekable,
ReadOptions, Result, SnapshotContext, SyncMutable, WriteOptions,
};

use crate::{db_vector::PanicDbVector, snapshot::PanicSnapshot, write_batch::PanicWriteBatch};
Expand Down Expand Up @@ -110,3 +110,22 @@ impl Iterator for PanicEngineIterator {
panic!()
}
}

pub struct PanicEngineIterMetricsCollector;

impl IterMetricsCollector for PanicEngineIterMetricsCollector {
fn internal_delete_skipped_count(&self) -> u64 {
panic!()
}

fn internal_key_skipped_count(&self) -> u64 {
panic!()
}
}

impl MetricsExt for PanicEngineIterator {
type Collector = PanicEngineIterMetricsCollector;
fn metrics_collector(&self) -> Self::Collector {
panic!()
}
}
1 change: 1 addition & 0 deletions components/engine_panic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ pub use crate::flow_control_factors::*;
pub mod table_properties;
pub use crate::table_properties::*;
pub mod checkpoint;
pub mod range_cache_engine;

mod raft_engine;
15 changes: 15 additions & 0 deletions components/engine_panic/src/range_cache_engine.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2024 TiKV Project Authors. Licensed under Apache-2.0.

use engine_traits::RangeCacheEngineExt;

use crate::PanicEngine;

impl RangeCacheEngineExt for PanicEngine {
fn range_cache_engine_enabled(&self) -> bool {
panic!()
}

fn evict_range(&self, range: &engine_traits::CacheRange) {
panic!()
}
}
23 changes: 21 additions & 2 deletions components/engine_panic/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use std::ops::Deref;

use engine_traits::{
CfNamesExt, IterOptions, Iterable, Iterator, Peekable, ReadOptions, Result, Snapshot,
SnapshotMiscExt,
CfNamesExt, IterMetricsCollector, IterOptions, Iterable, Iterator, MetricsExt, Peekable,
ReadOptions, Result, Snapshot, SnapshotMiscExt,
};

use crate::{db_vector::PanicDbVector, engine::PanicEngine};
Expand Down Expand Up @@ -87,3 +87,22 @@ impl SnapshotMiscExt for PanicSnapshot {
panic!()
}
}

pub struct PanicSnapshotIterMetricsCollector;

impl IterMetricsCollector for PanicSnapshotIterMetricsCollector {
fn internal_delete_skipped_count(&self) -> u64 {
panic!()
}

fn internal_key_skipped_count(&self) -> u64 {
panic!()
}
}

impl MetricsExt for PanicSnapshotIterator {
type Collector = PanicSnapshotIterMetricsCollector;
fn metrics_collector(&self) -> Self::Collector {
panic!()
}
}
23 changes: 21 additions & 2 deletions components/engine_rocks/src/engine_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use std::sync::Arc;

use engine_traits::{self, Result};
use rocksdb::{DBIterator, DB};
use engine_traits::{self, IterMetricsCollector, MetricsExt, Result};
use rocksdb::{DBIterator, PerfContext, DB};

use crate::r2e;

Expand All @@ -21,6 +21,25 @@ impl RocksEngineIterator {
}
}

pub struct RocksIterMetricsCollector;

impl IterMetricsCollector for RocksIterMetricsCollector {
fn internal_delete_skipped_count(&self) -> u64 {
PerfContext::get().internal_delete_skipped_count()
}

fn internal_key_skipped_count(&self) -> u64 {
PerfContext::get().internal_key_skipped_count()
}
}

impl MetricsExt for RocksEngineIterator {
type Collector = RocksIterMetricsCollector;
fn metrics_collector(&self) -> Self::Collector {
RocksIterMetricsCollector {}
}
}

impl engine_traits::Iterator for RocksEngineIterator {
fn seek(&mut self, key: &[u8]) -> Result<bool> {
self.0.seek(rocksdb::SeekKey::Key(key)).map_err(r2e)
Expand Down
1 change: 1 addition & 0 deletions components/engine_rocks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mod logger;
pub use crate::logger::*;
mod misc;
pub use crate::misc::*;
pub mod range_cache_engine;
pub mod range_properties;
mod snapshot;
pub use crate::snapshot::*;
Expand Down
14 changes: 14 additions & 0 deletions components/engine_rocks/src/range_cache_engine.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2024 TiKV Project Authors. Licensed under Apache-2.0.

use engine_traits::RangeCacheEngineExt;

use crate::RocksEngine;

impl RangeCacheEngineExt for RocksEngine {
fn range_cache_engine_enabled(&self) -> bool {
false
}

#[inline]
fn evict_range(&self, _: &engine_traits::CacheRange) {}
}
1 change: 1 addition & 0 deletions components/engine_traits/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub trait KvEngine:
+ Debug
+ Unpin
+ Checkpointable
+ RangeCacheEngineExt
+ 'static
{
/// A consistent read-only snapshot of the database
Expand Down
Loading

0 comments on commit c57aef1

Please sign in to comment.