org.apache.hadoop.hbase.client.Append.setDurability()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.apache.hadoop.hbase.client.Append.setDurability()方法的一些代码示例,展示了Append.setDurability()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.setDurability()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:setDurability

Append.setDurability介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

private Append newAppendWithSkipWAL() {
 Append append = new Append(Bytes.toBytes("row"));
 append.addColumn(CF, CQ, Bytes.toBytes("value"));
 append.setDurability(Durability.SKIP_WAL);
 return append;
}

代码示例来源:origin: apache/hbase

@Test
public void testAppendWithReadOnlyTable() throws Exception {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 this.region = initHRegion(tableName, method, CONF, true, Bytes.toBytes("somefamily"));
 boolean exceptionCaught = false;
 Append append = new Append(Bytes.toBytes("somerow"));
 append.setDurability(Durability.SKIP_WAL);
 append.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
   Bytes.toBytes("somevalue"));
 try {
  region.append(append);
 } catch (IOException e) {
  exceptionCaught = true;
 }
 assertTrue(exceptionCaught == true);
}

代码示例来源:origin: apache/hbase

@Override
 public void run() {
  for (int i=0; i<numOps; i++) {
   try {
    Append a = new Append(row);
    a.addColumn(fam1, qual1, val);
    a.addColumn(fam1, qual2, val);
    a.addColumn(fam2, qual3, val);
    a.setDurability(Durability.ASYNC_WAL);
    region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
    Get g = new Get(row);
    Result result = region.get(g);
    assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
    assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
   } catch (IOException e) {
    e.printStackTrace();
    failures.incrementAndGet();
    fail();
   }
  }
 }
};

代码示例来源:origin: apache/hbase

append_2.addColumn(FAMILY, qual, Bytes.toBytes("e"));
if (!walUsed) {
 append_2.setDurability(Durability.SKIP_WAL);

代码示例来源:origin: apache/hbase

public static Append appendFromThrift(TAppend append) throws IOException {
 Append out = new Append(append.getRow());
 for (TColumnValue column : append.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
 }
 if (append.isSetAttributes()) {
  addAttributes(out, append.getAttributes());
 }
 if (append.isSetDurability()) {
  out.setDurability(durabilityFromThrift(append.getDurability()));
 }
 if(append.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
 }
 if (append.isSetReturnResults()) {
  out.setReturnResults(append.isReturnResults());
 }
 return out;
}

代码示例来源:origin: apache/hbase

@Test
public void testAppendTimestampsAreMonotonic() throws IOException {
 region = initHRegion(tableName, method, CONF, fam1);
 ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
 EnvironmentEdgeManager.injectEdge(edge);
 edge.setValue(10);
 Append a = new Append(row);
 a.setDurability(Durability.SKIP_WAL);
 a.addColumn(fam1, qual1, qual1);
 region.append(a);
 Result result = region.get(new Get(row));
 Cell c = result.getColumnLatestCell(fam1, qual1);
 assertNotNull(c);
 assertEquals(10L, c.getTimestamp());
 edge.setValue(1); // clock goes back
 region.append(a);
 result = region.get(new Get(row));
 c = result.getColumnLatestCell(fam1, qual1);
 assertEquals(11L, c.getTimestamp());
 byte[] expected = new byte[qual1.length*2];
 System.arraycopy(qual1, 0, expected, 0, qual1.length);
 System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);
 assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
  expected, 0, expected.length));
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testAppendWithReadOnlyTable() throws Exception {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 this.region = initHRegion(tableName, method, CONF, true, Bytes.toBytes("somefamily"));
 boolean exceptionCaught = false;
 Append append = new Append(Bytes.toBytes("somerow"));
 append.setDurability(Durability.SKIP_WAL);
 append.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
   Bytes.toBytes("somevalue"));
 try {
  region.append(append);
 } catch (IOException e) {
  exceptionCaught = true;
 } finally {
  HBaseTestingUtility.closeRegionAndWAL(this.region);
  this.region = null;
 }
 assertTrue(exceptionCaught == true);
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Override
 public void run() {
  for (int i=0; i<numOps; i++) {
   try {
    Append a = new Append(row);
    a.addColumn(fam1, qual1, val);
    a.addColumn(fam1, qual2, val);
    a.addColumn(fam2, qual3, val);
    a.setDurability(Durability.ASYNC_WAL);
    region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
    Get g = new Get(row);
    Result result = region.get(g);
    assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
    assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
   } catch (IOException e) {
    e.printStackTrace();
    failures.incrementAndGet();
    fail();
   }
  }
 }
};

代码示例来源:origin: org.apache.hbase/hbase-server

append_2.addColumn(FAMILY, qual, Bytes.toBytes("e"));
if (!walUsed) {
 append_2.setDurability(Durability.SKIP_WAL);

代码示例来源:origin: org.apache.hbase/hbase-thrift

public static Append appendFromThrift(TAppend append) throws IOException {
 Append out = new Append(append.getRow());
 for (TColumnValue column : append.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
 }
 if (append.isSetAttributes()) {
  addAttributes(out, append.getAttributes());
 }
 if (append.isSetDurability()) {
  out.setDurability(durabilityFromThrift(append.getDurability()));
 }
 if(append.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
 }
 return out;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-thrift

public static Append appendFromThrift(TAppend append) throws IOException {
 Append out = new Append(append.getRow());
 for (TColumnValue column : append.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
 }
 if (append.isSetAttributes()) {
  addAttributes(out, append.getAttributes());
 }
 if (append.isSetDurability()) {
  out.setDurability(durabilityFromThrift(append.getDurability()));
 }
 if(append.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
 }
 return out;
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testAppendTimestampsAreMonotonic() throws IOException {
 HRegion region = initHRegion(tableName, method, CONF, fam1);
 ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
 EnvironmentEdgeManager.injectEdge(edge);
 edge.setValue(10);
 Append a = new Append(row);
 a.setDurability(Durability.SKIP_WAL);
 a.addColumn(fam1, qual1, qual1);
 region.append(a);
 Result result = region.get(new Get(row));
 Cell c = result.getColumnLatestCell(fam1, qual1);
 assertNotNull(c);
 assertEquals(10L, c.getTimestamp());
 edge.setValue(1); // clock goes back
 region.append(a);
 result = region.get(new Get(row));
 c = result.getColumnLatestCell(fam1, qual1);
 assertEquals(11L, c.getTimestamp());
 byte[] expected = new byte[qual1.length*2];
 System.arraycopy(qual1, 0, expected, 0, qual1.length);
 System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);
 assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
  expected, 0, expected.length));
}

代码示例来源:origin: harbby/presto-connectors

append.setDurability(toDurability(proto.getDurability()));
for (NameBytesPair attribute: proto.getAttributeList()) {
 append.setAttribute(attribute.getName(), attribute.getValue().toByteArray());

相关文章