@@ -4439,7 +4439,7 @@ void StorageReplicatedMergeTree::exportMergeTreePartitionUpdatingTask()
44394439
44404440 if (cleanup_lock_acquired)
44414441 {
4442- bool has_expired = metadata.create_time < now - 90 ;
4442+ bool has_expired = metadata.create_time < now - 180 ;
44434443
44444444 if (has_expired && is_not_pending)
44454445 {
@@ -4550,8 +4550,6 @@ void StorageReplicatedMergeTree::selectPartsToExport()
45504550 const std::string & part_status_path,
45514551 const std::string & parts_to_do_path,
45524552 const std::string & lock_path,
4553- const std::string & next_idx_path,
4554- const std::size_t next_idx_local,
45554553 const std::string & path_in_destination_storage_path,
45564554 const StoragePtr & destination_storage,
45574555 const std::string & transaction_id,
@@ -4561,7 +4559,6 @@ void StorageReplicatedMergeTree::selectPartsToExport()
45614559 /// todo arthur is it possible to grab stats using a multi-op?
45624560 Coordination::Stat parts_to_do_stat;
45634561 Coordination::Stat lock_stat;
4564- Coordination::Stat next_idx_stat;
45654562 std::string parts_to_do_string;
45664563
45674564 int retries = 0;
@@ -4600,6 +4597,8 @@ void StorageReplicatedMergeTree::selectPartsToExport()
46004597
46014598 Coordination::Requests ops;
46024599 ops.emplace_back(zkutil::makeCheckRequest(lock_path, lock_stat.version));
4600+
4601+ /// there is a problem here: if someone else completed a part export before, this thing will fail..
46034602 ops.emplace_back(zkutil::makeCheckRequest(parts_to_do_path, parts_to_do_stat.version));
46044603 ops.emplace_back(zkutil::makeSetRequest(part_status_path, "COMPLETED", -1));
46054604 ops.emplace_back(zkutil::makeRemoveRequest(lock_path, lock_stat.version));
@@ -4854,12 +4853,15 @@ void StorageReplicatedMergeTree::selectPartsToExport()
48544853
48554854 try
48564855 {
4856+ /// todo arthur temporary for hackathon
4857+ auto context_copy = Context::createCopy(getContext());
4858+ context_copy->setSetting("export_merge_tree_part_overwrite_file_if_exists", true);
48574859 exportPartToTable(
48584860 part_to_export.value(),
48594861 destination_storage_id,
48604862 transaction_id,
4861- getContext() ,
4862- [this, partition_id, transaction_id, exports_path, key, part_to_export, complete_part_export, partition_path, next_idx_path, next_idx, destination_storage]
4863+ context_copy ,
4864+ [this, partition_id, transaction_id, exports_path, key, part_to_export, complete_part_export, partition_path, destination_storage]
48634865 (MergeTreePartExportManifest::CompletionCallbackResult result)
48644866 {
48654867 const auto zk_client = getZooKeeper();
@@ -4871,8 +4873,6 @@ void StorageReplicatedMergeTree::selectPartsToExport()
48714873 fs::path(partition_path) / "parts" / part_to_export.value() / "status",
48724874 fs::path(partition_path) / "parts_to_do",
48734875 fs::path(partition_path) / "parts" / part_to_export.value() / "lock",
4874- next_idx_path,
4875- next_idx,
48764876 result.relative_path_in_destination_storage,
48774877 destination_storage,
48784878 transaction_id,
0 commit comments