Package net.sf.katta.protocol

Examples of net.sf.katta.protocol.NodeQueue


  }

  private void init() {
    redeployInstalledShards();
    NodeMetaData nodeMetaData = new NodeMetaData(_nodeName);
    NodeQueue nodeOperationQueue = _protocol.publishNode(this, nodeMetaData);
    startOperatorThread(nodeOperationQueue);
  }
View Full Code Here


  @Test(timeout = 50000)
  public void testMasterChangeWhileDeploingIndex() throws Exception {
    Master master = new Master(_zk.getInteractionProtocol(), false);
    Node node = Mocks.mockNode();// leave safe mode
    NodeQueue nodeQueue = _protocol.publishNode(node, new NodeMetaData("node1"));
    master.start();
    TestUtil.waitUntilLeaveSafeMode(master);

    // phase I - until watchdog is running and its node turn
    IndexDeployOperation deployOperation = new IndexDeployOperation("index1", TestResources.INDEX1.getAbsolutePath(), 1);
    _protocol.addMasterOperation(deployOperation);
    while (!master.getContext().getMasterQueue().isEmpty()) {
      // wait until deploy is in watch phase
      Thread.sleep(100);
    }

    // phase II - master change while node is deploying
    master.shutdown();
    Master secMaster = new Master(_zk.getInteractionProtocol(), false);
    secMaster.start();

    // phase III - finish node operations/ mater operation should be finished
    while (!nodeQueue.isEmpty()) {
      nodeQueue.remove();
    }
    TestUtil.waitUntilIndexDeployed(_protocol, deployOperation.getIndexName());
    assertNotNull(_protocol.getIndexMD(deployOperation.getIndexName()));

    secMaster.shutdown();
View Full Code Here

      assertEquals(0, nodeqQueue.size());
    }

    // add node and then balance again
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());

    balanceOperation.execute(_context, EMPTY_LIST);
    for (NodeQueue nodeqQueue : nodeQueues) {
      assertEquals(0, nodeqQueue.size());
    }
    assertEquals(1, nodeQueue3.size());
  }
View Full Code Here

    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(0, masterQueue.size());

    // add node and now the balance op should add itself for retry
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(1, masterQueue.size());

    // now do the balance
    assertEquals(0, nodeQueue3.size());
    balanceOperation.execute(_context, EMPTY_LIST);
    assertEquals(1, nodeQueue3.size());
    publisShard(node3, nodeQueue3);

    // now it shouldn't add itself again since the index is balanced
    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(1, masterQueue.size());
View Full Code Here

    }
    publisShards(nodes, nodeQueues);

    // add node and then balance again
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    FileSystem fileSystem = mock(FileSystem.class);
    when(fileSystem.exists(any(Path.class))).thenReturn(false);
    MasterContext spiedContext = spy(_context);
    doReturn(fileSystem).when(spiedContext).getFileSystem(any(IndexMetaData.class));
View Full Code Here

    }
    publisShards(nodes, nodeQueues);

    // add node and then balance again
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    MasterContext spiedContext = spy(_context);
    doThrow(new RuntimeException("test-exception")).when(spiedContext).getFileSystem(any(IndexMetaData.class));
    List<OperationId> nodeOperations = balanceOperation.execute(spiedContext, EMPTY_LIST);
    assertEquals(null, nodeOperations);
View Full Code Here

TOP

Related Classes of net.sf.katta.protocol.NodeQueue

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.