Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/15474 )
Change subject: metrics: replace kudu::Bind usage with lambdas in FunctionGauge ...................................................................... metrics: replace kudu::Bind usage with lambdas in FunctionGauge Let's start with a little history lesson. Back in 2014, we imported Chromium's Bind (and associated machinery) into gutil as kudu::Bind. At the time we hadn't migrated to C++11, so we couldn't use lambdas, and the kudu::Bind feature set was rich[1], at least as compared to boost::bind. Now that we're on C++11 and can use lambdas, there's very little that kudu::Bind can do that lambdas can't. The only thing that comes to mind is passing ownership of an object to a callback via the kudu::Owned() or kudu::Passed() wrappers, and we're not using those features. So in the interest of modernizing the Kudu codebase a bit, I'm going to replace kudu::Bind with lambdas. Lambdas are simpler, can be more easily inlined by the compiler, and will result in a reduction of code at the end when we remove kudu::Bind and friends from the repo. This patch kicks off the conversion process by using lambdas in FunctionGauge, which is a heavily used source of kudu::Bind. 1. See commit 66282df07. Change-Id: If60a0dabde1fde1465d73dd9e8edc244fc780c37 Reviewed-on: http://gerrit.cloudera.org:8080/15474 Reviewed-by: Bankim Bhavsar <[email protected]> Tested-by: Adar Dembo <[email protected]> Reviewed-by: Andrew Wong <[email protected]> --- M src/kudu/clock/builtin_ntp.cc M src/kudu/clock/hybrid_clock.cc M src/kudu/clock/logical_clock.cc M src/kudu/codegen/compilation_manager.cc M src/kudu/consensus/consensus-test-util.h M src/kudu/consensus/raft_consensus.cc M src/kudu/master/ts_manager.cc M src/kudu/rpc/retriable_rpc.h M src/kudu/server/tcmalloc_metrics.cc M src/kudu/tablet/tablet.cc M src/kudu/tablet/tablet_replica-test.cc M src/kudu/tablet/tablet_replica.cc M src/kudu/tserver/scanners.cc M src/kudu/tserver/tablet_server-test.cc M src/kudu/tserver/ts_tablet_manager.cc M src/kudu/util/metrics-test.cc M src/kudu/util/metrics.cc M src/kudu/util/metrics.h M src/kudu/util/net/dns_resolver.cc M src/kudu/util/spinlock_profiling.cc M src/kudu/util/thread.cc 21 files changed, 131 insertions(+), 157 deletions(-) Approvals: Bankim Bhavsar: Looks good to me, but someone else must approve Adar Dembo: Verified Andrew Wong: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/15474 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: If60a0dabde1fde1465d73dd9e8edc244fc780c37 Gerrit-Change-Number: 15474 Gerrit-PatchSet: 3 Gerrit-Owner: Adar Dembo <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Andrew Wong <[email protected]> Gerrit-Reviewer: Bankim Bhavsar <[email protected]>
