incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixed BLUR-252
Date Fri, 04 Oct 2013 20:38:27 GMT
Updated Branches:
  refs/heads/master 89e47b7c9 -> d6d83b487


Fixed BLUR-252


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

Branch: refs/heads/master
Commit: d6d83b487bb31960db39fa6fde5b887f8deacd0b
Parents: 89e47b7
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Oct 4 16:38:04 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Oct 4 16:38:23 2013 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/thrift/TableAdmin.java    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d6d83b48/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
index 271ad62..4bb826e 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
@@ -98,6 +98,7 @@ public abstract class TableAdmin implements Iface {
     try {
       TableContext.clear();
       BlurUtil.validateTableName(tableDescriptor.getName());
+      assignClusterIfNull(tableDescriptor);
       _clusterStatus.createTable(tableDescriptor);
     } catch (Exception e) {
       LOG.error("Unknown error during create of [table={0}, tableDescriptor={1}]", e, tableDescriptor.name,
@@ -109,6 +110,17 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
+  private void assignClusterIfNull(TableDescriptor tableDescriptor) throws BlurException,
TException {
+    if (tableDescriptor.getCluster() == null) {
+      List<String> shardClusterList = shardClusterList();
+      if (shardClusterList != null && shardClusterList.size() == 1) {
+        String cluster = shardClusterList.get(0);
+        tableDescriptor.setCluster(cluster);
+        LOG.info("Assigning table [{0}] to the single default cluster [{1}]", tableDescriptor.getName(),
cluster);
+      }
+    }
+  }
+
   @Override
   public final void disableTable(String table) throws BlurException, TException {
     try {


Mime
View raw message