@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 { useZKForAssignment = server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails(); } PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } return stepsAfterPONR(server, services, regions); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { useZKForAssignment = server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails(); } PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } return stepsAfterPONR(server, services, regions); } }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { useZKForAssignment = server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails(); } PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { useZKForAssignment = server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails(); } PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow); 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); }
SplitTransaction { public PairOfSameType<HRegion> execute(final Server server, final RegionServerServices services) throws IOException { useZKForAssignment = server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails(); } PairOfSameType<HRegion> regions = createDaughters(server, services); if (this.parent.getCoprocessorHost() != null) { this.parent.getCoprocessorHost().preSplitAfterPONR(); } return stepsAfterPONR(server, services, regions); } SplitTransaction(final HRegion r, final byte [] splitrow); 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); public SplitTransactionCoordination.SplitTransactionDetails std; }