Package org.apache.accumulo.core.client.impl

Examples of org.apache.accumulo.core.client.impl.TabletLocatorImpl


   
    TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers);
    TestInstance testInstance = new TestInstance("instance1", "tserver1");
   
    RootTabletLocator rtl = new RootTabletLocator(testInstance);
    TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
    TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text(table), rootTabletCache, ttlo);
   
    setLocation(tservers, rootTabLoc, RTE, MTE, metaTabLoc);
   
    for (Entry<KeyExtent,TabletLocation> entry : mcke.entrySet()) {
      setLocation(tservers, metaTabLoc, MTE, entry.getKey(), entry.getValue().tablet_location);
View Full Code Here


    TServers tservers = new TServers();
    TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers);
    TestInstance testInstance = new TestInstance("instance1", "tserver1");
   
    RootTabletLocator rtl = new RootTabletLocator(testInstance);
    TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
    TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text("tab1"), rootTabletCache, ttlo);
   
    locateTabletTest(tab1TabletCache, "r1", null, null);
   
    KeyExtent tab1e = nke("tab1", null, null);
   
    setLocation(tservers, "tserver1", RTE, MTE, "tserver2");
    setLocation(tservers, "tserver2", MTE, tab1e, "tserver3");
   
    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3");
    locateTabletTest(tab1TabletCache, "r2", tab1e, "tserver3");
   
    // simulate a split
    KeyExtent tab1e1 = nke("tab1", "g", null);
    KeyExtent tab1e2 = nke("tab1", null, "g");
   
    setLocation(tservers, "tserver2", MTE, tab1e1, "tserver4");
    setLocation(tservers, "tserver2", MTE, tab1e2, "tserver5");
   
    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3");
    tab1TabletCache.invalidateCache(tab1e);
    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5");
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4");
    locateTabletTest(tab1TabletCache, "a", true, tab1e1, "tserver4");
    locateTabletTest(tab1TabletCache, "g", tab1e1, "tserver4");
    locateTabletTest(tab1TabletCache, "g", true, tab1e2, "tserver5");
   
    // simulate a partial split
    KeyExtent tab1e22 = nke("tab1", null, "m");
    setLocation(tservers, "tserver2", MTE, tab1e22, "tserver6");
    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5");
    tab1TabletCache.invalidateCache(tab1e2);
    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6");
    locateTabletTest(tab1TabletCache, "h", null, null);
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4");
    KeyExtent tab1e21 = nke("tab1", "m", "g");
    setLocation(tservers, "tserver2", MTE, tab1e21, "tserver7");
    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver7");
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4");
   
    // simulate a migration
    setLocation(tservers, "tserver2", MTE, tab1e21, "tserver8");
    tab1TabletCache.invalidateCache(tab1e21);
    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8");
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4");
   
    // simulate a server failure
    setLocation(tservers, "tserver2", MTE, tab1e21, "tserver9");
    tab1TabletCache.invalidateCache("tserver8");
    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver9");
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4");
   
    // simulate all servers failing
    deleteServer(tservers, "tserver1");
    deleteServer(tservers, "tserver2");
    tab1TabletCache.invalidateCache("tserver4");
    tab1TabletCache.invalidateCache("tserver6");
    tab1TabletCache.invalidateCache("tserver9");
   
    locateTabletTest(tab1TabletCache, "r1", null, null);
    locateTabletTest(tab1TabletCache, "h", null, null);
    locateTabletTest(tab1TabletCache, "a", null, null);
   
    testInstance.setRootTabletLocation("tserver4");
    setLocation(tservers, "tserver4", RTE, MTE, "tserver5");
    setLocation(tservers, "tserver5", MTE, tab1e1, "tserver1");
    setLocation(tservers, "tserver5", MTE, tab1e21, "tserver2");
    setLocation(tservers, "tserver5", MTE, tab1e22, "tserver3");
   
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver1");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver2");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3");
   
    // simulate the !METADATA table splitting
    KeyExtent mte1 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e21.getMetadataEntry(), RTE.getEndRow());
    KeyExtent mte2 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, tab1e21.getMetadataEntry());
   
    setLocation(tservers, "tserver4", RTE, mte1, "tserver5");
    setLocation(tservers, "tserver4", RTE, mte2, "tserver6");
    deleteServer(tservers, "tserver5");
    setLocation(tservers, "tserver5", mte1, tab1e1, "tserver7");
    setLocation(tservers, "tserver5", mte1, tab1e21, "tserver8");
    setLocation(tservers, "tserver6", mte2, tab1e22, "tserver9");
   
    tab1TabletCache.invalidateCache(tab1e1);
    tab1TabletCache.invalidateCache(tab1e21);
    tab1TabletCache.invalidateCache(tab1e22);
   
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
   
    // simulate metadata and regular server down and the reassigned
    deleteServer(tservers, "tserver5");
    tab1TabletCache.invalidateCache("tserver7");
    locateTabletTest(tab1TabletCache, "a", null, null);
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
   
    setLocation(tservers, "tserver4", RTE, mte1, "tserver10");
    setLocation(tservers, "tserver10", mte1, tab1e1, "tserver7");
    setLocation(tservers, "tserver10", mte1, tab1e21, "tserver8");
   
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
    tab1TabletCache.invalidateCache("tserver7");
    setLocation(tservers, "tserver10", mte1, tab1e1, "tserver2");
    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver2");
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
   
    // simulate a hole in the !METADATA table, caused by a partial split
    KeyExtent mte11 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e1.getMetadataEntry(), RTE.getEndRow());
    KeyExtent mte12 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e21.getMetadataEntry(), tab1e1.getMetadataEntry());
    deleteServer(tservers, "tserver10");
    setLocation(tservers, "tserver4", RTE, mte12, "tserver10");
    setLocation(tservers, "tserver10", mte12, tab1e21, "tserver12");
   
    // at this point should be no info in !METADATA about tab1e1
    tab1TabletCache.invalidateCache(tab1e1);
    tab1TabletCache.invalidateCache(tab1e21);
    locateTabletTest(tab1TabletCache, "a", null, null);
    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12");
    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
   
    setLocation(tservers, "tserver4", RTE, mte11, "tserver5");
