Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions icechunk-python/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2079,9 +2079,10 @@ impl PyRepository {
py.detach(move || {
let result =
pyo3_async_runtimes::tokio::get_runtime().block_on(async move {
let asset_manager = {
let (asset_manager, num_updates) = {
let lock = self.0.read().await;
Arc::clone(lock.asset_manager())
let num_updates = lock.config().num_updates_per_repo_info_file();
(Arc::clone(lock.asset_manager()), num_updates)
};

let result = expire(
Expand All @@ -2097,6 +2098,7 @@ impl PyRepository {
} else {
ExpiredRefAction::Ignore
},
num_updates,
)
.await
.map_err(PyIcechunkStoreError::GCError)?;
Expand All @@ -2123,9 +2125,10 @@ impl PyRepository {
) -> PyResult<Bound<'py, PyAny>> {
let repository = self.0.clone();
pyo3_async_runtimes::tokio::future_into_py::<_, HashSet<String>>(py, async move {
let asset_manager = {
let (asset_manager, num_updates) = {
let lock = repository.read().await;
Arc::clone(lock.asset_manager())
let num_updates = lock.config().num_updates_per_repo_info_file();
(Arc::clone(lock.asset_manager()), num_updates)
};

let result = expire(
Expand All @@ -2141,6 +2144,7 @@ impl PyRepository {
} else {
ExpiredRefAction::Ignore
},
num_updates,
)
.await
.map_err(PyIcechunkStoreError::GCError)?;
Expand Down Expand Up @@ -2170,11 +2174,12 @@ impl PyRepository {
max_concurrent_manifest_fetches,
dry_run,
);
let asset_manager = {
let (asset_manager, num_updates) = {
let lock = self.0.read().await;
Arc::clone(lock.asset_manager())
let num_updates = lock.config().num_updates_per_repo_info_file();
(Arc::clone(lock.asset_manager()), num_updates)
};
let result = garbage_collect(asset_manager, &gc_config)
let result = garbage_collect(asset_manager, &gc_config, num_updates)
.await
.map_err(PyIcechunkStoreError::GCError)?;
Ok::<_, PyIcechunkStoreError>(result.into())
Expand Down Expand Up @@ -2204,11 +2209,12 @@ impl PyRepository {
max_concurrent_manifest_fetches,
dry_run,
);
let asset_manager = {
let (asset_manager, num_updates) = {
let lock = repository.read().await;
Arc::clone(lock.asset_manager())
let num_updates = lock.config().num_updates_per_repo_info_file();
(Arc::clone(lock.asset_manager()), num_updates)
};
let result = garbage_collect(asset_manager, &gc_config)
let result = garbage_collect(asset_manager, &gc_config, num_updates)
.await
.map_err(PyIcechunkStoreError::GCError)?;
Ok(result.into())
Expand Down
19 changes: 19 additions & 0 deletions icechunk/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,17 @@ pub struct RepositoryConfig {

#[serde(default)]
pub previous_file: Option<String>,

#[serde(default)]
pub num_updates_per_repo_info_file: Option<usize>,
}

static DEFAULT_COMPRESSION: OnceLock<CompressionConfig> = OnceLock::new();
static DEFAULT_CACHING: OnceLock<CachingConfig> = OnceLock::new();
static DEFAULT_MANIFEST_CONFIG: OnceLock<ManifestConfig> = OnceLock::new();
pub const DEFAULT_MAX_CONCURRENT_REQUESTS: u16 = 256;
// usize?
pub const DEFAULT_NUM_UPDATES_PER_REPO_INFO_FILE: usize = 100;

impl RepositoryConfig {
pub fn inline_chunk_threshold_bytes(&self) -> u16 {
Expand Down Expand Up @@ -441,6 +446,11 @@ impl RepositoryConfig {
self.max_concurrent_requests.unwrap_or(DEFAULT_MAX_CONCURRENT_REQUESTS)
}

pub fn num_updates_per_repo_info_file(&self) -> usize {
self.num_updates_per_repo_info_file
.unwrap_or(DEFAULT_NUM_UPDATES_PER_REPO_INFO_FILE)
}

pub fn merge(&self, other: Self) -> Self {
Self {
inline_chunk_threshold_bytes: other
Expand Down Expand Up @@ -501,6 +511,15 @@ impl RepositoryConfig {
(Some(c), None) => Some(c.clone()),
(Some(_), Some(theirs)) => Some(theirs),
},
num_updates_per_repo_info_file: match (
&self.num_updates_per_repo_info_file,
other.num_updates_per_repo_info_file,
) {
(None, None) => None,
(None, Some(c)) => Some(c),
(Some(c), None) => Some(*c),
(Some(_), Some(theirs)) => Some(theirs),
},
}
}
}
Expand Down
Loading
Loading