热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.hadoop.hbase.regionserver.HRegion.increment()方法的使用及代码示例

本文整理了Java中org.apache.hadoop.hbase.regionserver.HRegion.increment()方法的一些代码示例,展示了

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

HRegion.increment介绍

[英]Perform one or more increment operations on a row.

Increments performed are done under row lock but reads do not take locks out so this can be seen partially complete by gets and scans.
[中]对一行执行一个或多个增量操作。
执行的增量是在行锁定下完成的,但读取不会解除锁定,因此可以通过GET和扫描看到部分完成。

代码示例

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

@Override
public Result increment(Increment increment) throws IOException {
return increment(increment, HConstants.NO_NONCE, HConstants.NO_NONCE);
}

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

@Override
public void run() {
for (int i = 0; i try {
this.region.increment(this.increment);
// LOG.info(getName() + " " + i);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

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

@Override
public void run() {
for (int i = 0; i try {
int index = ThreadLocalRandom.current().nextInt(0, this.increments.length);
this.region.increment(this.increments[index]);
// LOG.info(getName() + " " + index);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

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

@Override
public void run() {
try {
for (int i = 0; i <100; i++) {
byte[] row = Bytes.toBytes("incrementRow" + i);
Increment inc = new Increment(row);
inc.addColumn("cf".getBytes(), Bytes.toBytes(0), 1);
// inc.setDurability(Durability.ASYNC_WAL);
region.increment(inc);
latch.countDown();
Thread.sleep(10);
}
} catch (Throwable t) {
LOG.warn("Error happend when Put: ", t);
}
}
}

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

@Override
public void run() {
int count = 0;
while (count Increment inc = new Increment(incRow);
inc.addColumn(family, qualifier, ONE);
count++;
try {
region.increment(inc);
} catch (IOException e) {
LOG.info("Count=" + count + ", " + e);
break;
}
}
}
}

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

@Test
public void testIncrWithReadOnlyTable() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
this.region = initHRegion(tableName, method, CONF, true, Bytes.toBytes("somefamily"));
boolean exceptiOnCaught= false;
Increment inc = new Increment(Bytes.toBytes("somerow"));
inc.setDurability(Durability.SKIP_WAL);
inc.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"), 1L);
try {
region.increment(inc);
} catch (IOException e) {
exceptiOnCaught= true;
}
assertTrue(exceptiOnCaught== true);
}

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

/**
* Test when returnResults set to false in increment it should not return the result instead it
* resturn null.
*/
@Test
public void testIncrementWithReturnResultsSetToFalse() throws Exception {
byte[] row1 = Bytes.toBytes("row1");
byte[] col1 = Bytes.toBytes("col1");
// Setting up region
WALFactory wals = new WALFactory(CONF,
ServerName
.valueOf("testIncrementWithReturnResultsSetToFalse", 16010, System.currentTimeMillis())
.toString());
HRegion region = createHRegion(wals, Durability.USE_DEFAULT);
Increment inc1 = new Increment(row1);
inc1.setReturnResults(false);
inc1.addColumn(FAMILY, col1, 1);
Result res = region.increment(inc1);
assertTrue(res.isEmpty());
}

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

@Test
public void testIncrementWithNonExistingFamily() throws IOException {
initHRegion(tableName, name.getMethodName(), fam1);
final Increment inc = new Increment(row);
inc.addColumn(fam1, qual1, 1);
inc.addColumn(fam2, qual2, 1);
inc.setDurability(Durability.ASYNC_WAL);
try {
region.increment(inc, HConstants.NO_NONCE, HConstants.NO_NONCE);
} catch (NoSuchColumnFamilyException e) {
final Get g = new Get(row);
final Result result = region.get(g);
assertEquals(null, result.getValue(fam1, qual1));
assertEquals(null, result.getValue(fam2, qual2));
} catch (Exception e) {
fail("Increment operation should fail with NoSuchColumnFamilyException.");
}
}

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

for (int i=0;i<5;i++) region.increment(odd, HConstants.NO_NONCE, HConstants.NO_NONCE);
region.flush(true);
for (int i=0;i<5;i++) region.increment(even, HConstants.NO_NONCE, HConstants.NO_NONCE);
Result result = region.increment(all, HConstants.NO_NONCE, HConstants.NO_NONCE);
assertEquals(numQualifiers, result.size());
Cell [] kvs = result.rawCells();

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

region.increment(incr); // 2

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

Result res = region.increment(inc1);
assertEquals(1, res.size());
assertEquals(0, Bytes.toLong(res.getValue(FAMILY, col1)));
res = region.increment(inc1);
assertEquals(1, res.size());
assertEquals(1, Bytes.toLong(res.getValue(FAMILY, col1)));
res = region.increment(inc1);
assertEquals(1, res.size());
assertEquals(1, Bytes.toLong(res.getValue(FAMILY, col1)));
inc1.addColumn(FAMILY, col2, 0);
inc1.addColumn(FAMILY, col3, 0);
res = region.increment(inc1);
assertEquals(3, res.size());
assertEquals(1, Bytes.toLong(res.getValue(FAMILY, col1)));
inc1.addColumn(FAMILY, col2, 4);
inc1.addColumn(FAMILY, col3, 3);
res = region.increment(inc1);
assertEquals(3, res.size());
assertEquals(6, Bytes.toLong(res.getValue(FAMILY, col1)));

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

@Test
public void testIncrementTimestampsAreMonotonic() throws IOException {
region = initHRegion(tableName, method, CONF, fam1);
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
EnvironmentEdgeManager.injectEdge(edge);
edge.setValue(10);
Increment inc = new Increment(row);
inc.setDurability(Durability.SKIP_WAL);
inc.addColumn(fam1, qual1, 1L);
region.increment(inc);
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.increment(inc);
result = region.get(new Get(row));
c = result.getColumnLatestCell(fam1, qual1);
assertEquals(11L, c.getTimestamp());
assertEquals(2L, Bytes.toLong(c.getValueArray(), c.getValueOffset(), c.getValueLength()));
}

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

long nOnce= mutation.hasNonce() ? mutation.getNonce() : HConstants.NO_NONCE;
if (canProceed) {
r = region.increment(increment, nonceGroup, nonce);
} else {

代码示例来源:origin: co.cask.hbase/hbase

/**
*
* Perform one or more increment operations on a row.
*


* Increments performed are done under row lock but reads do not take locks
* out so this can be seen partially complete by gets and scans.
* @param increment
* @param writeToWAL
* @return new keyvalues after increment
* @throws IOException
*/
public Result increment(Increment increment, boolean writeToWAL)
throws IOException {
return increment(increment, null, writeToWAL);
}

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

public Result increment(Increment increment) throws IOException {
return increment(increment, HConstants.NO_NONCE, HConstants.NO_NONCE);
}

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

@Override
public void run() {
for (int i = 0; i try {
this.region.increment(this.increment);
// LOG.info(getName() + " " + i);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

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

@Override
public void run() {
for (int i = 0; i try {
int index = ThreadLocalRandom.current().nextInt(0, this.increments.length);
this.region.increment(this.increments[index]);
// LOG.info(getName() + " " + index);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

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

@Override
public void run() {
try {
for (int i = 0; i <100; i++) {
byte[] row = Bytes.toBytes("incrementRow" + i);
Increment inc = new Increment(row);
inc.addColumn("cf".getBytes(), Bytes.toBytes(0), 1);
// inc.setDurability(Durability.ASYNC_WAL);
region.increment(inc);
latch.countDown();
Thread.sleep(10);
}
} catch (Throwable t) {
LOG.warn("Error happend when Put: ", t);
}
}
}

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

@Override
public void run() {
int count = 0;
while (count Increment inc = new Increment(incRow);
inc.addColumn(family, qualifier, ONE);
count++;
try {
region.increment(inc);
} catch (IOException e) {
LOG.info("Count=" + count + ", " + e);
break;
}
}
}
}

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

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

推荐阅读
author-avatar
遗失的美好顺_599
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有