My bad. Thanks Aaron.
On Wed, Oct 30, 2013 at 4:35 AM, <[email protected]> wrote: > Updated Branches: > refs/heads/master 46ce5dc36 -> 2fb577652 > > > This file was added in error > > > Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo > Commit: > http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/2fb57765 > Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/2fb57765 > Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/2fb57765 > > Branch: refs/heads/master > Commit: 2fb577652b5dc6b108ed6a194f1090ed1ca566ac > Parents: 46ce5dc > Author: Aaron McCurry <[email protected]> > Authored: Wed Oct 30 07:35:07 2013 -0400 > Committer: Aaron McCurry <[email protected]> > Committed: Wed Oct 30 07:35:07 2013 -0400 > > ---------------------------------------------------------------------- > blur-289.patch | 151 ---------------------------------------------------- > 1 file changed, 151 deletions(-) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2fb57765/blur-289.patch > ---------------------------------------------------------------------- > diff --git a/blur-289.patch b/blur-289.patch > deleted file mode 100644 > index 7cb04cb..0000000 > --- a/blur-289.patch > +++ /dev/null > @@ -1,151 +0,0 @@ > -From 12e7afe3e630783fbafacd09967d25d89643e1bd Mon Sep 17 00:00:00 2001 > -From: Rahul Challapalli <[email protected]> > -Date: Sun, 27 Oct 2013 23:41:43 -0700 > -Subject: [PATCH] Modified the way in which TableDescriptor object is > - serialized and stored in zookeeper > - > ---- > - .../clusterstatus/ZookeeperClusterStatus.java | 90 > +++++++++++++++------- > - 1 file changed, 64 insertions(+), 26 deletions(-) > - > -diff --git > a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java > b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java > -index 9a0f420..0ce0d55 100644 > ---- > a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java > -+++ > b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java > -@@ -37,6 +37,10 @@ import org.apache.blur.BlurConfiguration; > - import org.apache.blur.log.Log; > - import org.apache.blur.log.LogFactory; > - import org.apache.blur.lucene.search.FairSimilarity; > -+import org.apache.blur.thirdparty.thrift_0_9_0.TDeserializer; > -+import org.apache.blur.thirdparty.thrift_0_9_0.TException; > -+import org.apache.blur.thirdparty.thrift_0_9_0.TSerializer; > -+import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TBinaryProtocol; > - import org.apache.blur.thrift.generated.TableDescriptor; > - import org.apache.blur.utils.BlurConstants; > - import org.apache.blur.utils.BlurUtil; > -@@ -409,6 +413,52 @@ public class ZookeeperClusterStatus extends > ClusterStatus { > - TableDescriptor tableDescriptor = new TableDescriptor(); > - try { > - checkIfOpen(); > -+ > -+ TDeserializer deserializer = new TDeserializer(new > TBinaryProtocol.Factory()); > -+ String blurTablePath = > ZookeeperPathConstants.getTablePath(cluster, table); > -+ byte[] bytes = getData(blurTablePath); > -+ > -+ if (bytes == null || bytes.length == 0) { > -+ /* > -+ * table descriptor is stored in an older format where we > manually > -+ * serialized each field into a different zookeeper node > -+ * so we fetch it using old code and serialize it again with > thrift protocol > -+ */ > -+ getOldTableDescriptor(useCache, cluster, table, tableDescriptor); > -+ > -+ // store it using thrift protocol > -+ byte[] newFormatBytes = > serializeTableDescriptor(tableDescriptor); > -+ BlurUtil.createPath(_zk, blurTablePath, newFormatBytes); > -+ > -+ // remove old child nodes > -+ List<String> list = _zk.getChildren(blurTablePath, false); > -+ for (String p : list) { > -+ BlurUtil.removeAll(_zk, blurTablePath + "/" + p); > -+ } > -+ } else { > -+ deserializer.deserialize(tableDescriptor, bytes); > -+ } > -+ > -+ > -+ } catch (TException e) { > -+ throw new RuntimeException(e); > -+ } catch (KeeperException e) { > -+ throw new RuntimeException(e); > -+ } catch (InterruptedException e) { > -+ throw new RuntimeException(e); > -+ } finally { > -+ long e = System.nanoTime(); > -+ LOG.debug("trace getTableDescriptor took [" + (e - s) / 1000000.0 > + " ms]"); > -+ } > -+ tableDescriptor.cluster = cluster; > -+ _tableDescriptorCache.put(table, tableDescriptor); > -+ return tableDescriptor; > -+ } > -+ > -+ private TableDescriptor getOldTableDescriptor(boolean useCache, String > cluster, String table, TableDescriptor tableDescriptor) { > -+ long s = System.nanoTime(); > -+ try { > -+ > - NullPointerException npe = null; > - LOOP: for (int i = 0; i < 10; i++) { > - npe = null; > -@@ -444,13 +494,12 @@ public class ZookeeperClusterStatus extends > ClusterStatus { > - throw new RuntimeException(e); > - } finally { > - long e = System.nanoTime(); > -- LOG.debug("trace getTableDescriptor took [" + (e - s) / 1000000.0 > + " ms]"); > -+ LOG.debug("trace getOldTableDescriptor took [" + (e - s) / > 1000000.0 + " ms]"); > - } > -- tableDescriptor.cluster = cluster; > -- _tableDescriptorCache.put(table, tableDescriptor); > -+ > - return tableDescriptor; > - } > -- > -+ > - private boolean internalGetReadOnly(String tableReadOnlyPath) throws > KeeperException, InterruptedException { > - Stat stat = _zk.exists(tableReadOnlyPath, false); > - if (stat == null) { > -@@ -718,34 +767,14 @@ public class ZookeeperClusterStatus extends > ClusterStatus { > - String uri = BlurUtil.nullCheck(tableDescriptor.tableUri, > "tableDescriptor.tableUri cannot be null."); > - int shardCount = BlurUtil.zeroCheck(tableDescriptor.shardCount, > - "tableDescriptor.shardCount cannot be less than 1"); > -- Similarity similarity = > BlurUtil.getInstance(tableDescriptor.similarityClass, Similarity.class); > -- boolean blockCaching = tableDescriptor.blockCaching; > -- Set<String> blockCachingFileTypes = > tableDescriptor.blockCachingFileTypes; > - String blurTablePath = > ZookeeperPathConstants.getTablePath(cluster, table); > - > - if (_zk.exists(blurTablePath, false) != null) { > - throw new IOException("Table [" + table + "] already exists."); > - } > - BlurUtil.setupFileSystem(uri, shardCount); > -- BlurUtil.createPath(_zk, blurTablePath, null); > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTableColumnsToPreCache(cluster, table), > -- toBytes(tableDescriptor.preCacheCols)); > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTableUriPath(cluster, table), uri.getBytes()); > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTableShardCountPath(cluster, table), > -- Integer.toString(shardCount).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); > -- } > -- if (blockCaching) { > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTableBlockCachingPath(cluster, table), null); > -- } > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTableBlockCachingFileTypesPath(cluster, table), > -- toBytes(blockCachingFileTypes)); > -- BlurUtil.createPath(_zk, > ZookeeperPathConstants.getTablePropertiesPath(cluster, table), > toBytes(tableDescriptor.getTableProperties())); > -+ byte[] bytes = serializeTableDescriptor(tableDescriptor); > -+ BlurUtil.createPath(_zk, blurTablePath, bytes); > - } catch (IOException e) { > - throw new RuntimeException(e); > - } catch (KeeperException e) { > -@@ -758,6 +787,15 @@ public class ZookeeperClusterStatus extends > ClusterStatus { > - } > - } > - > -+ private byte[] serializeTableDescriptor(TableDescriptor td) { > -+ try{ > -+ TSerializer serializer = new TSerializer(new > TBinaryProtocol.Factory()); > -+ return serializer.serialize(td); > -+ } catch (TException e) { > -+ throw new RuntimeException(e); > -+ } > -+ } > -+ > - private void assignTableUri(TableDescriptor tableDescriptor) { > - if (tableDescriptor.getTableUri() != null) { > - return; > --- > -1.7.12.4 (Apple Git-37) > - > >
