Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Common/ProfileEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,11 @@ The server successfully detected this situation and will download merged part fr
M(ObjectStorageListObjectsCachePrefixMatchHits, "Number of times object storage list objects operation miss the cache using prefix matching.", ValueType::Number) \
M(ParquetMetaDataCacheHits, "Number of times the read from filesystem cache hit the cache.", ValueType::Number) \
M(ParquetMetaDataCacheMisses, "Number of times the read from filesystem cache miss the cache.", ValueType::Number) \
\
M(ObjectStorageClusterSentToMatchedReplica, "Number of tasks in ObjectStorageCluster request sent to matched replica.", ValueType::Number) \
M(ObjectStorageClusterSentToNonMatchedReplica, "Number of tasks in ObjectStorageCluster request sent to non-matched replica.", ValueType::Number) \
M(ObjectStorageClusterProcessedTasks, "Number of processed tasks in ObjectStorageCluster request.", ValueType::Number) \
M(ObjectStorageClusterWaitingMicroseconds, "Time of waiting for tasks in ObjectStorageCluster request.", ValueType::Microseconds) \

#ifdef APPLY_FOR_EXTERNAL_EVENTS
#define APPLY_FOR_EVENTS(M) APPLY_FOR_BUILTIN_EVENTS(M) APPLY_FOR_EXTERNAL_EVENTS(M)
Expand Down
8 changes: 7 additions & 1 deletion src/Storages/ObjectStorage/StorageObjectStorageSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace fs = std::filesystem;
namespace ProfileEvents
{
extern const Event EngineFileLikeReadFiles;
extern const Event ObjectStorageClusterProcessedTasks;
extern const Event ObjectStorageClusterWaitingMicroseconds;
}

namespace CurrentMetrics
Expand Down Expand Up @@ -507,7 +509,9 @@ StorageObjectStorageSource::ReaderHolder StorageObjectStorageSource::createReade
/// TODO: Make asyncronous waiting without sleep in thread
/// Now this sleep is on executor node in worker thread
/// Does not block query initiator
sleepForMicroseconds(std::min(Poco::Timestamp::TimeDiff(100000ul), retry_after_us.value()));
auto wait_time = std::min(Poco::Timestamp::TimeDiff(100000ul), retry_after_us.value());
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterWaitingMicroseconds, wait_time);
sleepForMicroseconds(wait_time);
continue;
}
}
Expand All @@ -519,6 +523,8 @@ StorageObjectStorageSource::ReaderHolder StorageObjectStorageSource::createReade
}
while (not_a_path || (query_settings.skip_empty_files && object_info->metadata->size_bytes == 0));

ProfileEvents::increment(ProfileEvents::ObjectStorageClusterProcessedTasks);

ObjectStoragePtr storage_to_use = object_info->getObjectStorage();
if (!storage_to_use)
storage_to_use = object_storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#include <consistent_hashing.h>
#include <optional>

namespace ProfileEvents
{
extern const Event ObjectStorageClusterSentToMatchedReplica;
extern const Event ObjectStorageClusterSentToNonMatchedReplica;
};
Comment on lines +6 to +10

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Add ProfileEvents header for new counters

This file now declares ProfileEvents::ObjectStorageClusterSentToMatchedReplica/...NonMatchedReplica and calls ProfileEvents::increment, but it never includes <Common/ProfileEvents.h>, so Event and increment are undefined in this translation unit. As written the code will not compile after this commit; the missing header (or forward declaration of increment plus the Event typedef) needs to be added.

Useful? React with 👍 / 👎.


namespace DB
{

Expand Down Expand Up @@ -129,6 +135,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getPreQueuedFile(size_t
number_of_current_replica
);

ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
return next_file;
}

Expand Down Expand Up @@ -180,6 +187,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getMatchingFileFromIter
file_path, number_of_current_replica
);

ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
return object_info;
}
LOG_TEST(
Expand Down Expand Up @@ -236,6 +244,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getAnyUnprocessedFile(s
number_of_matched_replica
);

ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToNonMatchedReplica);
return next_file;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that replica is not matched here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, here is only when no matched files anymore.

}

Expand Down
Loading