You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2016/12/06 14:40:03 UTC

[2/2] kudu git commit: Output more info when a snapshot scan fails due to history gc

Output more info when a snapshot scan fails due to history gc

This just adds some niceties to the error message, like
both timestamps and the physical time difference between
them.

Change-Id: Id488fd0366a8e8c5c2a21289a835207ea795ad20
Reviewed-on: http://gerrit.cloudera.org:8080/5374
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
Reviewed-by: Mike Percy <mp...@apache.org>


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

Branch: refs/heads/master
Commit: 881cc8e981dbe51ba21fffdb575abd3cf8fe3e5e
Parents: bacd946
Author: David Alves <dr...@apache.org>
Authored: Mon Dec 5 22:50:04 2016 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Tue Dec 6 14:39:40 2016 +0000

----------------------------------------------------------------------
 src/kudu/tserver/tablet_service.cc | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/881cc8e9/src/kudu/tserver/tablet_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_service.cc b/src/kudu/tserver/tablet_service.cc
index 5177a5a..51b5563 100644
--- a/src/kudu/tserver/tablet_service.cc
+++ b/src/kudu/tserver/tablet_service.cc
@@ -1535,7 +1535,6 @@ Status TabletServiceImpl::HandleNewScanRequest(TabletPeer* tablet_peer,
   // end up with a valid snapshot in that case. It would be more correct to
   // initialize the row iterator and then select the latest timestamp
   // represented by those open files in that case.
-  Timestamp ancient_history_mark;
   tablet::HistoryGcOpts history_gc_opts = tablet->GetHistoryGcOpts();
   if (scan_pb.read_mode() == READ_AT_SNAPSHOT &&
       history_gc_opts.IsAncientHistory(*snap_timestamp)) {
@@ -1544,9 +1543,15 @@ Status TabletServiceImpl::HandleNewScanRequest(TabletPeer* tablet_peer,
     // We have to check after we open the iterator in order to avoid a TOCTOU
     // error.
     *error_code = TabletServerErrorPB::INVALID_SNAPSHOT;
-    return Status::InvalidArgument("Snapshot timestamp is earlier than the ancient history mark",
-                                   "consider increasing the value of the configuration parameter "
-                                   "--tablet_history_max_age_sec");
+    return Status::InvalidArgument(
+        Substitute("Snapshot timestamp is earlier than the ancient history mark. Consider "
+                   "increasing the value of the configuration parameter "
+                   "--tablet_history_max_age_sec. Snapshot timestamp: $0 "
+                   "Ancient History Mark: $1 Physical time difference: $2",
+                   server_->clock()->Stringify(*snap_timestamp),
+                   server_->clock()->Stringify(history_gc_opts.ancient_history_mark()),
+                   server_->clock()->GetPhysicalComponentDifference(
+                       *snap_timestamp, history_gc_opts.ancient_history_mark()).ToString()));
   }
 
   *has_more_results = iter->HasNext();