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

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

本文整理了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

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

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

  1. @Test
  2. public void testAppendWithReadOnlyTable() throws Exception {
  3. final TableName tableName = TableName.valueOf(name.getMethodName());
  4. this.region = initHRegion(tableName, method, CONF, true, Bytes.toBytes("somefamily"));
  5. boolean exceptionCaught = false;
  6. Append append = new Append(Bytes.toBytes("somerow"));
  7. append.setDurability(Durability.SKIP_WAL);
  8. append.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
  9. Bytes.toBytes("somevalue"));
  10. try {
  11. region.append(append);
  12. } catch (IOException e) {
  13. exceptionCaught = true;
  14. }
  15. assertTrue(exceptionCaught == true);
  16. }

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

  1. @Override
  2. public void run() {
  3. for (int i=0; i<numOps; i++) {
  4. try {
  5. Append a = new Append(row);
  6. a.addColumn(fam1, qual1, val);
  7. a.addColumn(fam1, qual2, val);
  8. a.addColumn(fam2, qual3, val);
  9. a.setDurability(Durability.ASYNC_WAL);
  10. region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
  11. Get g = new Get(row);
  12. Result result = region.get(g);
  13. assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
  14. assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
  15. } catch (IOException e) {
  16. e.printStackTrace();
  17. failures.incrementAndGet();
  18. fail();
  19. }
  20. }
  21. }
  22. };

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

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

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

  1. public static Append appendFromThrift(TAppend append) throws IOException {
  2. Append out = new Append(append.getRow());
  3. for (TColumnValue column : append.getColumns()) {
  4. out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
  5. }
  6. if (append.isSetAttributes()) {
  7. addAttributes(out, append.getAttributes());
  8. }
  9. if (append.isSetDurability()) {
  10. out.setDurability(durabilityFromThrift(append.getDurability()));
  11. }
  12. if(append.getCellVisibility() != null) {
  13. out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
  14. }
  15. if (append.isSetReturnResults()) {
  16. out.setReturnResults(append.isReturnResults());
  17. }
  18. return out;
  19. }

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

  1. @Test
  2. public void testAppendTimestampsAreMonotonic() throws IOException {
  3. region = initHRegion(tableName, method, CONF, fam1);
  4. ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  5. EnvironmentEdgeManager.injectEdge(edge);
  6. edge.setValue(10);
  7. Append a = new Append(row);
  8. a.setDurability(Durability.SKIP_WAL);
  9. a.addColumn(fam1, qual1, qual1);
  10. region.append(a);
  11. Result result = region.get(new Get(row));
  12. Cell c = result.getColumnLatestCell(fam1, qual1);
  13. assertNotNull(c);
  14. assertEquals(10L, c.getTimestamp());
  15. edge.setValue(1); // clock goes back
  16. region.append(a);
  17. result = region.get(new Get(row));
  18. c = result.getColumnLatestCell(fam1, qual1);
  19. assertEquals(11L, c.getTimestamp());
  20. byte[] expected = new byte[qual1.length*2];
  21. System.arraycopy(qual1, 0, expected, 0, qual1.length);
  22. System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);
  23. assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
  24. expected, 0, expected.length));
  25. }

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

  1. @Test
  2. public void testAppendWithReadOnlyTable() throws Exception {
  3. final TableName tableName = TableName.valueOf(name.getMethodName());
  4. this.region = initHRegion(tableName, method, CONF, true, Bytes.toBytes("somefamily"));
  5. boolean exceptionCaught = false;
  6. Append append = new Append(Bytes.toBytes("somerow"));
  7. append.setDurability(Durability.SKIP_WAL);
  8. append.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
  9. Bytes.toBytes("somevalue"));
  10. try {
  11. region.append(append);
  12. } catch (IOException e) {
  13. exceptionCaught = true;
  14. } finally {
  15. HBaseTestingUtility.closeRegionAndWAL(this.region);
  16. this.region = null;
  17. }
  18. assertTrue(exceptionCaught == true);
  19. }

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

  1. @Override
  2. public void run() {
  3. for (int i=0; i<numOps; i++) {
  4. try {
  5. Append a = new Append(row);
  6. a.addColumn(fam1, qual1, val);
  7. a.addColumn(fam1, qual2, val);
  8. a.addColumn(fam2, qual3, val);
  9. a.setDurability(Durability.ASYNC_WAL);
  10. region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
  11. Get g = new Get(row);
  12. Result result = region.get(g);
  13. assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
  14. assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
  15. } catch (IOException e) {
  16. e.printStackTrace();
  17. failures.incrementAndGet();
  18. fail();
  19. }
  20. }
  21. }
  22. };

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

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

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

  1. public static Append appendFromThrift(TAppend append) throws IOException {
  2. Append out = new Append(append.getRow());
  3. for (TColumnValue column : append.getColumns()) {
  4. out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
  5. }
  6. if (append.isSetAttributes()) {
  7. addAttributes(out, append.getAttributes());
  8. }
  9. if (append.isSetDurability()) {
  10. out.setDurability(durabilityFromThrift(append.getDurability()));
  11. }
  12. if(append.getCellVisibility() != null) {
  13. out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
  14. }
  15. return out;
  16. }

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

  1. public static Append appendFromThrift(TAppend append) throws IOException {
  2. Append out = new Append(append.getRow());
  3. for (TColumnValue column : append.getColumns()) {
  4. out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
  5. }
  6. if (append.isSetAttributes()) {
  7. addAttributes(out, append.getAttributes());
  8. }
  9. if (append.isSetDurability()) {
  10. out.setDurability(durabilityFromThrift(append.getDurability()));
  11. }
  12. if(append.getCellVisibility() != null) {
  13. out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
  14. }
  15. return out;
  16. }

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

  1. @Test
  2. public void testAppendTimestampsAreMonotonic() throws IOException {
  3. HRegion region = initHRegion(tableName, method, CONF, fam1);
  4. ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  5. EnvironmentEdgeManager.injectEdge(edge);
  6. edge.setValue(10);
  7. Append a = new Append(row);
  8. a.setDurability(Durability.SKIP_WAL);
  9. a.addColumn(fam1, qual1, qual1);
  10. region.append(a);
  11. Result result = region.get(new Get(row));
  12. Cell c = result.getColumnLatestCell(fam1, qual1);
  13. assertNotNull(c);
  14. assertEquals(10L, c.getTimestamp());
  15. edge.setValue(1); // clock goes back
  16. region.append(a);
  17. result = region.get(new Get(row));
  18. c = result.getColumnLatestCell(fam1, qual1);
  19. assertEquals(11L, c.getTimestamp());
  20. byte[] expected = new byte[qual1.length*2];
  21. System.arraycopy(qual1, 0, expected, 0, qual1.length);
  22. System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);
  23. assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
  24. expected, 0, expected.length));
  25. }

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

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

相关文章