Home

HAcid

HAcid enables multi-row transactions in HBase. This is a decentralized transaction manager that runs on the client side through a jar library, using special HBase tables for transactional metadata. The isolation level for transactions is by default Snapshot Isolation, but Serializable Snapshot Isolation is also supported, although it is in early development stage.

Installing

  1. Download the library from dist/HAcid.jar in this repository.
  2. Include the library in your project.
  3. Make sure you have a working HBase installation, and the path to its configuration's hbase-site.xml.
  4. Use the library's API to make and submit transactions.

Nothing else is required. No specialized server process is employed. Just plug and play.

Usage

Import classes

import fi.aalto.hacid.HAcidClient;
import fi.aalto.hacid.HAcidGet;
import fi.aalto.hacid.HAcidPut;
import fi.aalto.hacid.HAcidTable;
import fi.aalto.hacid.HAcidTxn;

Initialize the HAcid client. Point to your HBase configuration.

Configuration conf = HBaseConfiguration.create();
HAcidClient client = new HAcidClient(conf);

Refer to your HBase table using HAcid's wrapper class (this enables your table for multi-row transactions)

HAcidTable table = new HAcidTable(conf, "mytable");

Start a transaction

HAcidTxn txn = new HAcidTxn(client);

Insert read/write operations in the transaction

HAcidGet g = new HAcidGet(table, Bytes.toBytes("row1"));
g.addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("qual1"));
Result r = txn.get(g);

HAcidPut p = new HAcidPut(table, Bytes.toBytes("row1"));
p.add(Bytes.toBytes("fam1"), Bytes.toBytes("qual1"), Bytes.toBytes("value"));
txn.put(p);

Send a commit request to the transaction, and get the outcome

boolean outcome = txn.commit(); // true is "committed", false is "aborted"

Features

  • ACID transactions with Snapshot Isolation
  • Unbounded number of operations per transaction
  • Unbounded number of tables and rows that a single transaction can span
  • Client-side transaction management algorithms (no server-side changes)

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.