Repository: kudu
Updated Branches:
  refs/heads/master 80923d690 -> 0ce5ba594


[java client] Improve and hide OperationResponse#getWriteTimestamp

That method was returning a HT-encoded ts, not a ts in microseconds. It's
also not meant for public consumption just yet, the same way
AbstractKuduScannerBuilder#snapshotTimestampRaw is.

Change-Id: I8cfc6fcc1d0607a94bb8be9e5a0d53a4987920af
Reviewed-on: http://gerrit.cloudera.org:8080/4487
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <dral...@apache.org>
Reviewed-by: Adar Dembo <a...@cloudera.com>


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

Branch: refs/heads/master
Commit: 519b2227d91936f10412a4fa509e4defe503d53c
Parents: 80923d6
Author: Jean-Daniel Cryans <jdcry...@apache.org>
Authored: Tue Sep 20 16:55:28 2016 -0700
Committer: Jean-Daniel Cryans <jdcry...@apache.org>
Committed: Thu Sep 22 00:33:14 2016 +0000

----------------------------------------------------------------------
 .../org/apache/kudu/client/AbstractKuduScannerBuilder.java   | 2 +-
 .../main/java/org/apache/kudu/client/OperationResponse.java  | 6 +++---
 .../src/test/java/org/apache/kudu/client/TestHybridTime.java | 8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/519b2227/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
index 54753dd..ae7b5d4 100644
--- 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
+++ 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
@@ -220,7 +220,7 @@ public abstract class AbstractKuduScannerBuilder
    * Sets a previously encoded HT timestamp as a snapshot timestamp, for 
tests. None is used by
    * default.
    * Requires that the ReadMode is READ_AT_SNAPSHOT.
-   * @param htTimestamp a long representing a HybridClock-encoded timestamp
+   * @param htTimestamp a long representing a HybridTime-encoded timestamp
    * @return this instance
    * @throws IllegalArgumentException on build(), if the timestamp is less 
than 0 or if the
    *                                  read mode was not set to READ_AT_SNAPSHOT

http://git-wip-us.apache.org/repos/asf/kudu/blob/519b2227/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java 
b/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
index 794e341..93d1a63 100644
--- 
a/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
+++ 
b/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
@@ -78,10 +78,10 @@ public class OperationResponse extends KuduRpcResponse {
 
   /**
    * Gives the write timestamp that was returned by the Tablet Server.
-   * @return a timestamp in milliseconds, 0 if the external consistency mode 
set
-   *         in AsyncKuduSession wasn't CLIENT_PROPAGATED, or if the operation 
failed.
+   * @return a long representing a HybridTime-encoded timestamp
    */
-  public long getWriteTimestamp() {
+  @InterfaceAudience.Private
+  public long getWriteTimestampRaw() {
     return writeTimestamp;
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/519b2227/java/kudu-client/src/test/java/org/apache/kudu/client/TestHybridTime.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestHybridTime.java 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestHybridTime.java
index a74594e..fdf18ba 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestHybridTime.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestHybridTime.java
@@ -93,8 +93,8 @@ public class TestHybridTime extends BaseKuduTest {
       row.addString(schema.getColumnByIndex(0).getName(), keys[i]);
       Deferred<OperationResponse> d = session.apply(insert);
       OperationResponse response = d.join(DEFAULT_SLEEP);
-      assertTrue(response.getWriteTimestamp() != 0);
-      clockValues = 
HTTimestampToPhysicalAndLogical(response.getWriteTimestamp());
+      assertTrue(response.getWriteTimestampRaw() != 0);
+      clockValues = 
HTTimestampToPhysicalAndLogical(response.getWriteTimestampRaw());
       LOG.debug("Clock value after write[" + i + "]: " + new 
Date(clockValues[0] / 1000).toString()
         + " Logical value: " + clockValues[1]);
       // on the very first write we update the clock into the future
@@ -128,8 +128,8 @@ public class TestHybridTime extends BaseKuduTest {
         1, responses.size());
 
       OperationResponse response = responses.get(0);
-      assertTrue(response.getWriteTimestamp() != 0);
-      clockValues = 
HTTimestampToPhysicalAndLogical(response.getWriteTimestamp());
+      assertTrue(response.getWriteTimestampRaw() != 0);
+      clockValues = 
HTTimestampToPhysicalAndLogical(response.getWriteTimestampRaw());
       LOG.debug("Clock value after write[" + i + "]: " + new 
Date(clockValues[0] / 1000).toString()
         + " Logical value: " + clockValues[1]);
       assertEquals(clockValues[0], previousPhysicalValue);

Reply via email to