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:12:40 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1 4303ea03d -> a81f5e7ee


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

Branch: refs/heads/branch-1
Commit: a81f5e7ee2794e4c8d52d512082a873d647a0ad7
Parents: 4303ea0
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:06:14 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/a81f5e7e/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 585a647..73d1ddb 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -34,6 +34,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.LinkedHashMap;
 import java.util.List;
@@ -229,6 +230,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