Package org.apache.hcatalog.hbase.snapshot.transaction.thrift

Examples of org.apache.hcatalog.hbase.snapshot.transaction.thrift.StoreFamilyRevision


      String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamily);
      byte[] data = zkutil.getRawData(path, null);
      StoreFamilyRevisionList list = new StoreFamilyRevisionList();
      ZKUtil.deserialize(list, data);
      assertEquals(list.getRevisionListSize(), 1);
      StoreFamilyRevision lightTxn = list.getRevisionList().get(0);
      assertEquals(lightTxn.timestamp, txn.getTransactionExpireTimeStamp());
      assertEquals(lightTxn.revision, txn.getRevisionNumber());

    }
    manager.commitWriteTransaction(txn);
View Full Code Here


      String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamiliy);
      byte[] data = zkutil.getRawData(path, null);
      StoreFamilyRevisionList list = new StoreFamilyRevisionList();
      ZKUtil.deserialize(list, data);
      assertEquals(list.getRevisionListSize(), 1);
      StoreFamilyRevision lightTxn = list.getRevisionList().get(0);
      assertEquals(lightTxn.timestamp, txn.getTransactionExpireTimeStamp());
      assertEquals(lightTxn.revision, txn.getRevisionNumber());

    }
    manager.abortWriteTransaction(txn);
    for (String colFamiliy : columnFamilies) {
      String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamiliy);
      byte[] data = zkutil.getRawData(path, null);
      StoreFamilyRevisionList list = new StoreFamilyRevisionList();
      ZKUtil.deserialize(list, data);
      assertEquals(list.getRevisionListSize(), 0);

    }

    for (String colFamiliy : columnFamilies) {
      String path = PathUtil.getAbortInformationPath("/rm_base", tableName, colFamiliy);
      byte[] data = zkutil.getRawData(path, null);
      StoreFamilyRevisionList list = new StoreFamilyRevisionList();
      ZKUtil.deserialize(list, data);
      assertEquals(list.getRevisionListSize(), 1);
      StoreFamilyRevision abortedTxn = list.getRevisionList().get(0);
      assertEquals(abortedTxn.getRevision(), txn.getRevisionNumber());
    }
    manager.close();
  }
View Full Code Here

        StoreFamilyRevisionList txnList = new StoreFamilyRevisionList();
        deserialize(txnList, data);
        Iterator<StoreFamilyRevision> itr = txnList.getRevisionListIterator();

        while (itr.hasNext()) {
            StoreFamilyRevision wtxn = itr.next();
            wtxnList.add(new FamilyRevision(wtxn.getRevision(), wtxn
                .getTimestamp()));
        }

        return wtxnList;
    }
View Full Code Here

        }

        // For serialization purposes.
        List<StoreFamilyRevision> newTxnList = new ArrayList<StoreFamilyRevision>();
        for (FamilyRevision wtxn : newData) {
            StoreFamilyRevision newTxn = new StoreFamilyRevision(wtxn.getRevision(),
                wtxn.getExpireTimestamp());
            newTxnList.add(newTxn);
        }
        StoreFamilyRevisionList wtxnList = new StoreFamilyRevisionList(newTxnList);
        byte[] newByteData = serialize(wtxnList);
View Full Code Here

        }

        if (newData.equals(currentData) == false) {
            List<StoreFamilyRevision> newTxnList = new ArrayList<StoreFamilyRevision>();
            for (FamilyRevision wtxn : newData) {
                StoreFamilyRevision newTxn = new StoreFamilyRevision(wtxn.getRevision(),
                    wtxn.getExpireTimestamp());
                newTxnList.add(newTxn);
            }
            StoreFamilyRevisionList wtxnList = new StoreFamilyRevisionList(newTxnList);
            byte[] newByteData = serialize(wtxnList);
View Full Code Here

            String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamily);
            byte[] data = zkutil.getRawData(path, null);
            StoreFamilyRevisionList list = new StoreFamilyRevisionList();
            ZKUtil.deserialize(list, data);
            assertEquals(list.getRevisionListSize(), 1);
            StoreFamilyRevision lightTxn = list.getRevisionList().get(0);
            assertEquals(lightTxn.timestamp, txn.getTransactionExpireTimeStamp());
            assertEquals(lightTxn.revision, txn.getRevisionNumber());

        }
        manager.commitWriteTransaction(txn);
