mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #45459 from FrankChen021/stack_trace_in_part_log
Save exception stack trace in part_log
This commit is contained in:
commit
fa620cc927
@ -559,9 +559,9 @@ bool ExecutionStatus::tryDeserializeText(const std::string & data)
|
||||
return true;
|
||||
}
|
||||
|
||||
ExecutionStatus ExecutionStatus::fromCurrentException(const std::string & start_of_message)
|
||||
ExecutionStatus ExecutionStatus::fromCurrentException(const std::string & start_of_message, bool with_stacktrace)
|
||||
{
|
||||
String msg = (start_of_message.empty() ? "" : (start_of_message + ": ")) + getCurrentExceptionMessage(false, true);
|
||||
String msg = (start_of_message.empty() ? "" : (start_of_message + ": ")) + getCurrentExceptionMessage(with_stacktrace, true);
|
||||
return ExecutionStatus(getCurrentExceptionCode(), msg);
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ struct ExecutionStatus
|
||||
explicit ExecutionStatus(int return_code, const std::string & exception_message = "")
|
||||
: code(return_code), message(exception_message) {}
|
||||
|
||||
static ExecutionStatus fromCurrentException(const std::string & start_of_message = "");
|
||||
static ExecutionStatus fromCurrentException(const std::string & start_of_message = "", bool with_stacktrace = false);
|
||||
|
||||
static ExecutionStatus fromText(const std::string & data);
|
||||
|
||||
|
@ -335,7 +335,7 @@ bool MergeFromLogEntryTask::finalize(ReplicatedMergeMutateTaskBase::PartLogWrite
|
||||
" We will download merged part from replica to force byte-identical result.",
|
||||
getCurrentExceptionMessage(false));
|
||||
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
|
||||
if (storage.getSettings()->detach_not_byte_identical_parts)
|
||||
storage.forcefullyMovePartToDetachedAndRemoveFromMemory(std::move(part), "merge-not-byte-identical");
|
||||
|
@ -52,7 +52,7 @@ bool MergePlainMergeTreeTask::executeStep()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -7504,7 +7504,7 @@ bool MergeTreeData::moveParts(const CurrentlyMovingPartsTaggerPtr & moving_tagge
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
if (cloned_part)
|
||||
cloned_part->remove();
|
||||
|
||||
|
@ -215,7 +215,7 @@ bool MutateFromLogEntryTask::finalize(ReplicatedMergeMutateTaskBase::PartLogWrit
|
||||
LOG_ERROR(log, "{}. Data after mutation is not byte-identical to data on another replicas. "
|
||||
"We will download merged part from replica to force byte-identical result.", getCurrentExceptionMessage(false));
|
||||
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
|
||||
if (storage.getSettings()->detach_not_byte_identical_parts)
|
||||
storage.forcefullyMovePartToDetachedAndRemoveFromMemory(std::move(new_part), "mutate-not-byte-identical");
|
||||
|
@ -103,7 +103,7 @@ bool MutatePlainMergeTreeTask::executeStep()
|
||||
PreformattedMessage exception_message = getCurrentExceptionMessageAndPattern(/* with_stacktrace */ false);
|
||||
LOG_ERROR(&Poco::Logger::get("MutatePlainMergeTreeTask"), exception_message);
|
||||
storage.updateMutationEntriesErrors(future_part, false, exception_message.text);
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ bool ReplicatedMergeMutateTaskBase::executeImpl()
|
||||
catch (...)
|
||||
{
|
||||
if (part_log_writer)
|
||||
part_log_writer(ExecutionStatus::fromCurrentException());
|
||||
part_log_writer(ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ bool ReplicatedMergeMutateTaskBase::executeImpl()
|
||||
catch (...)
|
||||
{
|
||||
if (part_log_writer)
|
||||
part_log_writer(ExecutionStatus::fromCurrentException());
|
||||
part_log_writer(ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ void ReplicatedMergeTreeSinkImpl<false>::finishDelayedChunk(const ZooKeeperWithF
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewPart(storage.getContext(), part, partition.elapsed_ns, ExecutionStatus::fromCurrentException(__PRETTY_FUNCTION__));
|
||||
PartLog::addNewPart(storage.getContext(), part, partition.elapsed_ns, ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -588,7 +588,7 @@ void ReplicatedMergeTreeSinkImpl<async_insert>::writeExistingPart(MergeTreeData:
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewPart(storage.getContext(), part, watch.elapsed(), ExecutionStatus::fromCurrentException(__PRETTY_FUNCTION__));
|
||||
PartLog::addNewPart(storage.getContext(), part, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -1876,7 +1876,7 @@ void StorageMergeTree::replacePartitionFrom(const StoragePtr & source_table, con
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException());
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -1959,7 +1959,7 @@ void StorageMergeTree::movePartitionToTable(const StoragePtr & dest_table, const
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException());
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -2340,7 +2340,7 @@ bool StorageReplicatedMergeTree::executeReplaceRange(const LogEntry & entry)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewParts(getContext(), res_parts, watch.elapsed(), ExecutionStatus::fromCurrentException());
|
||||
PartLog::addNewParts(getContext(), res_parts, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
|
||||
for (const auto & res_part : res_parts)
|
||||
unlockSharedData(*res_part);
|
||||
@ -4193,7 +4193,7 @@ bool StorageReplicatedMergeTree::fetchPart(
|
||||
catch (...)
|
||||
{
|
||||
if (!to_detached)
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
|
||||
throw;
|
||||
}
|
||||
@ -4303,7 +4303,7 @@ MutableDataPartStoragePtr StorageReplicatedMergeTree::fetchExistsPart(
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
write_part_log(ExecutionStatus::fromCurrentException());
|
||||
write_part_log(ExecutionStatus::fromCurrentException("", true));
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -7068,7 +7068,7 @@ void StorageReplicatedMergeTree::replacePartitionFrom(
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException());
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
for (const auto & dst_part : dst_parts)
|
||||
unlockSharedData(*dst_part);
|
||||
|
||||
@ -7297,7 +7297,7 @@ void StorageReplicatedMergeTree::movePartitionToTable(const StoragePtr & dest_ta
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException());
|
||||
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed(), ExecutionStatus::fromCurrentException("", true));
|
||||
|
||||
for (const auto & dst_part : dst_parts)
|
||||
dest_table_storage->unlockSharedData(*dst_part);
|
||||
|
Loading…
Reference in New Issue
Block a user