View Full Code Here

    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9");
  }
 
  public void test2() throws Exception {
    TServers tservers = new TServers();
    TabletLocatorImpl metaCache = createLocators(tservers, "tserver1", "tserver2", "foo");
   
    KeyExtent ke1 = nke("foo", "m", null);
    KeyExtent ke2 = nke("foo", null, "m");
   
    setLocation(tservers, "tserver2", MTE, ke1, null);
View Full Code Here

  }
 
  public void testBinRanges1() throws Exception {
    Text tableName = new Text("foo");
   
    TabletLocatorImpl metaCache = createLocators("foo", nke("foo", null, null), "l1");
   
    List<Range> ranges = nrl(nr(null, null));
    Map<String,Map<KeyExtent,List<Range>>> expected = createExpectedBinnings("l1", nol(nke("foo", null, null), nrl(nr(null, null)))
   
    );
View Full Code Here

  public void testBinRanges2() throws Exception {
   
    Text tableName = new Text("foo");
   
    List<Range> ranges = nrl(nr(null, null));
    TabletLocatorImpl metaCache = createLocators("foo", nke("foo", "g", null), "l1", nke("foo", null, "g"), "l2");
   
    Map<String,Map<KeyExtent,List<Range>>> expected = createExpectedBinnings("l1", nol(nke("foo", "g", null), nrl(nr(null, null))), "l2",
        nol(nke("foo", null, "g"), nrl(nr(null, null)))
   
    );
View Full Code Here

   
    Text tableName = new Text("foo");
   
    // test with three tablets and a range that covers the whole table
    List<Range> ranges = nrl(nr(null, null));
    TabletLocatorImpl metaCache = createLocators("foo", nke("foo", "g", null), "l1", nke("foo", "m", "g"), "l2", nke("foo", null, "m"), "l2");
   
    Map<String,Map<KeyExtent,List<Range>>> expected = createExpectedBinnings("l1", nol(nke("foo", "g", null), nrl(nr(null, null))), "l2",
        nol(nke("foo", "m", "g"), nrl(nr(null, null)), nke("foo", null, "m"), nrl(nr(null, null)))
   
    );
View Full Code Here

 
  public void testBinRanges4() throws Exception {
    Text tableName = new Text("foo");
   
    List<Range> ranges = nrl(new Range(new Text("1")));
    TabletLocatorImpl metaCache = createLocators("foo", nke("foo", "0", null), "l1", nke("foo", "1", "0"), "l2", nke("foo", "2", "1"), "l3",
        nke("foo", "3", "2"), "l4", nke("foo", null, "3"), "l5");
   
    Map<String,Map<KeyExtent,List<Range>>> expected = createExpectedBinnings("l2", nol(nke("foo", "1", "0"), nrl(new Range(new Text("1"))))
   
    );
View Full Code Here

  public void testBinRanges5() throws Exception {
    // Test binning when there is a hole in the !METADATA information
    Text tableName = new Text("foo");
   
    List<Range> ranges = nrl(new Range(new Text("1")));
    TabletLocatorImpl metaCache = createLocators("foo", nke("foo", "0", null), "l1", nke("foo", "1", "0"), "l2", nke("foo", "3", "2"), "l4",
        nke("foo", null, "3"), "l5");
   
    Map<String,Map<KeyExtent,List<Range>>> expected1 = createExpectedBinnings("l2", nol(nke("foo", "1", "0"), nrl(new Range(new Text("1"))))
   
    );
View Full Code Here

  }
 
  public void testBinMutations1() throws Exception {
    // one tablet table
    KeyExtent ke1 = nke("foo", null, null);
    TabletLocatorImpl metaCache = createLocators("foo", ke1, "l1");
   
    List<Mutation> ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"), nm("c", "cf1:cq1=v3", "cf1:cq2=v4"));
    Map<String,Map<KeyExtent,List<String>>> emb = cemb(nol("a", "l1", ke1), nol("c", "l1", ke1));
    runTest(metaCache, ml, emb);
   
View Full Code Here

   
  }
 
  public void testBinMutations2() throws Exception {
    // no tablets for table
    TabletLocatorImpl metaCache = createLocators("foo");
   
    List<Mutation> ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"), nm("c", "cf1:cq1=v3", "cf1:cq2=v4"));
    Map<String,Map<KeyExtent,List<String>>> emb = cemb();
    runTest(metaCache, ml, emb, "a", "c");
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.impl.TabletLocatorImpl

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.