hba
hba

Reputation: 7800

The HBase CheckAndMutate is atomic is it also consistent?

I understand that HBase uses a Multi-version concurrency control, and the documentation for CheckAndMutate explains that it is an atomic operation. I am not sure what that means?

Let's say I have:

If the read is included under the same atomic umbrella then only one of the workers would succeed. If the read is not included under the atomic umbrella then both could succeed.

Upvotes: 2

Views: 283

Answers (2)

Ashu Pachauri
Ashu Pachauri

Reputation: 1403

The way checkAndMutate works in HBase is that a write lock is taken on the row that needs to be updated BEFORE the read in the checkAndMutate operation. So, yes, the read is also included in the atomicity guarantee and only one worker will succeed in the scenario that you have posed.

Upvotes: 3

hba
hba

Reputation: 7800

I have not been able to test this, but based on this code base I think the Get happens after the lock, therefore only one of the workers in the above case would succeed.

Upvotes: 0

Related Questions