New util program.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/ddb9ad76 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ddb9ad76 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ddb9ad76 Branch: refs/heads/0.1.5 Commit: ddb9ad76377f3bd9314365469fb73e2e71754c8a Parents: c19fa07 Author: Aaron McCurry <[email protected]> Authored: Tue May 14 12:20:42 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Tue May 14 12:20:42 2013 -0400 ---------------------------------------------------------------------- .../testsuite/ShardServerLayoutStateTables.java | 51 +++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ddb9ad76/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/ShardServerLayoutStateTables.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/ShardServerLayoutStateTables.java b/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/ShardServerLayoutStateTables.java new file mode 100644 index 0000000..00b719d --- /dev/null +++ b/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/ShardServerLayoutStateTables.java @@ -0,0 +1,51 @@ +package org.apache.blur.testsuite; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.ShardState; +import org.apache.thrift.TException; + +public class ShardServerLayoutStateTables { + + public static void main(String[] args) throws BlurException, TException, IOException, InterruptedException { + String connectionStr = args[0]; + + Iface client = BlurClient.getClient(connectionStr); + System.out.println(client.tableList()); + + while (true) { + System.out.println("==============="); + for (String table : client.tableList()) { + Map<String, Map<String, ShardState>> state = client.shardServerLayoutState(table); + for (String shard : state.keySet()) { + Map<String, ShardState> shardMap = state.get(shard); + for (Entry<String, ShardState> entry : shardMap.entrySet()) { + System.out.println(shard + " " + entry.getKey() + " " + entry.getValue()); + } + } + } + Thread.sleep(1000); + } + } +}
