carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] carbondata git commit: updated timeout message
Date Thu, 08 Jun 2017 16:51:04 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master ed205fe23 -> 40284900f


updated timeout message


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

Branch: refs/heads/master
Commit: f66b8a186bb1e0199835b7e2d47dda8b9443baab
Parents: ed205fe
Author: kunal642 <kunal.kapoor@knoldus.in>
Authored: Thu May 25 16:06:39 2017 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Thu Jun 8 22:19:56 2017 +0530

----------------------------------------------------------------------
 .../client/DictionaryClientHandler.java         |  9 ++++++++-
 .../dictionary/client/DictionaryClientTest.java | 20 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/f66b8a18/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java
b/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java
index 1ed8b36..9922523 100644
--- a/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java
+++ b/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java
@@ -91,7 +91,14 @@ public class DictionaryClientHandler extends ChannelInboundHandlerAdapter
{
     try {
       dictionaryMessage = responseMsgQueue.poll(100, TimeUnit.SECONDS);
       if (dictionaryMessage == null) {
-        throw new RuntimeException("Request timed out for key : " + key);
+        StringBuilder message = new StringBuilder();
+        message.append("DictionaryMessage { ColumnName: ")
+            .append(key.getColumnName())
+            .append(", DictionaryValue: ")
+            .append(key.getDictionaryValue())
+            .append(", type: ")
+            .append(key.getType());
+        throw new RuntimeException("Request timed out for key : " + message);
       }
       return dictionaryMessage;
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/carbondata/blob/f66b8a18/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java
b/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java
index a96e364..60d3c26 100644
--- a/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java
@@ -19,6 +19,8 @@ package org.apache.carbondata.core.dictionary.client;
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessage;
@@ -33,6 +35,8 @@ import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
 import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
 import org.apache.carbondata.core.util.CarbonProperties;
 
+import mockit.Mock;
+import mockit.MockUp;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -160,6 +164,22 @@ public class DictionaryClientTest {
     // Shutdown the server
   }
 
+  @Test public void testToCheckIfCorrectTimeOutExceptionMessageIsThrown() {
+    new MockUp<LinkedBlockingQueue<DictionaryMessage>>() {
+      @SuppressWarnings("unused")
+      @Mock
+      DictionaryMessage poll(long timeout, TimeUnit unit) throws InterruptedException {
+        return null;
+      }
+    };
+    try {
+      testClient();
+      Assert.fail();
+    } catch (Exception e) {
+      Assert.assertFalse(e.getMessage().contains("data"));
+    }
+  }
+
   @After public void tearDown() {
     // Cleanup created files
     CarbonMetadata.getInstance().removeTable(tableInfo.getTableUniqueName());


Mime
View raw message