gavinchou commented on code in PR #68032:
URL: https://github.com/apache/doris/pull/68032#discussion_r4236848222
##########
be/src/exec/spill/spill_file_manager.cpp:
##########
@@ -28,21 +29,58 @@
#include <utility>
#include <vector>
+#include "common/config.h"
#include "common/logging.h"
#include "common/metrics/doris_metrics.h"
+#include "exec/spill/remote_spill_data_dir.h"
#include "exec/spill/spill_file.h"
#include "io/fs/file_system.h"
#include "io/fs/local_file_system.h"
#include "runtime/query_context.h"
-#include "storage/olap_define.h"
#include "util/debug_points.h"
-#include "util/parse_util.h"
#include "util/pretty_printer.h"
#include "util/time.h"
#include "util/uid_util.h"
namespace doris {
+Status reconcile_remote_spill_bytes(SpillDataDir* data_dir, const
io::FileSystemSPtr& fs,
+ const std::string& dir, int64_t*
accounted_bytes) {
+ DORIS_CHECK(data_dir->is_remote());
+ std::vector<io::FileInfo> objects;
+ bool exists = false;
+ RETURN_IF_ERROR(fs->list(dir, true, &objects, &exists));
+ int64_t actual_bytes = 0;
+ for (const auto& object : objects) {
+ if (object.is_file) {
+ actual_bytes += object.file_size;
+ }
+ }
+ const int64_t delta = actual_bytes - *accounted_bytes;
+ if (delta > 0) {
+ data_dir->record_persisted_bytes(delta);
+ } else if (delta < 0) {
+ data_dir->release_persisted_bytes(-delta);
+ }
+ *accounted_bytes = actual_bytes;
+ return Status::OK();
+}
+
+// BE-wide object storage traffic of spill. The PerSecond windows give QPS and
bytes/s directly.
+bvar::Adder<int64_t> g_spill_remote_read_bytes("spill_remote_read_bytes");
+bvar::Adder<int64_t> g_spill_remote_write_bytes("spill_remote_write_bytes");
+bvar::Adder<int64_t> g_spill_remote_get_requests("spill_remote_get_requests");
+bvar::Adder<int64_t> g_spill_remote_put_requests("spill_remote_put_requests");
+bvar::PerSecond<bvar::Adder<int64_t>>
g_spill_remote_read_throughput("spill_remote_read_throughput",
Review Comment:
keeping adder is enough
rate canbe calculated by grafana/promethues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]