String cluster = BlurUtil.nullCheck(tableDescriptor.cluster, "tableDescriptor.cluster cannot be null.");
assignTableUri(tableDescriptor);
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);