Merge branch 'master' into memory-leak

This commit is contained in:
Sema Checherinda 2023-06-21 22:22:11 +02:00 committed by GitHub
commit 679f2c4aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 22 deletions

View File

@ -973,24 +973,9 @@ void IMergeTreeDataPart::writeVersionMetadata(const VersionMetadata & version_,
}
}
void IMergeTreeDataPart::writeDeleteOnDestroyMarker()
{
static constexpr auto marker_path = "delete-on-destroy.txt";
try
{
getDataPartStorage().createFile(marker_path);
}
catch (Poco::Exception & e)
{
LOG_ERROR(storage.log, "{} (while creating DeleteOnDestroy marker: {})",
e.what(), (fs::path(getDataPartStorage().getFullPath()) / marker_path).string());
}
}
void IMergeTreeDataPart::removeDeleteOnDestroyMarker()
{
getDataPartStorage().removeFileIfExists("delete-on-destroy.txt");
getDataPartStorage().removeFileIfExists(DELETE_ON_DESTROY_MARKER_FILE_NAME_DEPRECATED);
}
void IMergeTreeDataPart::removeVersionMetadata()

View File

@ -399,7 +399,8 @@ public:
/// default will be stored in this file.
static inline constexpr auto DEFAULT_COMPRESSION_CODEC_FILE_NAME = "default_compression_codec.txt";
static inline constexpr auto DELETE_ON_DESTROY_MARKER_FILE_NAME = "delete-on-destroy.txt";
/// "delete-on-destroy.txt" is deprecated. It is no longer being created, only is removed.
static inline constexpr auto DELETE_ON_DESTROY_MARKER_FILE_NAME_DEPRECATED = "delete-on-destroy.txt";
static inline constexpr auto UUID_FILE_NAME = "uuid.txt";
@ -474,8 +475,10 @@ public:
void writeChecksums(const MergeTreeDataPartChecksums & checksums_, const WriteSettings & settings);
void writeDeleteOnDestroyMarker();
/// "delete-on-destroy.txt" is deprecated. It is no longer being created, only is removed.
/// TODO: remove this method after some time.
void removeDeleteOnDestroyMarker();
/// It may look like a stupid joke. but these two methods are absolutely unrelated.
/// This one is about removing file with metadata about part version (for transactions)
void removeVersionMetadata();

View File

@ -1211,7 +1211,7 @@ MergeTreeData::LoadPartResult MergeTreeData::loadDataPart(
auto data_part_storage = std::make_shared<DataPartStorageOnDiskFull>(single_disk_volume, relative_data_path, part_name);
String part_path = fs::path(relative_data_path) / part_name;
String marker_path = fs::path(part_path) / IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME;
String marker_path = fs::path(part_path) / IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME_DEPRECATED;
/// Ignore broken parts that can appear as a result of hard server restart.
auto mark_broken = [&]
@ -4589,7 +4589,6 @@ void MergeTreeData::swapActivePart(MergeTreeData::DataPartPtr part_copy)
/// All other locks are taken in StorageReplicatedMergeTree
lockSharedData(*part_copy);
asMutableDeletingPart(original_active_part)->writeDeleteOnDestroyMarker();
return;
}
}
@ -7394,7 +7393,7 @@ std::pair<MergeTreeData::MutableDataPartPtr, scope_guard> MergeTreeData::cloneAn
for (auto it = src_part->getDataPartStorage().iterate(); it->isValid(); it->next())
{
if (!files_to_copy_instead_of_hardlinks.contains(it->name())
&& it->name() != IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME
&& it->name() != IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME_DEPRECATED
&& it->name() != IMergeTreeDataPart::TXN_VERSION_METADATA_FILE_NAME)
{
hardlinked_files->hardlinks_from_source_part.insert(it->name());
@ -7409,7 +7408,7 @@ std::pair<MergeTreeData::MutableDataPartPtr, scope_guard> MergeTreeData::cloneAn
{
auto file_name_with_projection_prefix = fs::path(projection_storage.getPartDirectory()) / it->name();
if (!files_to_copy_instead_of_hardlinks.contains(file_name_with_projection_prefix)
&& it->name() != IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME
&& it->name() != IMergeTreeDataPart::DELETE_ON_DESTROY_MARKER_FILE_NAME_DEPRECATED
&& it->name() != IMergeTreeDataPart::TXN_VERSION_METADATA_FILE_NAME)
{
hardlinked_files->hardlinks_from_source_part.insert(file_name_with_projection_prefix);