Package org.apache.hcatalog.hbase.snapshot

Examples of org.apache.hcatalog.hbase.snapshot.TableSnapshot


            }
        }

        String fullyQualifiedName = hcatSnapshot.getDatabaseName() + "."
                + hcatSnapshot.getTableName();
        return new TableSnapshot(fullyQualifiedName, revisionMap,hcatSnapshot.getLatestRevision());

    }
View Full Code Here


   */
  static HCatTableSnapshot createSnapshot(Configuration jobConf,
                      String hbaseTableName, HCatTableInfo tableInfo) throws IOException {

    RevisionManager rm = null;
    TableSnapshot snpt;
    try {
      rm = getOpenedRevisionManager(jobConf);
      snpt = rm.createSnapshot(hbaseTableName);
    } finally {
      closeRevisionManagerQuietly(rm);
View Full Code Here

   */
  static HCatTableSnapshot createSnapshot(Configuration jobConf,
                      String tableName, long revision)
    throws IOException {

    TableSnapshot snpt;
    RevisionManager rm = null;
    try {
      rm = getOpenedRevisionManager(jobConf);
      snpt = rm.createSnapshot(tableName, revision);
    } finally {
View Full Code Here

      }
    }

    String fullyQualifiedName = hcatSnapshot.getDatabaseName() + "."
      + hcatSnapshot.getTableName();
    return new TableSnapshot(fullyQualifiedName, revisionMap, hcatSnapshot.getLatestRevision());

  }
View Full Code Here

    job.setNumReduceTasks(0);

    assertTrue(job.waitForCompletion(true));
    RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
    try {
      TableSnapshot snapshot = rm.createSnapshot(databaseName + "." + tableName);
      for (String el : snapshot.getColumnFamilies()) {
        assertEquals(1, snapshot.getRevision(el));
      }
    } finally {
      rm.close();
    }
View Full Code Here

    assertFalse(job.waitForCompletion(true));

    // verify that revision manager has it as aborted transaction
    RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
    try {
      TableSnapshot snapshot = rm.createSnapshot(databaseName + "." + tableName);
      for (String family : snapshot.getColumnFamilies()) {
        assertEquals(1, snapshot.getRevision(family));
        List<FamilyRevision> abortedWriteTransactions = rm.getAbortedWriteTransactions(
          databaseName + "." + tableName, family);
        assertEquals(1, abortedWriteTransactions.size());
        assertEquals(1, abortedWriteTransactions.get(0).getRevision());
      }
View Full Code Here

    InputJobInfo inputInfo = (InputJobInfo) HCatUtil.deserialize(modifiedInputInfo);

    Map<String, Long> revMap = new HashMap<String, Long>();
    revMap.put("cf1", 3L);
    revMap.put("cf2", 5L);
    TableSnapshot hbaseSnapshot = new TableSnapshot(fullyQualTableName, revMap, -1);
    HCatTableSnapshot hcatSnapshot = HBaseRevisionManagerUtil.convertSnapshot(hbaseSnapshot, inputInfo.getTableInfo());

    assertEquals(hcatSnapshot.getRevision("value1"), 3);
    assertEquals(hcatSnapshot.getRevision("value2"), 5);

    String dropTable = "DROP TABLE " + fullyQualTableName;
    cmdResponse = hcatDriver.run(dropTable);
    assertEquals(0, cmdResponse.getResponseCode());

    tableName = newTableName("mytableTwo");
    fullyQualTableName = databaseName + "." + tableName;
    tableQuery = "CREATE TABLE " + fullyQualTableName
      + "(key string, value1 string, value2 string) STORED BY " +
      "'org.apache.hcatalog.hbase.HBaseHCatStorageHandler'"
      + "TBLPROPERTIES ('hbase.columns.mapping'=':key,cf1:q1,cf1:q2')";
    cmdResponse = hcatDriver.run(tableQuery);
    assertEquals(0, cmdResponse.getResponseCode());
    revMap.clear();
    revMap.put("cf1", 3L);
    hbaseSnapshot = new TableSnapshot(fullyQualTableName, revMap, -1);
    HCatInputFormat.setInput(job, databaseName, tableName).setProperties(properties);
    modifiedInputInfo = job.getConfiguration().get(HCatConstants.HCAT_KEY_JOB_INFO);
    inputInfo = (InputJobInfo) HCatUtil.deserialize(modifiedInputInfo);
    hcatSnapshot = HBaseRevisionManagerUtil.convertSnapshot(hbaseSnapshot, inputInfo.getTableInfo());
    assertEquals(hcatSnapshot.getRevision("value1"), 3);
View Full Code Here

      outputJobInfo, inputPath);
    assertTrue(job.waitForCompletion(true));

    RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
    try {
      TableSnapshot snapshot = rm.createSnapshot(hbaseTableName);
      for (String el : snapshot.getColumnFamilies()) {
        assertEquals(1, snapshot.getRevision(el));
      }
    } finally {
      rm.close();
    }
View Full Code Here

    assertFalse(job.waitForCompletion(true));

    // verify that revision manager has it as aborted transaction
    RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
    try {
      TableSnapshot snapshot = rm.createSnapshot(hbaseTableName);
      for (String family : snapshot.getColumnFamilies()) {
        assertEquals(1, snapshot.getRevision(family));
        List<FamilyRevision> abortedWriteTransactions = rm.getAbortedWriteTransactions(
          hbaseTableName, family);
        assertEquals(1, abortedWriteTransactions.size());
        assertEquals(1, abortedWriteTransactions.get(0).getRevision());
      }
View Full Code Here

        job.setNumReduceTasks(0);

        assertTrue(job.waitForCompletion(true));
        RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
        try {
            TableSnapshot snapshot = rm.createSnapshot(databaseName + "." + tableName);
            for (String el : snapshot.getColumnFamilies()) {
                assertEquals(1, snapshot.getRevision(el));
            }
        } finally {
            rm.close();
        }
View Full Code Here

TOP

Related Classes of org.apache.hcatalog.hbase.snapshot.TableSnapshot

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.