Search in sources :

Example 16 with TestProcedure

use of org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.TestProcedure in project hbase by apache.

the class TestWALProcedureStore method testWalReplayOrder_AB_A.

@Test(timeout = 60000)
public void testWalReplayOrder_AB_A() throws Exception {
    /*
     * | A B | -> | A |
     */
    TestProcedure a = new TestProcedure(1, 0);
    TestProcedure b = new TestProcedure(2, 1);
    procStore.insert(a, null);
    a.addStackId(0);
    procStore.update(a);
    procStore.insert(a, new Procedure[] { b });
    b.addStackId(1);
    procStore.update(b);
    procStore.rollWriterForTesting();
    a.addStackId(2);
    procStore.update(a);
    storeRestart(new ProcedureStore.ProcedureLoader() {

        @Override
        public void setMaxProcId(long maxProcId) {
            assertEquals(2, maxProcId);
        }

        @Override
        public void load(ProcedureIterator procIter) throws IOException {
            assertTrue(procIter.hasNext());
            assertEquals(1, procIter.nextAsProcedureInfo().getProcId());
            assertTrue(procIter.hasNext());
            assertEquals(2, procIter.nextAsProcedureInfo().getProcId());
            assertFalse(procIter.hasNext());
        }

        @Override
        public void handleCorrupted(ProcedureIterator procIter) throws IOException {
            assertFalse(procIter.hasNext());
        }
    });
}
Also used : TestProcedure(org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.TestProcedure) ProcedureStore(org.apache.hadoop.hbase.procedure2.store.ProcedureStore) ProcedureIterator(org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureIterator) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

TestProcedure (org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.TestProcedure)16 Test (org.junit.Test)15 LoadCounter (org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter)5 ProcedureStore (org.apache.hadoop.hbase.procedure2.store.ProcedureStore)4 IOException (java.io.IOException)3 FileStatus (org.apache.hadoop.fs.FileStatus)2 Procedure (org.apache.hadoop.hbase.procedure2.Procedure)2 ProcedureIterator (org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureIterator)2 WALProcedureStore (org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore)2 FileNotFoundException (java.io.FileNotFoundException)1 Random (java.util.Random)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 ProcedureInfo (org.apache.hadoop.hbase.ProcedureInfo)1 HMaster (org.apache.hadoop.hbase.master.HMaster)1 SequentialProcedure (org.apache.hadoop.hbase.procedure2.SequentialProcedure)1 ProcedureStoreTracker (org.apache.hadoop.hbase.procedure2.store.ProcedureStoreTracker)1 ProcedureProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos)1