Reputation: 8725
I have a small problem - I can't understand how to create transaction (or analogue of it) in HBase. For example, there are two tables, and I want to insert value in the first and update value in the second table. I've found that HTable has method:
void batch(List<Row> actions, Object[] results)
//Method that does a batch call on Deletes, Gets and Puts.
But it works only with one table. Googling, I found class MultiAction:
Container for Actions (i.e. Get, Delete, or Put), which are grouped by regionName. Intended to be used with HConnectionManager.processBatch()
Is it that what I'm looking for? If yes, then I can't understand what is region. Thanks for any help.
Upvotes: 3
Views: 1788
Reputation: 376
There are some projects aimed at providing a transactional layer on top of HBase, like Omid, which I contribute to.
Upvotes: 2
Reputation: 25939
HBase does not support transaction. While you have something around atomicity on single table you've got noting like transaction if you need to update more than one. Transactions means 4 things that go by the acronym ACID. in a nutshell
You'd have to change HBase code to get Isolation but if you can relax that requirement you can implement a transaction coordinator that would roughly do something like
Note that because you don't have isolation sometimes rolling back is not an option so you'd need to implement compensation logic (also take a look at the saga pattern)
Upvotes: 4