kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [1/2] kudu git commit: tablet: Include peer uuid in log prefix
Date Tue, 07 Feb 2017 19:45:07 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 8971bc535 -> a72ed600c


tablet: Include peer uuid in log prefix

Also, add LogPrefix() to the tablet mm op.

Change-Id: I21c8f568ab3e05cc9e9376f391477c5c35336983
Reviewed-on: http://gerrit.cloudera.org:8080/5918
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <jdcryans@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/32abe5bc
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/32abe5bc
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/32abe5bc

Branch: refs/heads/master
Commit: 32abe5bc1cc80f10ddb0c080db0bc806a3364384
Parents: 8971bc5
Author: Mike Percy <mpercy@apache.org>
Authored: Thu Feb 2 17:13:17 2017 -0800
Committer: Jean-Daniel Cryans <jdcryans@apache.org>
Committed: Tue Feb 7 19:08:55 2017 +0000

----------------------------------------------------------------------
 src/kudu/tablet/tablet.cc        |  4 ++--
 src/kudu/tablet/tablet.h         |  4 ++--
 src/kudu/tablet/tablet_mm_ops.cc | 40 ++++++++++++++++++++++-------------
 src/kudu/tablet/tablet_mm_ops.h  | 20 ++++++++++++------
 4 files changed, 43 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/32abe5bc/src/kudu/tablet/tablet.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet.cc b/src/kudu/tablet/tablet.cc
index 27f85f7..5f24041 100644
--- a/src/kudu/tablet/tablet.cc
+++ b/src/kudu/tablet/tablet.cc
@@ -890,7 +890,7 @@ Status Tablet::FlushInternal(const RowSetsInCompaction& input,
     // waiting until the check at the end of DoCompactionAndFlush(). This avoids
     // the need to create cfiles and write their headers only to later delete
     // them.
-    LOG(INFO) << "MemRowSet was empty: no flush needed.";
+    LOG_WITH_PREFIX(INFO) << "MemRowSet was empty: no flush needed.";
     return HandleEmptyCompactionOrFlush(input.rowsets(), mrs_being_flushed);
   }
 
@@ -1744,7 +1744,7 @@ void Tablet::PrintRSLayout(ostream* o) {
 }
 
 string Tablet::LogPrefix() const {
-  return Substitute("T $0 ", tablet_id());
+  return Substitute("T $0 P $1: ", tablet_id(), metadata_->fs_manager()->uuid());
 }
 
 ////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/kudu/blob/32abe5bc/src/kudu/tablet/tablet.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet.h b/src/kudu/tablet/tablet.h
