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, 感谢原作者分享。

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Heiße Themen



Mit dem Aufkommen des Big-Data-Zeitalters sind Datenverarbeitung und -speicherung immer wichtiger geworden und die effiziente Verwaltung und Analyse großer Datenmengen ist für Unternehmen zu einer Herausforderung geworden. Hadoop und HBase, zwei Projekte der Apache Foundation, bieten eine Lösung für die Speicherung und Analyse großer Datenmengen. In diesem Artikel wird erläutert, wie Sie Hadoop und HBase in Beego für die Speicherung und Abfrage großer Datenmengen verwenden. 1. Einführung in Hadoop und HBase Hadoop ist ein verteiltes Open-Source-Speicher- und Computersystem, das dies kann

Data Rigor Design (ACID) in der PHP-Programmierung Bei der PHP-Programmierung ist Data Rigor Design ein sehr wichtiger Aspekt. Eine zuverlässige Anwendung muss nicht nur Daten korrekt verarbeiten, sondern auch Datensicherheit und -konsistenz gewährleisten. Aus diesem Grund müssen Entwickler ACID für das Datendesign verwenden, um die Stabilität und Zuverlässigkeit des Systems sicherzustellen. ACID bezieht sich auf Atomarität, Konsistenz, Isolation und Haltbarkeit.

Abhängigkeit: org.springframework.dataspring-data-hadoop-hbase2.5.0.RELEASEorg.apache.hbasehbase-client1.1.2org.springframework.dataspring-data-hadoop2.5.0.RELEASE Der offizielle Weg zum Hinzufügen von Konfigurationen erfolgt über XML einfach Nach dem Umschreiben lautet es wie folgt: @ConfigurationpublicclassHBaseConfiguration{@Value("${hbase.zooke

So verwenden Sie Java zum Entwickeln einer NoSQL-Datenbankanwendung auf Basis von HBase. Einführung: Mit dem Aufkommen des Big-Data-Zeitalters ist die NoSQL-Datenbank zu einem wichtigen Werkzeug für die Verarbeitung großer Datenmengen geworden. HBase verfügt als verteiltes Open-Source-NoSQL-Datenbanksystem über umfangreiche Anwendungen im Bereich Big Data. In diesem Artikel wird erläutert, wie Sie mit Java NoSQL-Datenbankanwendungen auf Basis von HBase entwickeln, und es werden spezifische Codebeispiele bereitgestellt. 1. Einführung in HBase: HBase ist ein auf Hadoop basierendes Verteilungssystem.

Mit dem Aufkommen des Big-Data-Zeitalters ist die Speicherung und Verarbeitung großer Datenmengen besonders wichtig geworden. Im Hinblick auf NoSQL-Datenbanken ist HBase derzeit eine weit verbreitete Lösung. Als statisch stark typisierte Programmiersprache wird die Go-Sprache aufgrund ihrer einfachen Syntax und hervorragenden Leistung zunehmend in Bereichen wie Cloud Computing, Website-Entwicklung und Datenwissenschaft eingesetzt. In diesem Artikel wird erläutert, wie Sie HBase in der Go-Sprache verwenden, um effiziente NoSQL-Datenbankanwendungen zu implementieren. HBase-Einführung HBase ist eine hoch skalierbare, äußerst zuverlässige Basisversion

Angesichts des kontinuierlichen Wachstums von Internetanwendungen und Datenmengen können herkömmliche relationale Datenbanken den Anforderungen der Speicherung und Verarbeitung großer Datenmengen nicht mehr gerecht werden. Als neuartiges Datenbankverwaltungssystem bietet NoSQL (NotOnlySQL) erhebliche Vorteile bei der Speicherung und Verarbeitung massiver Daten und erhält immer mehr Aufmerksamkeit und Anwendungen. Unter den NoSQL-Datenbanken ist ApacheHBase eine sehr beliebte verteilte Open-Source-Datenbank. Sie basiert auf der BigTable-Idee von Google

Verwendung von HBase zur Datenspeicherung und -abfrage im Beego-Framework Mit der kontinuierlichen Entwicklung des Internetzeitalters sind Datenspeicherung und -abfrage immer wichtiger geworden. Mit dem Aufkommen des Big-Data-Zeitalters nehmen verschiedene Datenquellen in ihren jeweiligen Bereichen eine wichtige Position ein. Nicht-relationale Datenbanken sind Datenbanken mit offensichtlichen Vorteilen bei der Datenspeicherung und -abfrage, und HBase ist eine verteilte, nicht-relationale Datenbank, die auf Hadoop basiert. Relationale Datenbank. In diesem Artikel wird erläutert, wie Sie HBase zur Datenspeicherung und -abfrage im Beego-Framework verwenden. 1. H

Workerman ist ein leistungsstarkes PHPsocket-Framework, das eine große Anzahl gleichzeitiger Verbindungen hosten kann. Im Gegensatz zu herkömmlichen PHP-Frameworks ist Workerman nicht auf Webserver wie Apache oder Nginx angewiesen, sondern führt die gesamte Anwendung selbst aus, indem es einen PHP-Prozess startet. Workerman verfügt über eine extrem hohe Betriebseffizienz und eine bessere Tragfähigkeit. Gleichzeitig ist HBase ein verteiltes NoSQL-Datenbanksystem, das in Big Data weit verbreitet ist
