incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twilli...@apache.org
Subject git commit: Fix update task - BLUR-22
Date Tue, 02 Oct 2012 02:21:16 GMT
Updated Branches:
  refs/heads/blur-22-blurtask-updates [created] 4e06a45ba


Fix update task - BLUR-22


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

Branch: refs/heads/blur-22-blurtask-updates
Commit: 4e06a45ba0091211a2b7777d9e32d2bda1252e4b
Parents: 16dfa11
Author: Tim <williamstw@gmail.com>
Authored: Mon Oct 1 22:20:51 2012 -0400
Committer: Tim <williamstw@gmail.com>
Committed: Mon Oct 1 22:20:51 2012 -0400

----------------------------------------------------------------------
 .../clusterstatus/ZookeeperClusterStatus.java      |    1 -
 .../clusterstatus/ZookeeperPathConstants.java      |    4 --
 .../indexserver/DistributedIndexServer.java        |    1 -
 .../java/org/apache/blur/mapreduce/BlurTask.java   |   31 +++++++--------
 4 files changed, 15 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e06a45b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
index 81ea5f4..e2cd132 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
@@ -704,7 +704,6 @@ public class ZookeeperClusterStatus extends ClusterStatus {
       BlurUtil.createPath(_zk, ZookeeperPathConstants.getTableCompressionCodecPath(cluster,
table), compressionCodec.getClass().getName().getBytes());
       BlurUtil.createPath(_zk, ZookeeperPathConstants.getTableCompressionBlockSizePath(cluster,
table), Integer.toString(compressionBlockSize).getBytes());
       BlurUtil.createPath(_zk, ZookeeperPathConstants.getTableSimilarityPath(cluster, table),
similarity.getClass().getName().getBytes());
-      BlurUtil.createPath(_zk, ZookeeperPathConstants.getLockPath(cluster, table), null);
       BlurUtil.createPath(_zk, ZookeeperPathConstants.getTableFieldNamesPath(cluster, table),
null);
       if (tableDescriptor.readOnly) {
         BlurUtil.createPath(_zk, ZookeeperPathConstants.getTableReadOnlyPath(cluster, table),
null);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e06a45b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperPathConstants.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperPathConstants.java
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperPathConstants.java
index cb9eeed..25bc8f1 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperPathConstants.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperPathConstants.java
@@ -79,10 +79,6 @@ public class ZookeeperPathConstants {
     return getTablePath(cluster, table) + "/compression-blocksize";
   }
 
-  public static String getLockPath(String cluster, String table) {
-    return getTablePath(cluster, table) + "/locks";
-  }
-
   public static String getTableBlockCachingFileTypesPath(String cluster, String table) {
     return getTablePath(cluster, table) + "/blockcachingfiletypes";
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e06a45b/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
b/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
index 2d60131..efbc438 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
@@ -223,7 +223,6 @@ public class DistributedIndexServer extends AbstractIndexServer {
     String tablesPath = ZookeeperPathConstants.getTablesPath(cluster);
     List<String> tables = _zookeeper.getChildren(tablesPath, false);
     for (String table : tables) {
-      BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getLockPath(cluster, table));
       BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getTableFieldNamesPath(cluster,
table));
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e06a45b/src/blur-mapred/src/main/java/org/apache/blur/mapreduce/BlurTask.java
----------------------------------------------------------------------
diff --git a/src/blur-mapred/src/main/java/org/apache/blur/mapreduce/BlurTask.java b/src/blur-mapred/src/main/java/org/apache/blur/mapreduce/BlurTask.java
index 7e57070..39ab194 100644
--- a/src/blur-mapred/src/main/java/org/apache/blur/mapreduce/BlurTask.java
+++ b/src/blur-mapred/src/main/java/org/apache/blur/mapreduce/BlurTask.java
@@ -27,8 +27,9 @@ import java.util.List;
 
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.manager.clusterstatus.ZookeeperPathConstants;
+import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.TableDescriptor;
 import org.apache.blur.utils.BlurConstants;
 import org.apache.blur.utils.BlurUtil;
@@ -45,8 +46,6 @@ import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.transport.TIOStreamTransport;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooKeeper;
 
 
 public class BlurTask implements Writable {
@@ -88,7 +87,6 @@ public class BlurTask implements Writable {
   private int _maxRecordsPerRow = 16384;
   private boolean _optimize = true;
   private INDEXING_TYPE _indexingType = INDEXING_TYPE.REBUILD;
-  private transient ZooKeeper _zooKeeper;
 
   public String getShardName(TaskAttemptContext context) {
     TaskAttemptID taskAttemptID = context.getTaskAttemptID();
@@ -176,26 +174,27 @@ public class BlurTask implements Writable {
   }
 
   private void checkTable() {
-    ZookeeperClusterStatus status = new ZookeeperClusterStatus(_zooKeeper);
-    // check if table exists
+    Iface client = BlurClient.getClient("");
     String cluster = _tableDescriptor.cluster;
     String table = _tableDescriptor.name;
-    if (!status.exists(false, cluster, table)) {
-      throw new RuntimeException("Table [" + table + "] in cluster [" + cluster + "] does
not exist.");
-    }
-    // check if table is locked
+    
     try {
-      List<String> children = _zooKeeper.getChildren(ZookeeperPathConstants.getLockPath(cluster,
table), false);
-      if (!children.isEmpty()) {
+      List<String> tableList = client.tableList();
+      if(!tableList.contains(table)){
+        throw new RuntimeException("Table [" + table + "] in cluster [" + cluster + "] does
not exist.");
+      }
+      
+      if(!client.describe(table).isReadOnly()) {
         throw new RuntimeException("Table [" + table + "] in cluster [" + cluster + "] has
write locks enabled, cannot perform update.");
       }
-    } catch (KeeperException e) {
+    } catch(TException e) {
       throw new RuntimeException(e);
-    } catch (InterruptedException e) {
+    } catch(BlurException e) {
       throw new RuntimeException(e);
     }
 
-  }
+    // Remove the getLockpath constants too:)
+   }
 
   public static BlurTask read(Configuration configuration) throws IOException {
     byte[] blurTaskBs = Base64.decodeBase64(configuration.get(BLUR_BLURTASK));


Mime
View raw message