-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3571: Extract HeartbeatDataProvider from Heartbeater
Summary: We have different logic inside `Heartbeater::Thread::TryHeartbeat` single method, particularly functionality for gathering tserver metrics for putting them into Heartbeat RPC. For tablet splitting we also need to put splitting-related information about tablets into Hearbeat RPC. Overloading `Heartbeater::Thread::TryHeartbeat` with such extra functionality leads to unnecessary dependencies, tight coupling and unnecessary knowledge of Heartbeater about other components. Also it makes Heartbeater code larger each time we need to add something new into Heartbeat. This revision introduces HeartbeatDataProvider interface and moves out of Heartbeater logic for gathering tserver metrics into TServerMetricsHeartbeatDataProvider thus reducing Heartbeater complexity and removing unnecessary dependencies. In subsequent revision for tablet splitting feature this framework will be used to implement TabletSplittingDataProvider for sending tablet splitting related data inside Heartbeat RPC. Fixed lint issues Test Plan: Jenkins Reviewers: mikhail, sergei, bogdan Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D7913
- Loading branch information
Showing
11 changed files
with
319 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
// or implied. See the License for the specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
#include "yb/tserver/heartbeater_factory.h" | ||
|
||
#include "yb/tserver/tserver_metrics_heartbeat_data_provider.h" | ||
|
||
namespace yb { | ||
namespace tserver { | ||
|
||
std::unique_ptr<Heartbeater> CreateHeartbeater( | ||
const TabletServerOptions& options, TabletServer* server) { | ||
std::vector<std::unique_ptr<HeartbeatDataProvider>> data_providers; | ||
data_providers.push_back( | ||
std::make_unique<TServerMetricsHeartbeatDataProvider>(server)); | ||
return std::make_unique<Heartbeater>(options, server, std::move(data_providers)); | ||
} | ||
|
||
} // namespace tserver | ||
} // namespace yb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
// or implied. See the License for the specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
#ifndef YB_TSERVER_HEARTBEATER_FACTORY_H | ||
#define YB_TSERVER_HEARTBEATER_FACTORY_H | ||
|
||
#include "yb/tserver/heartbeater.h" | ||
|
||
namespace yb { | ||
namespace tserver { | ||
|
||
std::unique_ptr<Heartbeater> CreateHeartbeater( | ||
const TabletServerOptions& options, TabletServer* server); | ||
|
||
} // namespace tserver | ||
} // namespace yb | ||
|
||
#endif // YB_TSERVER_HEARTBEATER_FACTORY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.