Skip to content

Commit ab46d44

Browse files
committed
enh: qdrant_migrator concurrency
1 parent 8ab7ee0 commit ab46d44

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

core/bin/qdrant_migrator.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ fn main() -> Result<()> {
323323
None => Err(anyhow!("Data source not found"))?,
324324
};
325325

326+
let points_per_request = match std::env::var("POINTS_PER_REQUEST") {
327+
Ok(v) => v.parse::<usize>()?,
328+
Err(_) => 256,
329+
};
330+
326331
let qdrant_client = qdrant_clients.main_client(&ds.config().qdrant_config);
327332

328333
// Delete collection on shadow_write_cluster.
@@ -332,15 +337,21 @@ fn main() -> Result<()> {
332337
None => Err(anyhow!("No shadow write cluster to migrate to"))?,
333338
};
334339

340+
utils::info(&format!(
341+
"Migrating points: points_per_request={}",
342+
points_per_request
343+
));
344+
335345
let mut page_offset: Option<PointId> = None;
336346
let mut total: usize = 0;
337347
loop {
348+
let now = utils::now();
338349
let scroll_results = qdrant_client
339350
.scroll(&ScrollPoints {
340351
collection_name: ds.qdrant_collection(),
341352
with_vectors: Some(true.into()),
342353
with_payload: Some(true.into()),
343-
limit: Some(256),
354+
limit: Some(points_per_request as u32),
344355
offset: page_offset,
345356
..Default::default()
346357
})
@@ -365,7 +376,12 @@ fn main() -> Result<()> {
365376
.await?;
366377

367378
total += count;
368-
utils::info(&format!("Migrated points: count={} total={}", count, total));
379+
utils::info(&format!(
380+
"Migrated points: count={} total={} latency_ms={}",
381+
count,
382+
total,
383+
utils::now() - now
384+
));
369385

370386
page_offset = scroll_results.next_page_offset;
371387
if page_offset.is_none() {

0 commit comments

Comments
 (0)