This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 97207aab5 [tablet] fix compilation warnings on macOS
97207aab5 is described below
commit 97207aab577448ae426ecba3764eaed81a38d5cd
Author: Alexey Serbin <[email protected]>
AuthorDate: Tue Feb 4 13:06:37 2025 -0800
[tablet] fix compilation warnings on macOS
Use portable format specifiers for printing 64-bit numbers to avoid
compilation warnings like below:
warning: format specifies type 'long' but the argument has type 'int64_t'
(aka 'long long') [-Wformat]
Also snuck in a small clean-up of the code in process_memory.cc
and compaction-highmem-test.cc.
This is a follow-up to d405ad33080cc5b203e3789363a202d472aca795.
Change-Id: I2d7769200c484d29471a7aaf798fdd089f3ccfcc
Reviewed-on: http://gerrit.cloudera.org:8080/22448
Reviewed-by: Abhishek Chennaka <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
---
src/kudu/tablet/compaction-highmem-test.cc | 20 +++++++++-----------
src/kudu/tablet/delta_compaction.cc | 11 ++++++-----
src/kudu/util/process_memory.cc | 5 +----
3 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/kudu/tablet/compaction-highmem-test.cc
b/src/kudu/tablet/compaction-highmem-test.cc
index 63301898b..9d56d6f47 100644
--- a/src/kudu/tablet/compaction-highmem-test.cc
+++ b/src/kudu/tablet/compaction-highmem-test.cc
@@ -118,7 +118,7 @@ class TestHighMemCompaction : public KuduRowSetTest {
// Callers can adjust the size_factor.
// For example, to generate 5MB, set size_factor as 5.
// Similarly, to generate 35MB, set size_factor as 35.
- void GenHighMemConsumptionDeltas(const uint32_t size_factor);
+ void GenHighMemConsumptionDeltas(uint32_t size_factor);
// Enables compaction memory budgeting and then runs rowset compaction.
// Caller can set constraints on budget and expect the results accordingly.
@@ -151,7 +151,7 @@ class TestHighMemCompaction : public KuduRowSetTest {
void
TestHighMemCompaction::TestRowSetCompactionWithOrWithoutBudgetingConstraints(
bool budgeting_constraints_applied) {
// size factor as 2 generates ~2MB memory size worth of deltas
- GenHighMemConsumptionDeltas(2);
+ NO_FATALS(GenHighMemConsumptionDeltas(2));
// Run rowset compaction.
StringVectorSink sink;
@@ -179,28 +179,26 @@ void
TestHighMemCompaction::TestRowSetCompactionWithOrWithoutBudgetingConstraint
void TestHighMemCompaction::TestMajorCompactionCrossingMemoryThreshold() {
// Size factor as 2 generates ~2MB memory size worth of deltas.
- GenHighMemConsumptionDeltas(2);
+ NO_FATALS(GenHighMemConsumptionDeltas(2));
// Run major delta compaction.
StringVectorSink sink;
ScopedRegisterSink reg(&sink);
- scoped_refptr<Trace> trace(new Trace);
- ADOPT_TRACE(trace.get());
ASSERT_OK(tablet()->CompactWorstDeltas(RowSet::MAJOR_DELTA_COMPACTION));
ASSERT_STR_CONTAINS(JoinStrings(sink.logged_msgs(), "\n"),
- "Beyond hard memory limit of");
+ "beyond hard memory limit of");
}
-void TestHighMemCompaction::GenHighMemConsumptionDeltas(const uint32_t
size_factor) {
- constexpr const uint32_t num_rowsets = 10;
- constexpr const uint32_t num_rows_per_rowset = 2;
+void TestHighMemCompaction::GenHighMemConsumptionDeltas(uint32_t size_factor) {
+ constexpr const uint32_t kNumRowsets = 10;
+ constexpr const uint32_t kNumRowsPerRowset = 2;
const uint32_t num_updates = 5000 * size_factor;
- NO_FATALS(InsertOriginalRows(num_rowsets, num_rows_per_rowset));
+ NO_FATALS(InsertOriginalRows(kNumRowsets, kNumRowsPerRowset));
// Mutate all of the rows.
for (int i = 1; i <= num_updates; i++) {
- UpdateOriginalRowsNoFlush(num_rowsets, num_rows_per_rowset, i);
+ NO_FATALS(UpdateOriginalRowsNoFlush(kNumRowsets, kNumRowsPerRowset, i));
}
ASSERT_OK(tablet()->FlushAllDMSForTests());
}
diff --git a/src/kudu/tablet/delta_compaction.cc
b/src/kudu/tablet/delta_compaction.cc
index 94d7ae1cc..d3d94ca4c 100644
--- a/src/kudu/tablet/delta_compaction.cc
+++ b/src/kudu/tablet/delta_compaction.cc
@@ -17,6 +17,7 @@
#include "kudu/tablet/delta_compaction.h"
+#include <cinttypes>
#include <map>
#include <ostream>
#include <string>
@@ -127,13 +128,13 @@ string MajorDeltaCompaction::ColumnNamesToString() const {
// Log warning messages if the memory consumption has exceeded a certain
threshold.
void MajorDeltaCompaction::MemoryExceededWarnMsgs() {
if (process_memory::OverHardLimitThreshold()) {
- string msg = StringPrintf(
- "Beyond hard memory limit of %ld with current consumption at %ld. "
- "MajorDeltaCompaction ops consumption: tablet-%s %ld, total %ld.",
+ const auto msg = StringPrintf(
+ "beyond hard memory limit of %" PRId64 " with current consumption "
+ "at %" PRId64 "; MajorDeltaCompaction ops consumption: "
+ "tablet-%s %" PRId64 ", total %" PRId64,
process_memory::HardLimit(), process_memory::CurrentConsumption(),
tablet_id_.c_str(), tracker_->consumption(),
parent_tracker_->consumption());
- KLOG_EVERY_N_SECS(WARNING, 1) << msg
- << THROTTLE_MSG;
+ KLOG_EVERY_N_SECS(WARNING, 1) << msg << THROTTLE_MSG;
}
}
diff --git a/src/kudu/util/process_memory.cc b/src/kudu/util/process_memory.cc
index c379f9413..c93301aa3 100644
--- a/src/kudu/util/process_memory.cc
+++ b/src/kudu/util/process_memory.cc
@@ -238,10 +238,7 @@ bool OverHardLimitThreshold() {
InitLimits();
int64_t over_hard_limit_threshold =
g_hard_limit *
FLAGS_memory_limit_compact_usage_warn_threshold_percentage / 100;
- if (CurrentConsumption() > over_hard_limit_threshold) {
- return true;
- }
- return false;
+ return CurrentConsumption() > over_hard_limit_threshold;
}
int64_t SoftLimit() {