Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/20868 )
Change subject: KUDU-3543 Fix Content-Type headers ...................................................................... Patch Set 5: (1 comment) http://gerrit.cloudera.org:8080/#/c/20868/4/src/kudu/tserver/tablet_server-test.cc File src/kudu/tserver/tablet_server-test.cc: http://gerrit.cloudera.org:8080/#/c/20868/4/src/kudu/tserver/tablet_server-test.cc@2261 PS4, Line 2261: // Use to compare monitored item values. : struct MetricSnapshot { : int64_t min_value; : int64_t mean_value; : int64_t max_value; : int64_t total_count; : int64_t total_sum; : : // Reset the value. : void updateMetricSnapshot(const scoped_refptr<Histogram>& his) { : min_value = his->histogram()->MinValue(); : mean_value = his->histogram()->MeanValue(); : max_value = his->histogram()->MaxValue(); : total_count = his->histogram()->TotalCount(); : total_sum = his->histogram()->TotalSum(); : } : : bool operator==(const MetricSnapshot& ms) const { : return min_value == ms.min_value && : mean_value == ms.mean_value && : max_value == ms.max_value && : total_count == ms.total_count && : total_sum == ms.total_sum; : } : : bool operator!=(const MetricSnapshot& ms) const { : return !(*this == ms); : } : }; : : class ScannerScansTest : public TabletServerTest { : public: : void SetUp() override { : NO_FATALS(TabletServerTestBase::SetUp()); : NO_FATALS(StartTabletServer(/*num_data_dirs=*/1)); : : // Instantiate scans metrics. : scoped_refptr<TabletReplica> tablet; : ASSERT_TRUE(mini_server_->server()->tablet_manager() : ->LookupTablet(kTabletId, &tablet)); : ASSERT_TRUE(tablet->tablet()->GetMetricEntity()); : scan_duration_wall_time_ = : METRIC_scan_duration_wall_time.Instantiate( : tablet->tablet()->GetMetricEntity()); : scan_duration_system_time_ = : METRIC_scan_duration_system_time.Instantiate( : tablet->tablet()->GetMetricEntity()); : scan_duration_user_time_ = : METRIC_scan_duration_user_time.Instantiate( : tablet->tablet()->GetMetricEntity()); : } : : void GetMetricSnapshot() { : wall_metric_snapshot_.updateMetricSnapshot(scan_duration_wall_time_); : system_metric_snapshot_.updateMetricSnapshot(scan_duration_system_time_); : user_metric_snapshot_.updateMetricSnapshot(scan_duration_user_time_); : } : : // Metrics changed. : void TestAffectedBaseSnapshot() { : MetricSnapshot wall_tmp; : MetricSnapshot system_tmp; : MetricSnapshot user_tmp; : wall_tmp.updateMetricSnapshot(scan_duration_wall_time_); : ASSERT_NE(wall_tmp, wall_metric_snapshot_); : system_tmp.updateMetricSnapshot(scan_duration_system_time_); : ASSERT_NE(system_tmp, system_metric_snapshot_); : user_tmp.updateMetricSnapshot(scan_duration_user_time_); : ASSERT_NE(user_tmp, user_metric_snapshot_); : } : : // No metrics changed. : void TestNoAffectedBaseSnapshot() { : MetricSnapshot wall_tmp; : MetricSnapshot system_tmp; : MetricSnapshot user_tmp; : wall_tmp.updateMetricSnapshot(scan_duration_wall_time_); : ASSERT_EQ(wall_tmp, wall_metric_snapshot_); : system_tmp.updateMetricSnapshot(scan_duration_system_time_); : ASSERT_EQ(system_tmp, system_metric_snapshot_); : user_tmp.updateMetricSnapshot(scan_duration_user_time_); : ASSERT_EQ(user_tmp, user_metric_snapshot_); : } : : void DoOrderedScanTest(const Schema& projection, : const string& expected_rows_as_string); : : void ScanYourWritesTest(uint64_t propagated_timestamp, : ScanResponsePB* resp); : : private: : scoped_refptr<Histogram> scan_duration_wall_time_; : scoped_refptr<Histogram> scan_duration_system_time_; : scoped_refptr<Histogram> scan_duration_user_time_; : MetricSnapshot wall_metric_snapshot_; : MetricSnapshot system_metric_snapshot_; : MetricSnapshot user_metric_snapshot_; : }; : : // Test that the metrics are affected by successful ordered scans. : TEST_F(ScannerScansTest, TestScanMetricsAffectedOnOrderedScan) { : NO_FATALS(GetMetricSnapshot()); : : SchemaBuilder sb; : for (int i = schema_.num_key_columns(); i < schema_.num_columns(); i++) { : sb.AddColumn(schema_.column(i), false); : } : const Schema& projection = sb.BuildWithoutIds(); : DoOrderedScanTest(projection, R"((int32 int_val=$1, string string_val="hello $0"))"); : : NO_FATALS(TestAffectedBaseSnapshot()); : } : : // Test that the metrics are affected by successful scans on own write. : TEST_F(ScannerScansTest, TestScanMetricsAffectedOnYourWritesTest) { : NO_FATALS(GetMetricSnapshot()); : : // Perform a write. : InsertTestRowsRemote(0, 1, 1, nullptr, kTabletId); : : ScanResponsePB resp; : ScanYourWritesTest(Timestamp::kMin.ToUint64(), &resp); : : NO_FATALS(TestAffectedBaseSnapshot()); : } : : // Test that the metrics are not affected by a failed scan. : TEST_F(ScannerScansTest, TestScanMetricsNoAffected) { : NO_FATALS(GetMetricSnapshot()); : : ScanRequestPB req; : ScanResponsePB resp; : RpcController rpc; : req.set_scanner_id("does-not-exist"); : : SCOPED_TRACE(SecureDebugString(req)); : ASSERT_OK(proxy_->Scan(req, &resp, &rpc)); : SCOPED_TRACE(SecureDebugString(resp)); : ASSERT_TRUE(resp.has_error()); : : NO_FATALS(TestNoAffectedBaseSnapshot()); : } : : class ExpiredScannerParamTest : : public ScannerScansTest, > seems like this part and the 4 new metrics declarations got into this chang Rebased the pach to fix this. Sorry about the mess! -- To view, visit http://gerrit.cloudera.org:8080/20868 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I746dcfbaadb2fb95292c2d4047cb7adb9971b42f Gerrit-Change-Number: 20868 Gerrit-PatchSet: 5 Gerrit-Owner: Marton Greber <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Attila Bukor <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Marton Greber <[email protected]> Gerrit-Reviewer: Tidy Bot (241) Gerrit-Reviewer: Zoltan Chovan <[email protected]> Gerrit-Comment-Date: Wed, 19 Jun 2024 13:03:53 +0000 Gerrit-HasComments: Yes
