Skip to content

Commit

Permalink
fix build due to ClickHouse/ClickHouse#74271
Browse files Browse the repository at this point in the history
  • Loading branch information
baibaichen committed Jan 10, 2025
1 parent e696ad8 commit d2b0e6a
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions cpp-ch/local-engine/Storages/MergeTree/SparkStorageMergeTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,26 +469,21 @@ MergeTreeDataWriter::TemporaryPart SparkMergeTreeDataWriter::writeTempPart(
new_data_part->uuid = UUIDHelpers::generateV4();

SyncGuardPtr sync_guard;
if (new_data_part->isStoredOnDisk())
{
/// The name could be non-unique in case of stale files from previous runs.
String full_path = new_data_part->getDataPartStorage().getFullPath();

if (new_data_part->getDataPartStorage().exists())
{
// LOG_WARNING(log, "Removing old temporary directory {}", full_path);
data_part_storage->removeRecursive();
}
/// The name could be non-unique in case of stale files from previous runs.
String full_path = new_data_part->getDataPartStorage().getFullPath();

data_part_storage->createDirectories();

if ((*data.getSettings())[MergeTreeSetting::fsync_part_directory])
{
const auto disk = data_part_volume->getDisk();
sync_guard = disk->getDirectorySyncGuard(full_path);
}
if (new_data_part->getDataPartStorage().exists())
{
LOG_WARNING(log, "Removing old temporary directory {}", full_path);
data_part_storage->removeRecursive();
}

data_part_storage->createDirectories();

if ((*data.getSettings())[MergeTreeSetting::fsync_part_directory])
sync_guard = data_part_volume->getDisk()->getDirectorySyncGuard(full_path);

/// This effectively chooses minimal compression method:
/// either default lz4 or compression method with zero thresholds on absolute and relative part size.
auto compression_codec = data.getContext()->chooseCompressionCodec(0, 0);
Expand Down

0 comments on commit d2b0e6a

Please sign in to comment.