Package net.sf.katta.protocol.metadata

Examples of net.sf.katta.protocol.metadata.IndexMetaData


    CheckIndicesOperation balanceOperation = new CheckIndicesOperation();
    balanceOperation.execute(_context, EMPTY_LIST);
    assertEquals(0, masterQueue.size());

    // decrease the replication count and then balance again
    IndexMetaData indexMD = _protocol.getIndexMD(_indexName);
    indexMD.setReplicationLevel(2);
    _protocol.updateIndexMD(indexMD);
    balanceOperation.execute(_context, EMPTY_LIST);
    assertEquals(1, masterQueue.size());
  }
View Full Code Here


  public static void waitUntilIndexBalanced(final InteractionProtocol protocol, final String indexName)
          throws Exception {
    waitUntil(true, new Callable<Boolean>() {
      @Override
      public Boolean call() throws Exception {
        IndexMetaData indexMD = protocol.getIndexMD(indexName);
        if (indexMD.hasDeployError()) {
          throw new IllegalStateException("index " + indexName + " has a deploy error");
        }
        return protocol.getReplicationReport(indexMD).isBalanced();
      }
    }, TimeUnit.SECONDS, 30);
View Full Code Here

    execute(Katta.LIST_ERRORS_COMMAND, "showStructure", "a");
  }

  @Test
  public void testListIndexesWithUnreachableIndex_KATTA_76() throws Exception {
    IndexMetaData indexMD = new IndexMetaData("indexABC", "hdfs://localhost:8020/unreachableIndex", 1);
    _zk.getInteractionProtocol().publishIndex(indexMD);
    execute(Katta.LIST_INDICES_COMMAND, indexMD.getName());
  }
View Full Code Here

  }

  @Test
  public void testCleanupOfClientWatchesOnUndeploy_KATTA_182() throws Exception {
    IDeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    IndexMetaData indexMD = deployClient.getIndexMetaData(INDEX1);
    deployClient.removeIndex(INDEX1);
    TestUtil.waitUntilShardsUndeployed(_protocol, indexMD);

    Client client = _client.getClient();
    assertThat(client.getIndices()).excludes((Object) INDEX_1);
View Full Code Here

    UpgradeAction05_06 upgradeAction = new UpgradeAction05_06();
    upgradeAction.upgrade(_protocol);

    assertEquals(1, _protocol.getIndices().size());
    IndexMetaData newIndexMD = _protocol.getIndexMD(indexName);
    assertEquals(indexName, newIndexMD.getName());
    assertEquals(oldIndexMD.getPath(), newIndexMD.getPath());
    assertEquals(oldIndexMD.getReplicationLevel(), newIndexMD.getReplicationLevel());

    MasterQueue queue = _protocol.publishMaster(Mocks.mockMaster());
    assertEquals(1, queue.size());
    assertThat(queue.peek(), instanceOf(IndexReinitializeOperation.class));
  }
View Full Code Here

    verifyNoMoreInteractions(listener);
  }

  @Test(timeout = 70000)
  public void testIndexManagement() throws Exception {
    IndexMetaData indexMD = new IndexMetaData("index1", "indexPath", 2);
    indexMD.getShards().add(new Shard(AbstractIndexOperation.createShardName(indexMD.getName(), "path1"), "path1"));
    Node node = Mocks.mockNode();

    assertNull(_protocol.getIndexMD("index1"));
    assertEquals(0, _protocol.getIndices().size());

    // publish index
    _protocol.publishIndex(indexMD);
    _protocol.publishShard(node, indexMD.getShards().iterator().next().getName());
    assertNotNull(_protocol.getIndexMD("index1"));
    assertEquals(1, _protocol.getIndices().size());
    assertEquals(indexMD.getReplicationLevel(), _protocol.getIndexMD(indexMD.getName()).getReplicationLevel());

    // update index
    indexMD.setReplicationLevel(3);
    _protocol.updateIndexMD(indexMD);
    assertEquals(indexMD.getReplicationLevel(), _protocol.getIndexMD(indexMD.getName()).getReplicationLevel());

    _protocol.showStructure(false);
    _protocol.unpublishIndex(indexMD.getName());
    _protocol.showStructure(false);
    assertNull(_protocol.getIndexMD("index1"));
    assertEquals(0, _protocol.getIndices().size());

    String string = ZkPathUtil.toString(_protocol._zkClient);
    Set<Shard> shards = indexMD.getShards();
    for (Shard shard : shards) {
      assertFalse(string.contains(shard.getName()));
    }
  }
View Full Code Here

      TestUtil.waitUntilNumberOfLiveNode(_protocol, _nodeCount);
      // remove all indices
      if (_undeployIndicesAfterEachTest) {
        List<String> indices = _protocol.getIndices();
        for (String index : indices) {
          IndexMetaData indexMD = _protocol.getIndexMD(index);
          DeployClient deployClient = new DeployClient(_protocol);
          deployClient.removeIndex(index);
          TestUtil.waitUntilShardsUndeployed(_protocol, indexMD);
        }
      } else {
View Full Code Here

  protected List<String> deployTestIndices(int indexCount, int replicationCount) throws InterruptedException {
    return _miniCluster.deployTestIndexes(INDEX_FILE, indexCount, replicationCount);
  }

  protected final int countShardDeployments(InteractionProtocol protocol, String indexName) {
    IndexMetaData indexMD = protocol.getIndexMD(indexName);
    int shardDeployCount = 0;
    for (Shard shard : indexMD.getShards()) {
      shardDeployCount += protocol.getShardNodes(shard.getName()).size();
    }
    return shardDeployCount;
  }
View Full Code Here

  public void testJoinIndexDeployment() throws Exception {
    String indexName = "indexA";
    IndexDeployFuture deployFuture = new IndexDeployFuture(_protocol, indexName);
    assertEquals(IndexState.DEPLOYING, deployFuture.joinDeployment(200));

    _protocol.publishIndex(new IndexMetaData(indexName, "path", 1));
    assertEquals(IndexState.DEPLOYED, deployFuture.joinDeployment(200));
  }
View Full Code Here

  public void testJoinIndexErrorDeployment() throws Exception {
    String indexName = "indexA";
    IndexDeployFuture deployFuture = new IndexDeployFuture(_protocol, indexName);
    assertEquals(IndexState.DEPLOYING, deployFuture.joinDeployment(200));

    IndexMetaData indexMD = new IndexMetaData(indexName, "path", 1);
    indexMD.setDeployError(new IndexDeployError(indexName, ErrorType.NO_NODES_AVAILIBLE));
    _protocol.publishIndex(indexMD);
    assertEquals(IndexState.ERROR, deployFuture.joinDeployment(200));
  }
View Full Code Here

TOP

Related Classes of net.sf.katta.protocol.metadata.IndexMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.