HBase 事务性 (Transaction)

php中文网
发布: 2016-06-07 17:27:19
原创
1639人浏览过

What is Transaction 先摘录一段wiki关于transaction(事务)的释义: A transaction comprises a unit of work performed withi

What is Transaction

先摘录一段wiki关于transaction(事务)的释义:

A transaction comprises a unit of work performed within a database management system (or similar system) against a database, and treated in a coherent and reliable way independent of other transactions. Transactions in a database environment have two main purposes:
1. To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status.

2. To provide isolation between programs accessing a database concurrently. If this isolation is not provided, the program's outcome are possibly erroneous.
A database transaction, by definition, must be atomic, consistent, isolated and durable. Database practitioners often refer to these properties of database transactions using the acronym ACID.
Transactions provide an "all-or-nothing" proposition, stating that each work-unit performed in a database must either complete in its entirety or have no effect whatsoever. Further, the system must isolate each transaction from other transactions, results must conform to existing constraints in the database, and transactions that complete successfully must get written to durable storage.

其中,all-or-nothing很明确的表达了事务的本质:“要么全成功,要么什么都没发生过”。可以把它看作一个原子操作。

 

 

HBase Transaction

(注:这里经过补充与修改,第一天就被转载本博文这里的描述不够准确)

HBase的支持的事务很有限,0.94版本的新特性中有两条:

[HBASE-3584] - Allow atomic put/delete in one call.

[HBASE-5229] - Provide basic building blocks for "multi-row" local transactions.

XYCMS企业建站系统1.2
XYCMS企业建站系统1.2

XYCMS(PHP版)企业建站系统是XYCMS工作室推出的一套通用的企业建站软件系统。XYCMS企业建站系统是专业从事企业网站制作与设计服务,已有四年工作经验,网站系统方便、简洁、容易上手。所设计的版本分为动态版和静态版,比起市场上同类系统,性价比还是很高的,在企业网站建设行业里拥有丰富的经验,并在业界取得好评。 更新日志:1.后台简单特殊字符替换XYCMS(PHP版) 软件的安装:1. 上传 u

XYCMS企业建站系统1.2 0
查看详情 XYCMS企业建站系统1.2

第一条,我引用NoSQLFan的解读:

“0.94版本具备更完整的事务支持: 之前Hbase提供行级的事务,不过每次事务只能执行一个写操作,比如连续地执行一系列Put,Delete操作,那么这些操作是单独一个个的事务,其整体并不是原子性执行的。而在0.94版本中,可以实现Put、Delete在同一个事务中一起原子性执行。”

具体怎么用呢?有下面这一段Sample:

//Add API for atomic row mutations to HBase (currently Put and Delete).
Client API would look like this:
Delete d = new Delete(ROW);
Put p = new Put(ROW);
//...
AtomicRowMutation arm = new AtomicRowMutation(ROW);
arm.add(p);
arm.add(d);
myHtable.atomicMutation(arm);

可以看到,这里的事务仅仅是针对某一行的一系列Put/Delete操作。不同行、不同表间一系列操作是无法放在一个事务中的。

第二条,,我的个人理解,这次是多行一并的事务了!不过貌似是“同一Region中的多行”。因为文中一句“ Global (cross region) transactions are not discussed here.

因此对一张多Region表来说,还是无法保证每次修改都能封装为一个事务。

linux

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号