Skip to content

Commit a759c15

Browse files
committed
fix(cubestore): Estimate location row count sequentially to avoid OOM
1 parent e8d81f2 commit a759c15

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

rust/cubestore/cubestore/src/sql/table_creator.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -416,23 +416,11 @@ impl TableCreator {
416416
}
417417

418418
let partition_split_threshold = if let Some(locations) = locations.as_ref() {
419-
let size = join_all(
420-
locations
421-
.iter()
422-
.map(|location| {
423-
let location = location.to_string();
424-
let import_service = self.import_service.clone();
425-
return async move {
426-
import_service.estimate_location_row_count(&location).await
427-
};
428-
})
429-
.collect::<Vec<_>>(),
430-
)
431-
.await
432-
.into_iter()
433-
.collect::<Result<Vec<_>, _>>()?
434-
.into_iter()
435-
.sum::<u64>();
419+
let import_service = self.import_service.clone();
420+
let mut size = 0;
421+
for location in locations {
422+
size += import_service.estimate_location_row_count(location).await?;
423+
}
436424

437425
let mut sel_workers_count = self.config_obj.select_workers().len() as u64;
438426
if sel_workers_count == 0 {

0 commit comments

Comments
 (0)