Skip to content

Commit 6a0a832

Browse files
committed
Switch jemalloc to mimalloc; refactor classifier & cleanup
Replace the optional tikv-jemallocator with mimalloc and add rmp-serde as a dependency. Update imports and usages to the new kalamdb_sql::classifier module (previously statement_classifier) across executor, handlers, and tests. Remove multiple legacy compatibility shims and fallbacks: deprecated auth rbac/roles shims, legacy ID storage-key parsing paths, legacy system schema constants and system_table partitions, and older conversion aliases (encode_pk_value). Simplify filestore re-exports, remove legacy environment-variable fallbacks from server config overrides, and adjust raft codec serialization by splitting envelope types for encode/decode. Miscellaneous comment/test updates and cleanup to align the codebase with the new allocator and serialization choices.
1 parent a638f17 commit 6a0a832

89 files changed

Lines changed: 1702 additions & 655 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 41 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ criterion = { version = "0.8.2", features = ["html_reports"] }
133133

134134
# Raft consensus
135135
openraft = { version = "0.9.21", features = ["serde"] }
136+
rmp-serde = "1.3"
136137

137138
# gRPC for Raft network layer
138139
tonic = { version = "0.14.5" }

backend/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build = "build.rs"
1010

1111
[dependencies]
1212
# Memory optimization
13-
tikv-jemallocator = { version = "0.6.1", optional = true }
13+
mimalloc = { version = "0.1", default-features = false, optional = true }
1414

1515
# Core library
1616
kalamdb-core = { path = "crates/kalamdb-core" }
@@ -81,8 +81,8 @@ num_cpus = { workspace = true }
8181
libc = { workspace = true }
8282

8383
[features]
84-
default = ["embedded-ui", "jemalloc"]
85-
jemalloc = ["tikv-jemallocator"]
84+
default = ["embedded-ui", "mimalloc"]
85+
mimalloc = ["dep:mimalloc"]
8686
embedded-ui = ["kalamdb-api/embedded-ui"]
8787
otel = ["dep:tracing-opentelemetry", "dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-otlp"]
8888
# End-to-end tests that require a full test server instance

backend/crates/kalamdb-api/src/handlers/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub mod sql;
2828
pub mod topics;
2929
pub mod ws;
3030

31-
// Re-export for backwards compatibility and convenient access
31+
// Re-export for convenient access
3232
pub use auth::{
3333
login_handler, logout_handler, me_handler, refresh_handler, server_setup_handler,
3434
setup_status_handler,

backend/crates/kalamdb-api/src/handlers/sql/execute.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ fn classify_sql(
239239
default_namespace: &NamespaceId,
240240
exec_ctx: &ExecutionContext,
241241
start_time: Instant,
242-
) -> Result<kalamdb_sql::statement_classifier::SqlStatement, HttpResponse> {
243-
kalamdb_sql::statement_classifier::SqlStatement::classify_and_parse(
242+
) -> Result<kalamdb_sql::classifier::SqlStatement, HttpResponse> {
243+
kalamdb_sql::classifier::SqlStatement::classify_and_parse(
244244
sql,
245245
default_namespace,
246246
exec_ctx.user_role(),

backend/crates/kalamdb-api/src/handlers/sql/forward.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ pub async fn forward_sql_if_follower(
181181
let has_write = statements.iter().any(|sql| {
182182
let classify_sql =
183183
kalamdb_sql::execute_as::extract_inner_sql(sql).unwrap_or_else(|| sql.to_string());
184-
let stmt = kalamdb_sql::statement_classifier::SqlStatement::classify_and_parse(
184+
let stmt = kalamdb_sql::classifier::SqlStatement::classify_and_parse(
185185
&classify_sql,
186186
default_namespace,
187187
Role::System,
188188
)
189189
.unwrap_or_else(|_| {
190-
kalamdb_sql::statement_classifier::SqlStatement::new(
190+
kalamdb_sql::classifier::SqlStatement::new(
191191
classify_sql,
192-
kalamdb_sql::statement_classifier::SqlStatementKind::Unknown,
192+
kalamdb_sql::classifier::SqlStatementKind::Unknown,
193193
)
194194
});
195195
stmt.is_write_operation()
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
pub mod rbac;
2-
pub mod roles;
31
pub use kalamdb_session::permissions;

backend/crates/kalamdb-auth/src/authorization/rbac.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

backend/crates/kalamdb-auth/src/authorization/roles.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

backend/crates/kalamdb-commons/src/constants.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,3 @@ pub const RESERVED_NAMESPACE_NAMES: &[&str] = &[
114114
"pg_catalog",
115115
"datafusion",
116116
];
117-
118-
/// Legacy system schema version constants.
119-
///
120-
/// System schema lifecycle now reconciles through `system.schemas` at startup
121-
/// (`SchemaRegistry::initialize_tables()`), so this key/version pair is kept
122-
/// only for backward compatibility during transition.
123-
pub const SYSTEM_SCHEMA_VERSION: u32 = 1;
124-
125-
/// Legacy RocksDB key for system schema version in default column family.
126-
pub const SYSTEM_SCHEMA_VERSION_KEY: &str = "system:schema_version";

0 commit comments

Comments
 (0)