@@ -4838,6 +4838,9 @@ void StorageReplicatedMergeTree::selectPartsToExport()
48384838
48394839 }
48404840 });
4841+
4842+ /// managed to schedule a task, re-run immediately to pick up more tasks if possible
4843+ export_merge_tree_partition_select_task->schedule();
48414844 }
48424845 catch (...)
48434846 {
@@ -4846,12 +4849,15 @@ void StorageReplicatedMergeTree::selectPartsToExport()
48464849
48474850 /// best-effort to remove the lock (actually, we should make sure the lock is released..)
48484851 zk->tryRemove(fs::path(partition_path) / "parts" / part_to_export.value() / "lock");
4852+
4853+ /// re-run after some time
4854+ export_merge_tree_partition_select_task->scheduleAfter(1000 * 5);
48494855 }
48504856
48514857 }
48524858 }
48534859
4854- export_merge_tree_partition_select_task->scheduleAfter(1000 * 5);
4860+ // export_merge_tree_partition_select_task->scheduleAfter(1000 * 5);
48554861}
48564862
48574863
@@ -8463,8 +8469,9 @@ void StorageReplicatedMergeTree::exportPartitionToTable(const PartitionCommand &
84638469 "Exporting merge tree part is experimental. Set `allow_experimental_export_merge_tree_part` to enable it");
84648470 }
84658471
8466- String dest_database = query_context->resolveDatabase(command.to_database);
8467- auto dest_storage = DatabaseCatalog::instance().getTable({dest_database, command.to_table}, query_context);
8472+ const auto dest_database = query_context->resolveDatabase(command.to_database);
8473+ const auto dest_table = command.to_table;
8474+ auto dest_storage = DatabaseCatalog::instance().getTable({dest_database, dest_table}, query_context);
84688475
84698476 if (dest_storage->getStorageID() == this->getStorageID())
84708477 {
@@ -8570,8 +8577,8 @@ void StorageReplicatedMergeTree::exportPartitionToTable(const PartitionCommand &
85708577
85718578 manifest.transaction_id = std::to_string(generateSnowflakeID());
85728579 manifest.partition_id = partition_id;
8573- manifest.destination_database = command.to_database ;
8574- manifest.destination_table = command.to_table ;
8580+ manifest.destination_database = dest_database ;
8581+ manifest.destination_table = dest_table ;
85758582 manifest.source_replica = replica_name;
85768583 manifest.number_of_parts = part_names.size();
85778584 manifest.parts = part_names;
0 commit comments