Skip to content

Commit

Permalink
[#19344] DocDB:Replace EnableVerboseLoggingForModule with google::Set…
Browse files Browse the repository at this point in the history
…VLOGLevel

Summary:
`EnableVerboseLoggingForModule` sets vlog by updating the vmodule gflag with a more complex string. Its simpler to just call google::SetVLOGLevel to set the module log level.

Remove duplicate `ColumnLimit` field from clang-format

Fixes #19344
Jira: DB-8146

Test Plan: All tests

Reviewers: jhe

Reviewed By: jhe

Subscribers: ybase, bogdan

Differential Revision: https://phorge.dev.yugabyte.com/D28917
  • Loading branch information
hari90 committed Sep 28, 2023
1 parent 8ff780f commit bf5e672
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 26 deletions.
1 change: 0 additions & 1 deletion .clang-format
Expand Up @@ -99,6 +99,5 @@ SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
ColumnLimit: 100
FixNamespaceComments: true
...
8 changes: 4 additions & 4 deletions src/yb/integration-tests/cdcsdk_before_image-test.cc
Expand Up @@ -1014,8 +1014,8 @@ TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestColumnDropBeforeImage)) {
}

TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestLargeTransactionUpdateRowsWithBeforeImage)) {
EnableVerboseLoggingForModule("cdc_service", 1);
EnableVerboseLoggingForModule("cdcsdk_producer", 1);
google::SetVLOGLevel("cdc_service", 1);
google::SetVLOGLevel("cdcsdk_producer", 1);
ANNOTATE_UNPROTECTED_WRITE(FLAGS_update_min_cdc_indices_interval_secs) = 1;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_cdc_state_checkpoint_update_interval_ms) = 0;
ASSERT_OK(SetUpWithParams(3, 1, false));
Expand Down Expand Up @@ -1107,8 +1107,8 @@ TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestLargeTransactionUpdateRowsWit
}

TEST_F(CDCSDKYsqlTest, YB_DISABLE_TEST_IN_TSAN(TestLargeTransactionDeleteRowsWithBeforeImage)) {
EnableVerboseLoggingForModule("cdc_service", 1);
EnableVerboseLoggingForModule("cdcsdk_producer", 1);
google::SetVLOGLevel("cdc_service", 1);
google::SetVLOGLevel("cdcsdk_producer", 1);
// ANNOTATE_UNPROTECTED_WRITE(FLAGS_timestamp_history_retention_interval_sec) = 0;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_update_min_cdc_indices_interval_secs) = 1;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_cdc_state_checkpoint_update_interval_ms) = 0;
Expand Down
7 changes: 0 additions & 7 deletions src/yb/integration-tests/cdcsdk_ysql_test_base.cc
Expand Up @@ -2842,13 +2842,6 @@ namespace cdc {
ValidateColumnCounts(change_resp, 2);
}

void CDCSDKYsqlTest::EnableVerboseLoggingForModule(const std::string& module, int level) {
if (!FLAGS_vmodule.empty()) {
FLAGS_vmodule += Format(",$0=$1", module, level);
} else {
ANNOTATE_UNPROTECTED_WRITE(FLAGS_vmodule) = Format("$0=$1", module, level);
}
}

Result<std::string> CDCSDKYsqlTest::GetValueFromMap(const QLMapValuePB& map_value,
const std::string& key) {
Expand Down
1 change: 0 additions & 1 deletion src/yb/integration-tests/cdcsdk_ysql_test_base.h
Expand Up @@ -513,7 +513,6 @@ class CDCSDKYsqlTest : public CDCSDKTestBase {
void CDCSDKMultipleAlterWithTabletLeaderSwitch(bool packed_row);
void CDCSDKAlterWithSysCatalogCompaction(bool packed_row);
void CDCSDKIntentsBatchReadWithAlterAndTabletLeaderSwitch(bool packed_row);
void EnableVerboseLoggingForModule(const std::string& module, int level);

Result<std::string> GetValueFromMap(const QLMapValuePB& map_value, const std::string& key);

Expand Down
2 changes: 1 addition & 1 deletion src/yb/integration-tests/logging-test.cc
Expand Up @@ -81,7 +81,7 @@ TEST(LoggingTest, TestThrottledLogging) {
TEST(LoggingTest, VModule) {
google::FlagSaver flag_saver;

ASSERT_OK(EnableVerboseLoggingForModule("logging-test", 1));
google::SetVLOGLevel("logging-test", 1);

ASSERT_TRUE(VLOG_IS_ON(1));

Expand Down
2 changes: 1 addition & 1 deletion src/yb/integration-tests/tablet-split-itest-base.cc
Expand Up @@ -367,7 +367,7 @@ TabletSplitITest::TabletSplitITest() = default;
TabletSplitITest::~TabletSplitITest() = default;

void TabletSplitITest::SetUp() {
ASSERT_OK(EnableVerboseLoggingForModule("tablet_split_manager", 2));
google::SetVLOGLevel("tablet_split_manager", 2);
ANNOTATE_UNPROTECTED_WRITE(FLAGS_cleanup_split_tablets_interval_sec) = 1;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_enable_automatic_tablet_splitting) = false;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_TEST_validate_all_tablet_candidates) = true;
Expand Down
2 changes: 1 addition & 1 deletion src/yb/rpc/rpc-test.cc
Expand Up @@ -369,7 +369,7 @@ TEST_F(TestRpc, TestConnectionKeepalive) {
ANNOTATE_UNPROTECTED_WRITE(FLAGS_rpc_connection_timeout_ms) =
MonoDelta(kGcTimeout).ToMilliseconds() / 2;
ANNOTATE_UNPROTECTED_WRITE(FLAGS_enable_rpc_keepalive) = true;
ASSERT_OK(EnableVerboseLoggingForModule("yb_rpc", 5));
google::SetVLOGLevel("yb_rpc", 5);
// Set up server.
HostPort server_addr;
StartTestServer(&server_addr, options);
Expand Down
2 changes: 1 addition & 1 deletion src/yb/server/pprof-path-handler_util-test.cc
Expand Up @@ -39,7 +39,7 @@ namespace yb {

void SamplingProfilerTest::SetUp() {
YBTest::SetUp();
ASSERT_OK(EnableVerboseLoggingForModule("pprof-path-handlers_util", 2));
google::SetVLOGLevel("pprof-path-handlers_util", 2);
}

// Changes to tcmalloc's sample rate only take effect once we take a sample. Upon initialization,
Expand Down
7 changes: 0 additions & 7 deletions src/yb/util/test_util.cc
Expand Up @@ -193,13 +193,6 @@ void OverrideFlagForSlowTests(const std::string& flag_name,
google::SET_FLAG_IF_DEFAULT);
}

Status EnableVerboseLoggingForModule(const std::string& module, int level) {
string old_value = FLAGS_vmodule;
string new_value = Format("$0$1$2=$3", old_value, (old_value.empty() ? "" : ","), module, level);

return SET_FLAG(vmodule, new_value);
}

int SeedRandom() {
int seed;
// Initialize random seed
Expand Down
2 changes: 0 additions & 2 deletions src/yb/util/test_util.h
Expand Up @@ -103,8 +103,6 @@ bool AllowSlowTests();
void OverrideFlagForSlowTests(const std::string& flag_name,
const std::string& new_value);

Status EnableVerboseLoggingForModule(const std::string& module, int level);

// Call srand() with a random seed based on the current time, reporting
// that seed to the logs. The time-based seed may be overridden by passing
// --test_random_seed= from the CLI in order to reproduce a failed randomized
Expand Down

0 comments on commit bf5e672

Please sign in to comment.