hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From the...@apache.org
Subject hive git commit: HIVE-10815 : Let HiveMetaStoreClient Choose MetaStore Randomly (Nemon Lou via Thejas Nair)
Date Mon, 04 Jul 2016 20:13:02 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2.1 b8ebe809d -> c1665cc8e


HIVE-10815 : Let HiveMetaStoreClient Choose MetaStore Randomly (Nemon Lou via Thejas Nair)


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

Branch: refs/heads/branch-2.1
Commit: c1665cc8e311cb9b7e59155f30fed418a39f87cf
Parents: b8ebe80
Author: Nemon Lou <loudongfeng@huawei.com>
Authored: Mon Jul 4 13:03:44 2016 -0700
Committer: Thejas Nair <thejas@hortonworks.com>
Committed: Mon Jul 4 13:12:57 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/c1665cc8/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 4487828..0b2f77b 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -158,6 +158,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -266,6 +267,10 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
           metastoreUris[i++] = tmpUri;
 
         }
+        // make metastore URIS random
+        List uriList = Arrays.asList(metastoreUris);
+        Collections.shuffle(uriList);
+        metastoreUris = (URI[]) uriList.toArray();
       } catch (IllegalArgumentException e) {
         throw (e);
       } catch (Exception e) {


Mime
View raw message