Hbase原子性操作
来源:互联网 发布:手机淘宝首页海报尺寸 编辑:程序博客网 时间:2024/05/18 21:47
1. 使用检查写(check and put)可以保证操作的原子性。即执行put前先检查数值是否与提供的value一致,如果检查通过就执行put,否则就放弃。如果需要put前该字段值不存在,将value设置成null即可。
@Testpublic void testCheckPut() throws Exception{Table table = conn.getTable(TableName.valueOf("t1"));Put put = new Put(Bytes.toBytes("row2"));put.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("name"), Bytes.toBytes("terry2"));put.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("job"), Bytes.toBytes("manager2"));boolean res = table.checkAndPut(Bytes.toBytes("row2"), Bytes.toBytes("cf"), Bytes.toBytes("name"), Bytes.toBytes("terry"), put);if(res)System.out.println("update success");elseSystem.out.println("update failure");table.close();}
阅读全文
0 0
- Hbase原子性操作
- HBase原子性保证
- HBase原子性保证
- 原子性与原子操作
- 原子性操作atomic_t
- 原子性操作atomic_t
- 原子性操作atomic_t
- 原子性操作atomic_t
- 原子性操作atomic_t
- 非原子性操作
- 原子性操作
- 原子性与非原子性操作
- 什么是原子性,什么是原子性操作?
- 什么是原子性,什么是原子性操作
- HBase MVCC和内建的原子操作
- 简单操作的原子性
- C++ 中的原子性操作
- linux 原子性操作atomic_t
- php ob_flush无效
- Ubuntu16.04下安装CUDA8.0和tensorflow
- python的logging类
- Hbase API操作优化
- Button被RecyclerView覆盖导致无法点击的问题
- Hbase原子性操作
- firefox解决 显示 您的连接不安全
- 计算Fibonacci数
- EXCEL常用函数笔记
- bash编程之 shell基本语法
- Linux进程全解11——进程间通信(IPC)概述
- VM虚拟机中centos的网络配置的问题与解决
- bash编程之 If和Case语句
- 一个农村大男孩的IT梦