Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.LockComponent


  // Test that existing shared_write partition with new shared_write coalesces to
  // shared_write
  @Test
  public void testSWSWPart() {
    LockRequestBuilder bldr = new LockRequestBuilder();
    LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp);
    comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp).setUser("fred");
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(1, locks.size());
    Assert.assertEquals(LockType.SHARED_WRITE, locks.get(0).getType());
View Full Code Here


  // Test that existing shared_write partition with new shared_read coalesces to
  // shared_write
  @Test
  public void testSWSRPart() {
    LockRequestBuilder bldr = new LockRequestBuilder();
    LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp);
    comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp).setUser("fred");
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(1, locks.size());
    Assert.assertEquals(LockType.SHARED_WRITE, locks.get(0).getType());
View Full Code Here

  // Test that existing shared_read partition with new exclusive coalesces to
  // exclusive
  @Test
  public void testSRExPart() {
    LockRequestBuilder bldr = new LockRequestBuilder();
    LockComponent comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp);
    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypart");
    bldr.addLockComponent(comp).setUser("fred");
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(1, locks.size());
    Assert.assertEquals(LockType.EXCLUSIVE, locks.get(0).getType());
View Full Code Here

  private LockComponent component;
  private boolean tableNameSet;
  private boolean partNameSet;

  public LockComponentBuilder() {
    component = new LockComponent();
    tableNameSet = partNameSet = false;
  }
View Full Code Here

      }
      setPart(comp, parts);
    }

    private void setPart(LockComponent comp, PartTrie parts) {
      LockComponent existing = parts.get(comp.getPartitionname());
      if (existing == null) {
        // No existing lock for this partition.
        parts.put(comp.getPartitionname(), comp);
      else if (existing.getType() != LockType.EXCLUSIVE  &&
          (comp.getType() ==  LockType.EXCLUSIVE ||
            comp.getType() ==  LockType.SHARED_WRITE)) {
        // We only need to promote if comp.type is > existing.type.  For
        // efficiency we check if existing is exclusive (in which case we
        // need never promote) or if comp is exclusive or shared_write (in
View Full Code Here

        long startedAt = System.currentTimeMillis();

        // Now look for new entries ready to be cleaned.
        List<CompactionInfo> toClean = txnHandler.findReadyToClean();
        for (CompactionInfo ci : toClean) {
          LockComponent comp = null;
          comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.TABLE, ci.dbname);
          comp.setTablename(ci.tableName);
          if (ci.partName != nullcomp.setPartitionname(ci.partName);
          List<LockComponent> components = new ArrayList<LockComponent>(1);
          components.add(comp);
          LockRequest rqst = new LockRequest(components, System.getProperty("user.name"),
              Worker.hostname());
          LockResponse rsp = txnHandler.lockNoWait(rqst);
View Full Code Here

        long startedAt = System.currentTimeMillis();

        // Now look for new entries ready to be cleaned.
        List<CompactionInfo> toClean = txnHandler.findReadyToClean();
        for (CompactionInfo ci : toClean) {
          LockComponent comp = null;
          comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.TABLE, ci.dbname);
          comp.setTablename(ci.tableName);
          if (ci.partName != nullcomp.setPartitionname(ci.partName);
          List<LockComponent> components = new ArrayList<LockComponent>(1);
          components.add(comp);
          LockRequest rqst = new LockRequest(components, System.getProperty("user.name"),
              Worker.hostname());
          LockResponse rsp = txnHandler.lockNoWait(rqst);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.LockComponent

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.