@Test public void test() throws BlurException, TException, IOException, InterruptedException { String zkConnectionString = _miniCluster.getZkConnectionString(); Configuration configuration = new Configuration(_miniCluster.getConfiguration()); configuration.set(DefaultServerLookup.BLUR_ZK_CONNECTIONS, zkConnectionString); DefaultServerLookup defaultServerLookup = new DefaultServerLookup(configuration, null); Thread.sleep(1000); assertFalse(defaultServerLookup.isPathSupported("/test")); String tableUri = _miniCluster.getFileSystemUri().toString() + "/blur/tables/test"; Iface client = BlurClient.getClientFromZooKeeperConnectionStr(zkConnectionString); TableDescriptor tableDescriptor = new TableDescriptor(); tableDescriptor.setName("test"); tableDescriptor.setShardCount(3); tableDescriptor.setTableUri(tableUri); client.createTable(tableDescriptor); FileSystem fileSystem = _miniCluster.getFileSystem(); Path shardPath = new Path(tableUri, "shard-00000000"); FileStatus[] listStatus = fileSystem.listStatus(shardPath); for (FileStatus fileStatus : listStatus) { System.out.println(fileStatus.getPath()); } Path filePath = new Path(shardPath, "write.lock"); assertTrue(defaultServerLookup.isPathSupported(filePath.toUri().getPath())); client.disableTable(tableDescriptor.getName()); Thread.sleep(15000); assertFalse(defaultServerLookup.isPathSupported(filePath.toUri().getPath())); }
@Override public boolean isPathSupported(String srcPath) { if (!srcPath.contains(SHARD_PATTERN)) { return false; } return getShardServer(srcPath) != null; }
DefaultServerLookup extends ServerLookup { @Override public boolean isPathSupported(String srcPath) { if (!srcPath.contains(SHARD_PATTERN)) { return false; } return getShardServer(srcPath) != null; } }
DefaultServerLookup extends ServerLookup { @Override public boolean isPathSupported(String srcPath) { if (!srcPath.contains(SHARD_PATTERN)) { return false; } return getShardServer(srcPath) != null; } DefaultServerLookup(Configuration conf, Host2NodesMap host2datanodeMap); }
DefaultServerLookup extends ServerLookup { @Override public boolean isPathSupported(String srcPath) { if (!srcPath.contains(SHARD_PATTERN)) { return false; } return getShardServer(srcPath) != null; } DefaultServerLookup(Configuration conf, Host2NodesMap host2datanodeMap); @Override String getShardServer(String srcPath); @Override boolean isPathSupported(String srcPath); @Override DatanodeDescriptor getDatanodeDescriptor(String shardServer); }
DefaultServerLookup extends ServerLookup { @Override public boolean isPathSupported(String srcPath) { if (!srcPath.contains(SHARD_PATTERN)) { return false; } return getShardServer(srcPath) != null; } DefaultServerLookup(Configuration conf, Host2NodesMap host2datanodeMap); @Override String getShardServer(String srcPath); @Override boolean isPathSupported(String srcPath); @Override DatanodeDescriptor getDatanodeDescriptor(String shardServer); static final String BLUR_ZK_CONNECTIONS; }