1

The problem is when I'm trying to query smth from hive using my application e.g. analyze table table_entity compute statistics or for example select count(*) from table_entity sometimes I got such exception:java.net.SocketTimeoutException: Read timed out

But when for example I query show tables or show tblproperties table_entity I didn't get such exception.

Has anyone faced with this problem?

Thank you in advance.

tcafrin22
  • 59
  • 1
  • 10
  • Just try to increase JVM MAX Heap size of your cluster – Ankur Singh Sep 28 '17 at 17:40
  • you can go to this link https://stackoverflow.com/questions/6452765/how-to-increase-heap-size-of-jvm – Ankur Singh Sep 28 '17 at 17:41
  • @AnkurKumar I've tried to change it on my cloudera cluster in that way `export CMF_JAVA_OPTS="-Xms512m -Xmx3G -Xmx3G -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp"` but this does not helped – tcafrin22 Sep 29 '17 at 08:26
  • @AnkurSingh I know it's been a while since this question was posted, but could you solve this problem? I'm facing this issue with a coworker and there's nothing on the web could help. – Sameh Sharaf Feb 21 '19 at 09:27
  • please checkout my answer, this will surely help! – Deepesh Rehi Apr 25 '19 at 10:30

1 Answers1

3

I know this is little late, but I was stuck with same sort of problem where we were not able to drop a table, we raised a case with Cloudera and following was the suggestion provided by them:

Upon investigating the logs and the stack of messages we have observed during the execution of the DROP query for the table "tableName", the query got failed due to "Read time out" in HiveServer2 from HiveMetastore. This means the drop operation of the table was not able to get complete at Metadata level. (In general - DROP operation deletes the metadata details of a table from HMS) We are suspecting that the metadata of this table is not up to date and might have more data which could have led to the timeout. Could you please perform the below steps and let us know your feedback?

  1. Login to Beeline-Hive.

  2. Update the partition level metadata in Hive Metastore: MSCK REPAIR TABLE db.table_name DROP PARTITIONS;

  3. Compute the statistics for the table: ANALYZE TABLE db.tableName partition(col1, col2) compute statistics noscan;

  4. Drop the partitions of the table first using the query: ALTER TABLE db.tableName DROP [IF EXISTS] PARTITION partition_spec[, PARTITION partition_spec, ...] Please replace the partition values in the above command accordingly as per the partitions of the table.

  5. Increase the Hive Metastore client socket timeout. set hive.metastore.client.socket.timeout=1500. This will give an increased socket time out only for this session. Hence run the next step #6 in the same session.

  6. Drop the table tableName; DROP TABLE db.tableName;

Although the question here is regarding Analyze table issue but this answer is intended to cover all the other issues related to Read Timeout Error.

I have shown my scenario(drop statement), however these steps will surely help across all sorts of queries which leads to the Read timeout Exception.

Cheers!

Deepesh Rehi
  • 883
  • 8
  • 31