ACID in HBase
By Lars Hofhansl As we know, ACID stands for Atomicity, Consistency, Isolation, and Durability. HBase supports ACID in limited ways, namely Puts to the same row provide all ACID guarantees. (HBASE-3584 adds multi op transactions and HBASE-
By Lars HofhanslAs we know, ACID stands for Atomicity, Consistency, Isolation, and Durability.
HBase supports ACID in limited ways, namely Puts to the same row provide all ACID guarantees. (HBASE-3584 adds multi op transactions and HBASE-5229 adds multi row transactions, but the principle remains the same)
So how does ACID work in HBase?
HBase employs a kind of MVCC. And HBase has no mixed read/write transactions.
The nomenclature in HBase is bit strange for historical reasons. In a nutshell each RegionServer maintains what I will call "strictly monotonically increasing transaction numbers".
When a write transaction (a set of puts or deletes) starts it retrieves the next highest transaction number. In HBase this is called a WriteNumber.
When a read transaction (a Scan or Get) starts it retrieves the transaction number of the last committed transaction. HBase calls this the ReadPoint.
Each created KeyValue is tagged with its transaction's WriteNumber (this tag, for historical reasons, is called the memstore timestamp in HBase. Note that this is separate from the application-visible timestamp.)
The highlevel flow of a write transaction in HBase looks like this:
- lock the row(s), to guard against concurrent writes to the same row(s)
- retrieve the current writenumber
- apply changes to the WAL (Write Ahead Log)
- apply the changes to the Memstore (using the acquired writenumber to tag the KeyValues)
- commit the transaction, i.e. attempt to roll the Readpoint forward to the acquired Writenumber.
- unlock the row(s)
- open the scanner
- get the current readpoint
- filter all scanned KeyValues with memstore timestamp > the readpoint
- close the scanner (this is initiated by the client)
It is important to realize that this only works if transactions are committed strictly serially; otherwise an earlier uncommitted transaction could become visible when one that started later commits first. In HBase transaction are typically short, so this is not a problem.
HBase does exactly that: All transactions are committed serially.
Committing a transaction in HBase means settting the current ReadPoint to the transaction's WriteNumber, and hence make its changes visible to all new Scans.
HBase keeps a list of all unfinished transactions. A transaction's commit is delayed until all prior transactions committed. Note that HBase can still make all changes immediately and concurrently, only the commits are serial.
Since HBase does not guarantee any consistency between regions (and each region is hosted at exactly one RegionServer) all MVCC data structures only need to be kept in memory on every region server.
The next interesting question is what happens during compactions.
In HBase compactions are used to join multiple small store files (create by flushes of the MemStore to disk) into a larger ones and also to remove "garbage" in the process.
Garbage here are KeyValues that either expired due to a column family's TTL or VERSION settings or were marked for deletion. See here and here for more details.
Now imagine a compaction happening while a scanner is still scanning through the KeyValues. It would now be possible see a partial row (see here for how HBase defines a "row") - a row comprised of versions of KeyValues that do not reflect the outcome of any serializable transaction schedule.
The solution in HBase is to keep track of the earliest readpoint used by any open scanner and never collect any KeyValues with a memstore timestamp larger than that readpoint. That logic was - among other enhancements - added with HBASE-2856, which allowed HBase to support ACID guarantees even with concurrent flushes.
HBASE-5569 finally enables the same logic for the delete markers (and hence deleted KeyValues).
Lastly, note that a KeyValue's memstore timestamp can be cleared (set to 0) when it is older than the oldest scanner. I.e. it is known to be visible to every scanner, since all earlier scanner are finished.
Update Thursday, March 22:
A couple of extra points:
- The readpoint is rolled forward even if the transaction failed in order to not stall later transactions that waiting to be committed (since this is all in the same process, that just mean the roll forward happens in a Java finally block).
- When updates are written to the WAL a single record is created for the all changes. There is no separate commit record.
- When a RegionServer crashes, all in flight transaction are eventually replayed on another RegionServer if the WAL record was written completely or discarded otherwise.
原文地址:ACID in HBase, 感谢原作者分享。

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











빅데이터 시대가 도래하면서 데이터의 처리와 저장이 더욱 중요해지고 있으며, 대용량 데이터를 어떻게 효율적으로 관리하고 분석할 것인가가 기업의 과제가 되었습니다. Apache Foundation의 두 가지 프로젝트인 Hadoop과 HBase는 빅데이터 저장 및 분석을 위한 솔루션을 제공합니다. 이 기사에서는 빅데이터 저장 및 쿼리를 위해 Beego에서 Hadoop 및 HBase를 사용하는 방법을 소개합니다. 1. Hadoop 및 HBase 소개 Hadoop은 오픈 소스 분산 스토리지 및 컴퓨팅 시스템입니다.

PHP 프로그래밍의 데이터 엄격 설계(ACID) PHP 프로그래밍에서 데이터 엄격 설계는 매우 중요한 측면입니다. 안정적인 애플리케이션은 데이터를 올바르게 처리해야 할 뿐만 아니라 데이터 보안과 일관성도 보장해야 합니다. 이러한 이유로 개발자는 시스템의 안정성과 신뢰성을 보장하기 위해 데이터 설계에 ACID를 사용해야 합니다. ACID는 원자성(Atomicity), 일관성(Consistency), 격리성(Isolation), 내구성(Durability)을 의미합니다.

종속성: org.springframework.dataspring-data-hadoop-hbase2.5.0.RELEASEorg.apache.hbasehbase-client1.1.2org.springframework.dataspring-data-hadoop2.5.0.RELEASE 구성을 추가하는 공식적인 방법은 xml을 사용하는 것입니다. simple 다시 작성하면 다음과 같습니다. @ConfigurationpublicclassHBaseConfiguration{@Value("${hbase.zooke

Java를 사용하여 HBase 기반 NoSQL 데이터베이스 애플리케이션을 개발하는 방법 소개: 빅 데이터 시대의 도래와 함께 NoSQL 데이터베이스는 대용량 데이터를 처리하는 중요한 도구 중 하나가 되었습니다. HBase는 오픈소스 분산형 NoSQL 데이터베이스 시스템으로 빅데이터 분야에서 광범위한 애플리케이션을 보유하고 있습니다. 이 기사에서는 Java를 사용하여 HBase 기반 NoSQL 데이터베이스 애플리케이션을 개발하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 1. HBase 소개: HBase는 Hadoop 기반의 분산 시스템입니다.

빅데이터 시대가 도래하면서 대용량 데이터의 저장과 처리가 더욱 중요해졌습니다. NoSQL 데이터베이스 측면에서 현재 널리 사용되는 솔루션은 HBase입니다. Go 언어는 정적으로 강력한 형식의 프로그래밍 언어로서 간단한 구문과 뛰어난 성능으로 인해 클라우드 컴퓨팅, 웹 사이트 개발, 데이터 과학 등의 분야에서 점점 더 많이 사용되고 있습니다. 이 기사에서는 Go 언어에서 HBase를 사용하여 효율적인 NoSQL 데이터베이스 애플리케이션을 구현하는 방법을 소개합니다. HBase 소개 HBase는 확장성이 뛰어나고 신뢰성이 높은 기본 솔루션입니다.

인터넷 애플리케이션과 데이터 양이 지속적으로 증가함에 따라 기존 관계형 데이터베이스는 더 이상 대규모 데이터를 저장하고 처리해야 하는 요구 사항을 충족할 수 없습니다. NoSQL(NotOnlySQL)은 새로운 유형의 데이터베이스 관리 시스템으로 대용량 데이터 저장 및 처리에 상당한 이점을 갖고 있어 점점 더 많은 관심과 활용을 받고 있습니다. NoSQL 데이터베이스 중 ApacheHBase는 Google의 BigTable 아이디어를 기반으로 설계되었으며 매우 인기 있는 오픈소스 분산 데이터베이스입니다.

Beego 프레임워크에서 데이터 저장 및 쿼리를 위해 HBase 사용 인터넷 시대의 지속적인 발전으로 인해 데이터 저장 및 쿼리가 점점 더 중요해졌습니다. 빅데이터 시대의 도래와 함께 다양한 데이터 소스가 해당 분야에서 중요한 위치를 점유하고 있습니다. 비관계형 데이터베이스는 데이터 저장 및 쿼리 측면에서 확실한 장점을 지닌 데이터베이스이며, HBase는 Hadoop 기반의 분산형 비관계형 데이터베이스입니다. 관계형 데이터베이스. 이 기사에서는 Beego 프레임워크에서 데이터 저장 및 쿼리를 위해 HBase를 사용하는 방법을 소개합니다. 1.H

Workerman은 다수의 동시 연결을 호스팅할 수 있는 고성능 PHPsocket 프레임워크입니다. 기존 PHP 프레임워크와 달리 Workerman은 Apache 또는 Nginx와 같은 웹 서버에 의존하지 않고 대신 PHP 프로세스를 시작하여 전체 애플리케이션을 실행합니다. Workerman은 매우 높은 작업 효율성과 더 나은 부하 용량을 제공합니다. 동시에 HBase는 빅데이터 분야에서 널리 사용되는 분산형 NoSQL 데이터베이스 시스템입니다.