index ea2bb42..0d4f82f 100644
--- a/src/kudu/tablet/tablet.h
+++ b/src/kudu/tablet/tablet.h
@@ -360,6 +360,8 @@ class Tablet {
 
   scoped_refptr<server::Clock> clock() const { return clock_; }
 
+  std::string LogPrefix() const;
+
  private:
   friend class Iterator;
   friend class TabletPeerTest;
@@ -483,8 +485,6 @@ class Tablet {
   static int64_t GetReplaySizeForIndex(int64_t min_log_index,
                                        const ReplaySizeMap& size_map);
 
-  std::string LogPrefix() const;
-
   // Test-only lock that synchronizes access to AssignTimestampAndStartTransactionForTests().
   // Tests that use LocalTabletWriter take this lock to synchronize timestamp assignment,
   // transaction start and safe time adjustment.

http://git-wip-us.apache.org/repos/asf/kudu/blob/32abe5bc/src/kudu/tablet/tablet_mm_ops.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_mm_ops.cc b/src/kudu/tablet/tablet_mm_ops.cc
index 345e898..30f5138 100644
--- a/src/kudu/tablet/tablet_mm_ops.cc
+++ b/src/kudu/tablet/tablet_mm_ops.cc
@@ -23,21 +23,30 @@
 #include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet_metrics.h"
 
+using std::string;
 using strings::Substitute;
 
 namespace kudu {
 namespace tablet {
 
+TabletOpBase::TabletOpBase(string name, IOUsage io_usage, Tablet* tablet)
+    : MaintenanceOp(std::move(name), io_usage),
+      tablet_(tablet) {
+}
+
+string TabletOpBase::LogPrefix() const {
+  return tablet_->LogPrefix();
+}
+
 ////////////////////////////////////////////////////////////
 // CompactRowSetsOp
 ////////////////////////////////////////////////////////////
 
 CompactRowSetsOp::CompactRowSetsOp(Tablet* tablet)
-  : MaintenanceOp(Substitute("CompactRowSetsOp($0)", tablet->tablet_id()),
-                  MaintenanceOp::HIGH_IO_USAGE),
+  : TabletOpBase(Substitute("CompactRowSetsOp($0)", tablet->tablet_id()),
+                 MaintenanceOp::HIGH_IO_USAGE, tablet),
     last_num_mrs_flushed_(0),
-    last_num_rs_compacted_(0),
-    tablet_(tablet) {
+    last_num_rs_compacted_(0) {
 }
 
 void CompactRowSetsOp::UpdateStats(MaintenanceOpStats* stats) {
@@ -79,7 +88,8 @@ bool CompactRowSetsOp::Prepare() {
 
 void CompactRowSetsOp::Perform() {
   WARN_NOT_OK(tablet_->Compact(Tablet::COMPACT_NO_FLAGS),
-              Substitute("Compaction failed on $0", tablet_->tablet_id()));
+              Substitute("$0Compaction failed on $1",
+                         LogPrefix(), tablet_->tablet_id()));
 }
 
 scoped_refptr<Histogram> CompactRowSetsOp::DurationHistogram() const {
@@ -95,13 +105,12 @@ scoped_refptr<AtomicGauge<uint32_t> > CompactRowSetsOp::RunningGauge()
const {
 ////////////////////////////////////////////////////////////
 
 MinorDeltaCompactionOp::MinorDeltaCompactionOp(Tablet* tablet)
-  : MaintenanceOp(Substitute("MinorDeltaCompactionOp($0)", tablet->tablet_id()),
-                  MaintenanceOp::HIGH_IO_USAGE),
+  : TabletOpBase(Substitute("MinorDeltaCompactionOp($0)", tablet->tablet_id()),
+                 MaintenanceOp::HIGH_IO_USAGE, tablet),
     last_num_mrs_flushed_(0),
     last_num_dms_flushed_(0),
     last_num_rs_compacted_(0),
-    last_num_rs_minor_delta_compacted_(0),
-    tablet_(tablet) {
+    last_num_rs_minor_delta_compacted_(0) {
 }
 
 void MinorDeltaCompactionOp::UpdateStats(MaintenanceOpStats* stats) {
@@ -150,7 +159,8 @@ bool MinorDeltaCompactionOp::Prepare() {
 
 void MinorDeltaCompactionOp::Perform() {
   WARN_NOT_OK(tablet_->CompactWorstDeltas(RowSet::MINOR_DELTA_COMPACTION),
-              Substitute("Minor delta compaction failed on $0", tablet_->tablet_id()));
+              Substitute("$0Minor delta compaction failed on $1",
+                         LogPrefix(), tablet_->tablet_id()));
 }
 
 scoped_refptr<Histogram> MinorDeltaCompactionOp::DurationHistogram() const {
@@ -166,14 +176,13 @@ scoped_refptr<AtomicGauge<uint32_t> > MinorDeltaCompactionOp::RunningGauge()
con
 ////////////////////////////////////////////////////////////
 
 MajorDeltaCompactionOp::MajorDeltaCompactionOp(Tablet* tablet)
-  : MaintenanceOp(Substitute("MajorDeltaCompactionOp($0)", tablet->tablet_id()),
-                  MaintenanceOp::HIGH_IO_USAGE),
+  : TabletOpBase(Substitute("MajorDeltaCompactionOp($0)", tablet->tablet_id()),
+                 MaintenanceOp::HIGH_IO_USAGE, tablet),
     last_num_mrs_flushed_(0),
     last_num_dms_flushed_(0),
     last_num_rs_compacted_(0),
     last_num_rs_minor_delta_compacted_(0),
-    last_num_rs_major_delta_compacted_(0),
-    tablet_(tablet) {
+    last_num_rs_major_delta_compacted_(0) {
 }
 
 void MajorDeltaCompactionOp::UpdateStats(MaintenanceOpStats* stats) {
@@ -226,7 +235,8 @@ bool MajorDeltaCompactionOp::Prepare() {
 
 void MajorDeltaCompactionOp::Perform() {
   WARN_NOT_OK(tablet_->CompactWorstDeltas(RowSet::MAJOR_DELTA_COMPACTION),
-              Substitute("Major delta compaction failed on $0", tablet_->tablet_id()));
+              Substitute("$0Major delta compaction failed on $1",
+                         LogPrefix(), tablet_->tablet_id()));
 }
 
 scoped_refptr<Histogram> MajorDeltaCompactionOp::DurationHistogram() const {

http://git-wip-us.apache.org/repos/asf/kudu/blob/32abe5bc/src/kudu/tablet/tablet_mm_ops.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_mm_ops.h b/src/kudu/tablet/tablet_mm_ops.h
index 1ea8f95..98ff281 100644
--- a/src/kudu/tablet/tablet_mm_ops.h
+++ b/src/kudu/tablet/tablet_mm_ops.h
@@ -18,6 +18,8 @@
 #ifndef KUDU_TABLET_TABLET_MM_OPS_H_
 #define KUDU_TABLET_TABLET_MM_OPS_H_
 
+#include <string>
+
 #include "kudu/util/locks.h"
 #include "kudu/util/maintenance_manager.h"
 
@@ -31,6 +33,15 @@ namespace tablet {
 
 class Tablet;
 
+class TabletOpBase : public MaintenanceOp {
+ public:
+  TabletOpBase(std::string name, IOUsage io_usage, Tablet* tablet);
+  std::string LogPrefix() const;
+
+ protected:
+  Tablet* const tablet_;
+};
+
 // MaintenanceOp for rowset compaction.
 //
 // This periodically invokes the tablet's CompactionPolicy to select a compaction.  The
@@ -38,7 +49,7 @@ class Tablet;
 // is exposed back to the maintenance manager. As compactions become more fruitful (i.e.
 // more overlapping rowsets), the perf_improvement score goes up, increasing priority
 // with which a compaction on this tablet will be selected by the maintenance manager.
-class CompactRowSetsOp : public MaintenanceOp {
+class CompactRowSetsOp : public TabletOpBase {
  public:
   explicit CompactRowSetsOp(Tablet* tablet);
 
@@ -57,7 +68,6 @@ class CompactRowSetsOp : public MaintenanceOp {
   MaintenanceOpStats prev_stats_;
   uint64_t last_num_mrs_flushed_;
   uint64_t last_num_rs_compacted_;
-  Tablet* const tablet_;
 };
 
 // MaintenanceOp to run minor compaction on delta stores.
@@ -65,7 +75,7 @@ class CompactRowSetsOp : public MaintenanceOp {
 // There is only one MinorDeltaCompactionOp per tablet, so it picks the RowSet that needs
the most
 // work. The RS we end up compacting in Perform() can be different than the one reported
in
 // UpdateStats, we just pick the worst each time.
-class MinorDeltaCompactionOp : public MaintenanceOp {
+class MinorDeltaCompactionOp : public TabletOpBase {
  public:
   explicit MinorDeltaCompactionOp(Tablet* tablet);
 
@@ -86,13 +96,12 @@ class MinorDeltaCompactionOp : public MaintenanceOp {
   uint64_t last_num_dms_flushed_;
   uint64_t last_num_rs_compacted_;
   uint64_t last_num_rs_minor_delta_compacted_;
-  Tablet* const tablet_;
 };
 
 // MaintenanceOp to run major compaction on delta stores.
 //
 // It functions just like MinorDeltaCompactionOp does, except it runs major compactions.
-class MajorDeltaCompactionOp : public MaintenanceOp {
+class MajorDeltaCompactionOp : public TabletOpBase {
  public:
   explicit MajorDeltaCompactionOp(Tablet* tablet);
 
@@ -114,7 +123,6 @@ class MajorDeltaCompactionOp : public MaintenanceOp {
   uint64_t last_num_rs_compacted_;
   uint64_t last_num_rs_minor_delta_compacted_;
   uint64_t last_num_rs_major_delta_compacted_;
-  Tablet* const tablet_;
 };
 
 } // namespace tablet


Mime
View raw message