@Test public void testWholesomeSplit() throws IOException { final int rowcount = TEST_UTIL.loadRegion(this.parent, CF, true); assertTrue(rowcount > 0); int parentRowCount = countRows(this.parent); assertEquals(rowcount, parentRowCount); CacheConfig cacheConf = new CacheConfig(TEST_UTIL.getConfiguration()); ((LruBlockCache) cacheConf.getBlockCache()).clearCache(); SplitTransaction st = prepareGOOD_SPLIT_ROW(); Server mockServer = Mockito.mock(Server.class); when(mockServer.getConfiguration()).thenReturn(TEST_UTIL.getConfiguration()); PairOfSameType<HRegion> daughters = st.execute(mockServer, null); assertTrue(this.fs.exists(this.parent.getRegionFileSystem().getSplitsDir())); assertTrue(this.parent.isClosed()); assertEquals(0, this.fs.listStatus(this.parent.getRegionFileSystem().getSplitsDir()).length); assertTrue(Bytes.equals(this.parent.getStartKey(), daughters.getFirst().getStartKey())); assertTrue(Bytes.equals(GOOD_SPLIT_ROW, daughters.getFirst().getEndKey())); assertTrue(Bytes.equals(daughters.getSecond().getStartKey(), GOOD_SPLIT_ROW)); assertTrue(Bytes.equals(this.parent.getEndKey(), daughters.getSecond().getEndKey())); int daughtersRowCount = 0; for (HRegion openRegion: daughters) { try { int count = countRows(openRegion); assertTrue(count > 0 && count != rowcount); daughtersRowCount += count; } finally { HRegion.closeHRegion(openRegion); } } assertEquals(rowcount, daughtersRowCount); assertTrue(!this.parent.lock.writeLock().isHeldByCurrentThread()); }
public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { LOG.info("Shen Li: in SplitTransaction.execute()"); PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } LOG.info("Shen Li: before SplitTransaction.stepsAfterPONR"); return stepsAfterPONR(server, services, regions); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { LOG.info("Shen Li: in SplitTransaction.execute()"); PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } LOG.info("Shen Li: before SplitTransaction.stepsAfterPONR"); return stepsAfterPONR(server, services, regions); } }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { LOG.info("Shen Li: in SplitTransaction.execute()"); PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } LOG.info("Shen Li: before SplitTransaction.stepsAfterPONR"); return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow);  SplitTransaction(final HRegion r, final byte [] splitrow, 
                          boolean reuseFile, String destA, String destB); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { LOG.info("Shen Li: in SplitTransaction.execute()"); PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } LOG.info("Shen Li: before SplitTransaction.stepsAfterPONR"); return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow);  SplitTransaction(final HRegion r, final byte [] splitrow, 
                          boolean reuseFile, String destA, String destB); boolean prepare(); PairOfSameType<HRegion> stepsBeforePONR(final Server server,
      final RegionServerServices services, boolean testing); PairOfSameType<HRegion> execute(final Server server,
      final RegionServerServices services); PairOfSameType<HRegion> stepsAfterPONR(final Server server,
      final RegionServerServices services, PairOfSameType<HRegion> regions); Put addLocation(final Put p, final ServerName sn, long openSeqNum); @SuppressWarnings("deprecation") boolean rollback(final Server server, final RegionServerServices services); static void createNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo region,
      final ServerName serverName, final HRegionInfo a,
      final HRegionInfo b); static int transitionSplittingNode(ZooKeeperWatcher zkw,
      HRegionInfo parent, HRegionInfo a, HRegionInfo b, ServerName serverName,
      final int znodeVersion, final EventType beginState,
      final EventType endState); static int transitionSplittingNode(ZooKeeperWatcher zkw,
      HRegionInfo parent, HRegionInfo a, HRegionInfo b, ServerName serverName,
      final int znodeVersion, final EventType beginState,
      final EventType endState, boolean reuseFile); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { LOG.info("Shen Li: in SplitTransaction.execute()"); PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } LOG.info("Shen Li: before SplitTransaction.stepsAfterPONR"); return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow);  SplitTransaction(final HRegion r, final byte [] splitrow, 
                          boolean reuseFile, String destA, String destB); boolean prepare(); PairOfSameType<HRegion> stepsBeforePONR(final Server server,
      final RegionServerServices services, boolean testing); PairOfSameType<HRegion> execute(final Server server,
      final RegionServerServices services); PairOfSameType<HRegion> stepsAfterPONR(final Server server,
      final RegionServerServices services, PairOfSameType<HRegion> regions); Put addLocation(final Put p, final ServerName sn, long openSeqNum); @SuppressWarnings("deprecation") boolean rollback(final Server server, final RegionServerServices services); static void createNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo region,
      final ServerName serverName, final HRegionInfo a,
      final HRegionInfo b); static int transitionSplittingNode(ZooKeeperWatcher zkw,
      HRegionInfo parent, HRegionInfo a, HRegionInfo b, ServerName serverName,
      final int znodeVersion, final EventType beginState,
      final EventType endState); static int transitionSplittingNode(ZooKeeperWatcher zkw,
      HRegionInfo parent, HRegionInfo a, HRegionInfo b, ServerName serverName,
      final int znodeVersion, final EventType beginState,
      final EventType endState, boolean reuseFile);  }