View Full Code Here

            String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamiliy);
            byte[] data = zkutil.getRawData(path, null);
            StoreFamilyRevisionList list = new StoreFamilyRevisionList();
            ZKUtil.deserialize(list, data);
            assertEquals(list.getRevisionListSize(), 1);
            StoreFamilyRevision lightTxn = list.getRevisionList().get(0);
            assertEquals(lightTxn.timestamp, txn.getTransactionExpireTimeStamp());
            assertEquals(lightTxn.revision, txn.getRevisionNumber());

        }
        manager.abortWriteTransaction(txn);
        for (String colFamiliy : columnFamilies) {
            String path = PathUtil.getRunningTxnInfoPath("/rm_base", tableName, colFamiliy);
            byte[] data = zkutil.getRawData(path, null);
            StoreFamilyRevisionList list = new StoreFamilyRevisionList();
            ZKUtil.deserialize(list, data);
            assertEquals(list.getRevisionListSize(), 0);

        }

        for (String colFamiliy : columnFamilies) {
            String path = PathUtil.getAbortInformationPath("/rm_base", tableName, colFamiliy);
            byte[] data = zkutil.getRawData(path, null);
            StoreFamilyRevisionList list = new StoreFamilyRevisionList();
            ZKUtil.deserialize(list, data);
            assertEquals(list.getRevisionListSize(), 1);
            StoreFamilyRevision abortedTxn = list.getRevisionList().get(0);
            assertEquals(abortedTxn.getRevision(), txn.getRevisionNumber());
        }
        manager.close();
    }
View Full Code Here

public class TestThriftSerialization {

    @Test
    public void testLightWeightTransaction() {
        StoreFamilyRevision trxn = new StoreFamilyRevision(0, 1000);
        try {

            byte[] data = ZKUtil.serialize(trxn);
            StoreFamilyRevision newWtx = new StoreFamilyRevision();
            ZKUtil.deserialize(newWtx, data);

            assertTrue(newWtx.getRevision() == trxn.getRevision());
            assertTrue(newWtx.getTimestamp() == trxn.getTimestamp());

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        long version;
        long timestamp;
        for (int i = 0; i < 10; i++) {
            version = i;
            timestamp = 1000 + i;
            StoreFamilyRevision wtx = new StoreFamilyRevision(version, timestamp);
            txnList.add(wtx);
        }

        StoreFamilyRevisionList wList = new StoreFamilyRevisionList(txnList);

        try {
            byte[] data = ZKUtil.serialize(wList);
            StoreFamilyRevisionList newList = new StoreFamilyRevisionList();
            ZKUtil.deserialize(newList, data);
            assertTrue(newList.getRevisionListSize() == wList.getRevisionListSize());

            Iterator<StoreFamilyRevision> itr = newList.getRevisionListIterator();
            int i = 0;
            while (itr.hasNext()) {
                StoreFamilyRevision txn = itr.next();
                assertTrue(txn.getRevision() == i);
                assertTrue(txn.getTimestamp() == (i + 1000));
                i++;
            }

        } catch (IOException e) {
            e.printStackTrace();
View Full Code Here

    StoreFamilyRevisionList txnList = new StoreFamilyRevisionList();
    deserialize(txnList, data);
    Iterator<StoreFamilyRevision> itr = txnList.getRevisionListIterator();

    while (itr.hasNext()) {
      StoreFamilyRevision wtxn = itr.next();
      wtxnList.add(new FamilyRevision(wtxn.getRevision(), wtxn
        .getTimestamp()));
    }

    return wtxnList;
  }
View Full Code Here

TOP

Related Classes of org.apache.hcatalog.hbase.snapshot.transaction.thrift.StoreFamilyRevision

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.