-
Notifications
You must be signed in to change notification settings - Fork 423
columnar: support late materialization #11053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ti-chi-bot
merged 21 commits into
pingcap:master
from
yongman:columnar-late-materialization
Sep 2, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f6eb96f
columnar: support late materialization
yongman 109c056
add stats for late materialization packs
yongman 778a9d2
polish code
yongman 0f3f38d
disable lm when has multiple tables in one region
yongman 9308dc5
optimize perf
yongman f82ae57
add more check before enable lm
yongman dd302e6
perf optimize
yongman 5e2cb85
polish
yongman 3e14f69
add design doc
yongman 1a5f0cb
remove skipped packs count
yongman abf6e48
Merge master branch
yongman d782cd1
bump kvproto
yongman 249c74d
format
yongman 4c6e838
checkRustStrWithView and throw exception
yongman 1ae2b21
Merge branch 'master' into columnar-late-materialization
yongman d3e5e44
add stats for lm
yongman 072d133
merge lm stats from rust
yongman dc32afd
update contrib
yongman adedceb
Merge branch master
yongman e521d5f
add gen-proxy-ffi script
yongman ad67e95
Merge branch 'master' into columnar-late-materialization
yongman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| hub_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| if [[ ! -f "${hub_dir}/Cargo.toml" ]]; then | ||
| echo "Cannot find the Hub Cargo workspace." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd "${hub_dir}" | ||
| cargo run --locked --package gen-proxy-ffi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [package] | ||
| name = "gen-proxy-ffi" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| publish = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| use std::{ | ||
| collections::hash_map::DefaultHasher, | ||
| ffi::OsStr, | ||
| fs, | ||
| hash::{Hash, Hasher}, | ||
| path::{Path, PathBuf}, | ||
| }; | ||
|
|
||
| const RAFT_STORE_PROXY_VERSION_PREFIX: &str = "RAFT_STORE_PROXY_VERSION"; | ||
|
|
||
| fn collect_headers(dir: &Path, headers: &mut Vec<PathBuf>) { | ||
| for entry in fs::read_dir(dir).expect("Couldn't read FFI directory") { | ||
| let path = entry.expect("Couldn't read FFI directory entry").path(); | ||
| if path.is_dir() { | ||
| collect_headers(&path, headers); | ||
| } else if path.extension() == Some(OsStr::new("h")) { | ||
| headers.push(path); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn ffi_version(ffi_dir: &Path) -> u64 { | ||
| let mut headers = Vec::new(); | ||
| collect_headers(ffi_dir, &mut headers); | ||
| headers.sort(); | ||
|
|
||
| let mut hasher = DefaultHasher::new(); | ||
| for header in headers { | ||
| fs::read_to_string(header) | ||
| .expect("Couldn't read FFI header") | ||
| .hash(&mut hasher); | ||
| } | ||
| hasher.finish() | ||
| } | ||
|
|
||
| fn replace_version(path: &Path, replacement: &str) { | ||
| let content = fs::read_to_string(path).expect("Couldn't read generated FFI bindings"); | ||
| assert_eq!(content.matches(RAFT_STORE_PROXY_VERSION_PREFIX).count(), 1); | ||
| let declaration = format!("pub const {}: u64 = ", RAFT_STORE_PROXY_VERSION_PREFIX); | ||
| let start = content | ||
| .find(&declaration) | ||
| .expect("Couldn't find RAFT_STORE_PROXY_VERSION"); | ||
| let end = content[start..] | ||
| .find(';') | ||
| .expect("Couldn't find RAFT_STORE_PROXY_VERSION terminator") | ||
| + start | ||
| + 1; | ||
| let mut updated = content; | ||
| updated.replace_range(start..end, replacement); | ||
| fs::write(path, updated).expect("Couldn't write generated FFI bindings"); | ||
| } | ||
|
|
||
| fn main() { | ||
| let hub_dir = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap(); | ||
| let ffi_dir = hub_dir.join("hub-runtime/ffi/src/RaftStoreProxyFFI"); | ||
| let version = ffi_version(&ffi_dir); | ||
|
|
||
| fs::write( | ||
| ffi_dir.join("@version"), | ||
| format!( | ||
| "#pragma once\n#include <cstdint>\nnamespace DB {{ constexpr uint64_t {} = {}ull; }}", | ||
| RAFT_STORE_PROXY_VERSION_PREFIX, version | ||
| ), | ||
| ) | ||
| .expect("Couldn't write FFI version header"); | ||
| // The Hub bindings include manually maintained declarations, so update only the ABI fingerprint. | ||
| replace_version( | ||
| &hub_dir.join("hub-runtime/src/interfaces.rs"), | ||
| &format!( | ||
| "pub const {}: u64 = {};", | ||
| RAFT_STORE_PROXY_VERSION_PREFIX, version | ||
| ), | ||
| ); | ||
| } |
2 changes: 1 addition & 1 deletion
2
contrib/tiflash-columnar-hub/hub-runtime/ffi/src/RaftStoreProxyFFI/@version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| #pragma once | ||
| #include <cstdint> | ||
| namespace DB { constexpr uint64_t RAFT_STORE_PROXY_VERSION = 5493270813306750334ull; } | ||
| namespace DB { constexpr uint64_t RAFT_STORE_PROXY_VERSION = 5429784359048998305ull; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.