3 | Generated by Apache Maven Doxia Site Renderer
1.6
4 | Rendered using Apache Maven Fluido Skin
1.5-HBASE
6 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
8 <meta charset=
"UTF-8" />
9 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0" />
10 <meta name=
"Date-Revision-yyyymmdd" content=
"20180311" />
11 <meta http-equiv=
"Content-Language" content=
"en" />
12 <title>Apache HBase
–
13 Apache HBase (TM) ACID Properties
15 <link rel=
"stylesheet" href=
"./css/apache-maven-fluido-1.5-HBASE.min.css" />
16 <link rel=
"stylesheet" href=
"./css/site.css" />
17 <link rel=
"stylesheet" href=
"./css/print.css" media=
"print" />
20 <script type=
"text/javascript" src=
"./js/apache-maven-fluido-1.5-HBASE.min.js"></script>
24 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0"></meta>
27 <link rel=
"stylesheet" href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css"/>
30 <link rel=
"stylesheet" href=
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/github.min.css"/>
33 <link rel=
"stylesheet" href=
"css/site.css"/>
36 <script src=
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
39 <body class=
"topBarEnabled">
45 <div id=
"topbar" class=
"navbar navbar-fixed-top ">
46 <div class=
"navbar-inner">
47 <div class=
"container">
48 <a data-target=
".nav-collapse" data-toggle=
"collapse" class=
"btn btn-navbar">
49 <span class=
"icon-bar"></span>
50 <span class=
"icon-bar"></span>
51 <span class=
"icon-bar"></span>
53 <div class=
"nav-collapse">
57 <a href=
"#" class=
"dropdown-toggle" data-toggle=
"dropdown">Apache HBase Project
<b class=
"caret"></b></a>
58 <ul class=
"dropdown-menu">
60 <li> <a href=
"index.html" title=
"Overview">Overview
</a>
63 <li> <a href=
"license.html" title=
"License">License
</a>
66 <li> <a href=
"http://www.apache.org/dyn/closer.cgi/hbase/" title=
"Downloads">Downloads
</a>
69 <li> <a href=
"https://issues.apache.org/jira/browse/HBASE?report=com.atlassian.jira.plugin.system.project:changelog-panel#selectedTab=com.atlassian.jira.plugin.system.project%3Achangelog-panel" title=
"Release Notes">Release Notes
</a>
72 <li> <a href=
"coc.html" title=
"Code Of Conduct">Code Of Conduct
</a>
75 <li> <a href=
"http://blogs.apache.org/hbase/" title=
"Blog">Blog
</a>
78 <li> <a href=
"mail-lists.html" title=
"Mailing Lists">Mailing Lists
</a>
81 <li> <a href=
"team-list.html" title=
"Team">Team
</a>
84 <li> <a href=
"https://reviews.apache.org/" title=
"ReviewBoard">ReviewBoard
</a>
87 <li> <a href=
"sponsors.html" title=
"Thanks">Thanks
</a>
90 <li> <a href=
"poweredbyhbase.html" title=
"Powered by HBase">Powered by HBase
</a>
93 <li> <a href=
"resources.html" title=
"Other resources">Other resources
</a>
98 <a href=
"#" class=
"dropdown-toggle" data-toggle=
"dropdown">Project Information
<b class=
"caret"></b></a>
99 <ul class=
"dropdown-menu">
101 <li> <a href=
"project-summary.html" title=
"Project Summary">Project Summary
</a>
104 <li> <a href=
"dependency-info.html" title=
"Dependency Information">Dependency Information
</a>
107 <li> <a href=
"team-list.html" title=
"Team">Team
</a>
110 <li> <a href=
"source-repository.html" title=
"Source Repository">Source Repository
</a>
113 <li> <a href=
"issue-tracking.html" title=
"Issue Tracking">Issue Tracking
</a>
116 <li> <a href=
"dependency-management.html" title=
"Dependency Management">Dependency Management
</a>
119 <li> <a href=
"dependencies.html" title=
"Dependencies">Dependencies
</a>
122 <li> <a href=
"dependency-convergence.html" title=
"Dependency Convergence">Dependency Convergence
</a>
125 <li> <a href=
"integration.html" title=
"Continuous Integration">Continuous Integration
</a>
128 <li> <a href=
"plugin-management.html" title=
"Plugin Management">Plugin Management
</a>
131 <li> <a href=
"plugins.html" title=
"Plugins">Plugins
</a>
135 <li class=
"dropdown">
136 <a href=
"#" class=
"dropdown-toggle" data-toggle=
"dropdown">Documentation and API
<b class=
"caret"></b></a>
137 <ul class=
"dropdown-menu">
139 <li> <a href=
"book.html" target=
"_blank" title=
"Reference Guide">Reference Guide
</a>
142 <li> <a href=
"apache_hbase_reference_guide.pdf" target=
"_blank" title=
"Reference Guide (PDF)">Reference Guide (PDF)
</a>
145 <li> <a href=
"book.html#quickstart" target=
"_blank" title=
"Getting Started">Getting Started
</a>
148 <li> <a href=
"apidocs/index.html" target=
"_blank" title=
"User API">User API
</a>
151 <li> <a href=
"testapidocs/index.html" target=
"_blank" title=
"User API (Test)">User API (Test)
</a>
154 <li> <a href=
"devapidocs/index.html" target=
"_blank" title=
"Developer API">Developer API
</a>
157 <li> <a href=
"testdevapidocs/index.html" target=
"_blank" title=
"Developer API (Test)">Developer API (Test)
</a>
160 <li> <a href=
"http://abloz.com/hbase/book.html" target=
"_blank" title=
"中文参考指南(单页)">中文参考指南(单页)
</a>
163 <li> <a href=
"book.html#faq" target=
"_blank" title=
"FAQ">FAQ
</a>
166 <li> <a href=
"book.html#other.info" target=
"_blank" title=
"Videos/Presentations">Videos/Presentations
</a>
169 <li> <a href=
"http://wiki.apache.org/hadoop/Hbase" target=
"_blank" title=
"Wiki">Wiki
</a>
172 <li> <a href=
"acid-semantics.html" target=
"_blank" title=
"ACID Semantics">ACID Semantics
</a>
175 <li> <a href=
"book.html#arch.bulk.load" target=
"_blank" title=
"Bulk Loads">Bulk Loads
</a>
178 <li> <a href=
"metrics.html" target=
"_blank" title=
"Metrics">Metrics
</a>
181 <li> <a href=
"cygwin.html" target=
"_blank" title=
"HBase on Windows">HBase on Windows
</a>
184 <li> <a href=
"book.html#replication" target=
"_blank" title=
"Cluster replication">Cluster replication
</a>
187 <li class=
"dropdown-submenu">
188 <a href=
"" title=
"1.2 Documentation">1.2 Documentation
</a>
189 <ul class=
"dropdown-menu">
190 <li> <a href=
"1.2/apidocs/index.html" target=
"_blank" title=
"API">API
</a>
192 <li> <a href=
"1.2/xref/index.html" target=
"_blank" title=
"X-Ref">X-Ref
</a>
194 <li> <a href=
"1.2/book.html" target=
"_blank" title=
"Ref Guide (single-page)">Ref Guide (single-page)
</a>
200 <li class=
"dropdown">
201 <a href=
"#" class=
"dropdown-toggle" data-toggle=
"dropdown">ASF
<b class=
"caret"></b></a>
202 <ul class=
"dropdown-menu">
204 <li> <a href=
"http://www.apache.org/foundation/" target=
"_blank" title=
"Apache Software Foundation">Apache Software Foundation
</a>
207 <li> <a href=
"http://www.apache.org/foundation/how-it-works.html" target=
"_blank" title=
"How Apache Works">How Apache Works
</a>
210 <li> <a href=
"http://www.apache.org/foundation/sponsorship.html" target=
"_blank" title=
"Sponsoring Apache">Sponsoring Apache
</a>
216 <div id=
"search-form" class=
"navbar-search pull-right">
217 <script type=
"text/javascript">
218 var cx = '
000385458301414556862:sq1bb0xugjg';
221 var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
222 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cse.google.com/cse.js?cx=' + cx;
223 var s = document.getElementsByTagName('script')[
0]; s.parentNode.insertBefore(gcse, s);
227 <gcse:search></gcse:search>
238 <div class=
"container">
240 <div class=
"pull-left">
241 <a href=
"./" id=
"bannerLeft">
245 <div class=
"pull-right"> <a href=
"./" id=
"bannerRight">
246 <img src=
"images/hbase_logo_with_orca_large.png" alt=
"Apache HBase"/>
249 <div class=
"clear"><hr/></div>
252 <div id=
"breadcrumbs">
253 <ul class=
"breadcrumb">
265 <div id=
"bodyColumn" >
267 <!-- Licensed to the Apache Software Foundation (ASF) under one
268 or more contributor license agreements. See the NOTICE file
269 distributed with this work for additional information
270 regarding copyright ownership. The ASF licenses this file
271 to you under the Apache License, Version
2.0 (the
272 "License"); you may not use this file except in compliance
273 with the License. You may obtain a copy of the License at
275 http://www.apache.org/licenses/LICENSE-
2.0
277 Unless required by applicable law or agreed to in writing,
278 software distributed under the License is distributed on an
279 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
280 KIND, either express or implied. See the License for the
281 specific language governing permissions and limitations
282 under the License. --
>
284 <div class=
"section">
285 <h2><a name=
"About_this_Document"></a>About this Document
</h2>
287 <p>Apache HBase (TM) is not an ACID compliant database. However, it does guarantee certain specific
290 <p>This specification enumerates the ACID properties of HBase.
</p>
293 <div class=
"section">
294 <h2><a name=
"Definitions"></a>Definitions
</h2>
296 <p>For the sake of common vocabulary, we define the following terms:
</p>
302 <dd>an operation is atomic if it either completes entirely or not at all
</dd>
308 all actions cause the table to transition from one valid state directly to another
309 (eg a row will not disappear during an update, etc)
316 an operation is isolated if it appears to complete independently of any other concurrent transaction
322 <dd>any update that reports
"successful
" to the client will not be lost
</dd>
327 <dd>an update is considered visible if any subsequent read will see the update as having been committed
</dd>
331 The terms
<i>must
</i> and
<i>may
</i> are used as specified by RFC
2119.
332 In short, the word
"must
" implies that, if some case exists where the statement
333 is not true, it is a bug. The word
"may
" implies that, even if the guarantee
334 is provided in a current release, users should not rely on it.
338 <div class=
"section">
339 <h2><a name=
"APIs_to_consider"></a>APIs to consider
</h2>
364 <li>Combination (read-modify-write) APIs
</li>
368 <li>incrementColumnValue
</li>
376 <div class=
"section">
377 <h2><a name=
"Guarantees_Provided"></a>Guarantees Provided
</h2>
380 <div class=
"section">
381 <h2><a name=
"Atomicity"></a>Atomicity
</h2>
384 <ol style=
"list-style-type: decimal">
386 <li>All mutations are atomic within a row. Any put will either wholly succeed or wholly fail.[
3]
</li>
388 <ol style=
"list-style-type: decimal">
390 <li>An operation that returns a
"success
" code has completely succeeded.
</li>
392 <li>An operation that returns a
"failure
" code has completely failed.
</li>
394 <li>An operation that times out may have succeeded and may have failed. However,
395 it will not have partially succeeded or failed.
</li>
398 <li> This is true even if the mutation crosses multiple column families within a row.
</li>
400 <li> APIs that mutate several rows will _not_ be atomic across the multiple rows.
401 For example, a multiput that operates on rows 'a','b', and 'c' may return having
402 mutated some but not all of the rows. In such cases, these APIs will return a list
403 of success codes, each of which may be succeeded, failed, or timed out as described above.
</li>
405 <li> The checkAndPut API happens atomically like the typical compareAndSet (CAS) operation
406 found in many hardware architectures.
</li>
408 <li> The order of mutations is seen to happen in a well-defined order for each row, with no
409 interleaving. For example, if one writer issues the mutation
"a=
1,b=
1,c=
1" and
410 another writer issues the mutation
"a=
2,b=
2,c=
2", the row must either
411 be
"a=
1,b=
1,c=
1" or
"a=
2,b=
2,c=
2" and must
<i>not
</i> be something
412 like
"a=
1,b=
2,c=
1".
</li>
414 <ol style=
"list-style-type: decimal">
416 <li>Please note that this is not true _across rows_ for multirow batch mutations.
</li>
421 <div class=
"section">
422 <h2><a name=
"Consistency_and_Isolation"></a>Consistency and Isolation
</h2>
424 <ol style=
"list-style-type: decimal">
426 <li>All rows returned via any access API will consist of a complete row that existed at
427 some point in the table's history.
</li>
429 <li>This is true across column families - i.e a get of a full row that occurs concurrent
430 with some mutations
1,
2,
3,
4,
5 will return a complete row that existed at some point in time
431 between mutation i and i+
1 for some i between
1 and
5.
</li>
433 <li>The state of a row will only move forward through the history of edits to it.
</li>
437 <div class=
"section">
438 <h2><a name=
"Consistency_of_Scans"></a>Consistency of Scans
</h2>
441 A scan is
<b>not
</b> a consistent view of a table. Scans do
442 <b>not
</b> exhibit
<i>snapshot isolation
</i>.
446 Rather, scans have the following properties:
450 <ol style=
"list-style-type: decimal">
453 Any row returned by the scan will be a consistent view (i.e. that version
454 of the complete row existed at some point in time) [
1]
458 A scan will always reflect a view of the data
<i>at least as new as
</i>
459 the beginning of the scan. This satisfies the visibility guarantees
460 enumerated below.
</li>
462 <ol style=
"list-style-type: decimal">
464 <li>For example, if client A writes data X and then communicates via a side
465 channel to client B, any scans started by client B will contain data at least
468 <li>A scan _must_ reflect all mutations committed prior to the construction
469 of the scanner, and _may_ reflect some mutations committed subsequent to the
470 construction of the scanner.
</li>
472 <li>Scans must include
<i>all
</i> data written prior to the scan (except in
473 the case where data is subsequently mutated, in which case it _may_ reflect
479 Those familiar with relational databases will recognize this isolation level as
"read committed
".
483 Please note that the guarantees listed above regarding scanner consistency
484 are referring to
"transaction commit time
", not the
"timestamp
"
485 field of each cell. That is to say, a scanner started at time
<i>t
</i> may see edits
486 with a timestamp value greater than
<i>t
</i>, if those edits were committed with a
487 "forward dated
" timestamp before the scanner was constructed.
492 <div class=
"section">
493 <h2><a name=
"Visibility"></a>Visibility
</h2>
495 <ol style=
"list-style-type: decimal">
497 <li> When a client receives a
"success
" response for any mutation, that
498 mutation is immediately visible to both that client and any client with whom it
499 later communicates through side channels. [
3]
</li>
501 <li> A row must never exhibit so-called
"time-travel
" properties. That
502 is to say, if a series of mutations moves a row sequentially through a series of
503 states, any sequence of concurrent reads will return a subsequence of those states.
</li>
505 <ol style=
"list-style-type: decimal">
507 <li>For example, if a row's cells are mutated using the
"incrementColumnValue
"
508 API, a client must never see the value of any cell decrease.
</li>
510 <li>This is true regardless of which read API is used to read back the mutation.
</li>
513 <li> Any version of a cell that has been returned to a read operation is guaranteed to
514 be durably stored.
</li>
519 <div class=
"section">
520 <h2><a name=
"Durability"></a>Durability
</h2>
522 <ol style=
"list-style-type: decimal">
524 <li> All visible data is also durable data. That is to say, a read will never return
525 data that has not been made durable on disk[
2]
</li>
527 <li> Any operation that returns a
"success
" code (eg does not throw an exception)
528 will be made durable.[
3]
</li>
530 <li> Any operation that returns a
"failure
" code will not be made durable
531 (subject to the Atomicity guarantees above)
</li>
533 <li> All reasonable failure scenarios will not affect any of the guarantees of this document.
</li>
538 <div class=
"section">
539 <h2><a name=
"Tunability"></a>Tunability
</h2>
541 <p>All of the above guarantees must be possible within Apache HBase. For users who would like to trade
542 off some guarantees for performance, HBase may offer several tuning options. For example:
</p>
546 <li>Visibility may be tuned on a per-read basis to allow stale reads or time travel.
</li>
548 <li>Durability may be tuned to only flush data to disk on a periodic basis
</li>
553 <div class=
"section">
554 <h2><a name=
"More_Information"></a>More Information
</h2>
557 For more information, see the
<a href=
"book.html#client">client architecture
</a> or
<a href=
"book.html#datamodel">data model
</a> sections in the Apache HBase Reference Guide.
562 <div class=
"section">
563 <h2><a name=
"Footnotes"></a>Footnotes
</h2>
565 <p>[
1] A consistent view is not guaranteed intra-row scanning -- i.e. fetching a portion of
566 a row in one RPC then going back to fetch another portion of the row in a subsequent RPC.
567 Intra-row scanning happens when you set a limit on how many values to return per Scan#next
568 (See
<a class=
"externalLink" href=
"http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setBatch(int)">Scan#setBatch(int)
</a>).
572 <p>[
2] In the context of Apache HBase,
"durably on disk
" implies an hflush() call on the transaction
573 log. This does not actually imply an fsync() to magnetic media, but rather just that the data has been
574 written to the OS cache on all replicas of the log. In the case of a full datacenter power loss, it is
575 possible that the edits are not truly durable.
</p>
577 <p>[
3] Puts will either wholly succeed or wholly fail, provided that they are actually sent
578 to the RegionServer. If the writebuffer is used, Puts will not be sent until the writebuffer is filled
579 or it is explicitly flushed.
</p>
591 <div class=
"container">
593 <p >Copyright
© 2007–2018
594 <a href=
"https://www.apache.org/">The Apache Software Foundation
</a>.
597 <li id=
"publishDate" class=
"pull-right">Last Published:
2018-
03-
11</li>
601 <p id=
"poweredBy" class=
"pull-right">
602 <a href=
"http://maven.apache.org/" title=
"Built by Maven" class=
"poweredBy">
603 <img class=
"builtBy" alt=
"Built by Maven" src=
"./images/logos/maven-feather.png" />