Skip to content

Commit e503ae5

Browse files
committed
Merge pull request #1172 from Altinity/feature/antalya-25.8/object_storage_cluster_profile_events
Profile events for task distribution in ObjectStorageCluster requests
1 parent 9f97b83 commit e503ae5

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/Common/ProfileEvents.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,11 @@ The server successfully detected this situation and will download merged part fr
11841184
M(ObjectStorageListObjectsCachePrefixMatchHits, "Number of times object storage list objects operation miss the cache using prefix matching.", ValueType::Number) \
11851185
M(ParquetMetaDataCacheHits, "Number of times the read from filesystem cache hit the cache.", ValueType::Number) \
11861186
M(ParquetMetaDataCacheMisses, "Number of times the read from filesystem cache miss the cache.", ValueType::Number) \
1187+
\
1188+
M(ObjectStorageClusterSentToMatchedReplica, "Number of tasks in ObjectStorageCluster request sent to matched replica.", ValueType::Number) \
1189+
M(ObjectStorageClusterSentToNonMatchedReplica, "Number of tasks in ObjectStorageCluster request sent to non-matched replica.", ValueType::Number) \
1190+
M(ObjectStorageClusterProcessedTasks, "Number of processed tasks in ObjectStorageCluster request.", ValueType::Number) \
1191+
M(ObjectStorageClusterWaitingMicroseconds, "Time of waiting for tasks in ObjectStorageCluster request.", ValueType::Microseconds) \
11871192

11881193
#ifdef APPLY_FOR_EXTERNAL_EVENTS
11891194
#define APPLY_FOR_EVENTS(M) APPLY_FOR_BUILTIN_EVENTS(M) APPLY_FOR_EXTERNAL_EVENTS(M)

src/Storages/ObjectStorage/StorageObjectStorageSource.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ namespace fs = std::filesystem;
4545
namespace ProfileEvents
4646
{
4747
extern const Event EngineFileLikeReadFiles;
48+
extern const Event ObjectStorageClusterProcessedTasks;
49+
extern const Event ObjectStorageClusterWaitingMicroseconds;
4850
}
4951

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

526+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterProcessedTasks);
527+
522528
ObjectStoragePtr storage_to_use = object_info->getObjectStorage();
523529
if (!storage_to_use)
524530
storage_to_use = object_storage;

src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
#include <consistent_hashing.h>
44
#include <optional>
55

6+
namespace ProfileEvents
7+
{
8+
extern const Event ObjectStorageClusterSentToMatchedReplica;
9+
extern const Event ObjectStorageClusterSentToNonMatchedReplica;
10+
};
11+
612
namespace DB
713
{
814

@@ -129,6 +135,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getPreQueuedFile(size_t
129135
number_of_current_replica
130136
);
131137

138+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
132139
return next_file;
133140
}
134141

@@ -180,6 +187,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getMatchingFileFromIter
180187
file_path, number_of_current_replica
181188
);
182189

190+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
183191
return object_info;
184192
}
185193
LOG_TEST(
@@ -236,6 +244,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getAnyUnprocessedFile(s
236244
number_of_matched_replica
237245
);
238246

247+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToNonMatchedReplica);
239248
return next_file;
240249
}
241250

0 commit comments

Comments
 (0)