Skip to content

Share one local and one remote DataFolder instance throughout the server - #419

Open
CGodiksen wants to merge 13 commits into
mainfrom
dev/share-data-folder
Open

Share one local and one remote DataFolder instance throughout the server#419
CGodiksen wants to merge 13 commits into
mainfrom
dev/share-data-folder

Conversation

@CGodiksen

Copy link
Copy Markdown
Collaborator

This PR closes #416 by sharing a single local data folder and a single remote data folder throughout the server by wrapping them in an Arc. While looking into if there were any problems with sharing a single DataFolder instance, a small locking inefficiency was found when opening a DeltaTable. This is also fixed in this PR. Finally, the PR also fixes some naming inconsistencies, specifically regarding arguments being named local_data_folder while actually being a path or an object store.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #416 by switching server components to share a single local DataFolder and (when configured) a single remote DataFolder instance via Arc, reducing redundant construction of the DataFolder’s cache and DataFusion session context. It also improves Delta table cache access to avoid holding a DashMap shard lock across async I/O, and cleans up a few naming inconsistencies (e.g., “folder” vs “path/object store”).

Changes:

  • Share DataFolder instances across the server using Arc<DataFolder> instead of cloning DataFolder.
  • Avoid holding a DashMap guard while awaiting DeltaTable::load() when returning cached tables.
  • Rename parameters/fields in a few places to better reflect what is being passed (paths/object stores).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/modelardb_storage/src/data_folder/mod.rs Removes Clone from DataFolder, stores a single SessionContext, and updates Delta table caching to avoid async I/O while holding a DashMap guard.
crates/modelardb_server/tests/integration_test.rs Renames variables/params to reflect that a temp dir path is passed to the server CLI.
crates/modelardb_server/src/storage/uncompressed_data_manager.rs Switches local_data_folder ownership to Arc<DataFolder> for shared use.
crates/modelardb_server/src/storage/uncompressed_data_buffer.rs Renames “local_data_folder” object store parameters/fields to local_object_store for clarity.
crates/modelardb_server/src/storage/data_transfer.rs Uses shared Arc<DataFolder> for local/remote folders; updates tests accordingly.
crates/modelardb_server/src/storage/data_storage_compactor.rs Uses shared Arc<DataFolder> for the compactor’s local folder; updates tests accordingly.
crates/modelardb_server/src/storage/compressed_data_manager.rs Stores the manager’s local_data_folder as Arc<DataFolder> and updates constructor/tests.
crates/modelardb_server/src/data_folders.rs Makes DataFolders hold Arc<DataFolder> and updates try_from_args() to construct shared instances.
crates/modelardb_server/src/context.rs Updates tests to wrap DataFolder in Arc before constructing DataFolders.
crates/modelardb_server/src/configuration.rs Changes ConfigurationManager to hold Arc<DataFolder>; updates tests that construct DataFolders.
crates/modelardb_server/src/cluster.rs Updates Cluster to store remote_data_folder as Arc<DataFolder> and adjusts tests/helpers to avoid cloning DataFolder.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@CGodiksen
CGodiksen requested a review from chrthomsen August 13, 2026 08:17
async fn delta_table_from_path(&self, table_path: &str) -> Result<DeltaTable> {
// Use the cache if possible and load to get the latest table data.
if let Some(mut delta_table) = self.delta_table_cache.get_mut(table_path) {
// Clone the cached table out if possible and drop the DashMap guard before loading. load()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what "... clone out ... " means.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share one local and one remote DataFolder instance throughout the server

3 participants