Database Reference
In-Depth Information
Fully isolated reads lock the items during the transaction just as we obtain locks during
writes. This means that whenever you execute a command to get an item with the fully
isolated option, the transaction manager puts a lock on that item and returns the result to
the client. Committed reads are like consistent reads. If the transaction detects a lock on
an item, then it reads the old value of the item. Uncommitted reads are dirty reads. Ex-
ecuting a get-item request with the uncommitted option is the cheapest one, but they are
very dangerous to use as, if the transaction fails, the data we read might get rolled back.
So if your application use case is comfortable with such behavior, only then should you go
ahead with this type of reads.
The following is an example of reading an item using a committed read:
// Key for the item to be read
HashMap<String, AttributeValue> primaryKey = new
HashMap<String, AttributeValue>();
primaryKey.put("accountNumber", new
AttributeValue().withN("2002"));
// Invoke get item request from transaction manager
Map<String, AttributeValue> item = txm.getItem(new
GetItemRequest()
.withKey(primaryKey)
.withTableName("Bank"),
IsolationLevel.COMMITTED).getItem();
More details on this library are available at https://github.com/awslabs/dynamodb-transac-
tions/blob/master/DESIGN.md .
Search WWH ::




Custom Search