You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2016/07/04 20:03:54 UTC

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

Repository: hive
Updated Branches:
  refs/heads/master dbb76ead4 -> 91068a23e


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/91068a23
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/91068a23
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/91068a23

Branch: refs/heads/master
Commit: 91068a23ee32e856b90121f29f0a8cf8c7a00f40
Parents: dbb76ea
Author: Nemon Lou <lo...@huawei.com>
Authored: Mon Jul 4 13:03:44 2016 -0700
Committer: Thejas Nair <th...@hortonworks.com>
Committed: Mon Jul 4 13:03:44 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/91068a23/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 f47dfa1..44d73d4 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;
@@ -268,6 +269,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) {