Chapter 5. Writing and Deleting Table Rows

Table of Contents

Write Errors
Writing Rows to a Table in the Store
Writing Rows to a Child Table
Other put Operations
Deleting Rows from the Store
Using multiDelete()

This chapter discusses two different write operations: putting table rows into the store, and then deleting them.

Write Errors

There are many errors that you should handle whenever you perform a write operation to the store. Some of the more common errors are described here. For simple cases where you use default policies or are not using a secure store, you can probably avoid explicitly handling these. However, as your code complexity increases, so too will the desirability of explicitly managing these errors.

The first of these is DurabilityException. This error indicates that the operation cannot be completed because the durability policy cannot be met. For more information, see Durability Guarantees.

The second is RequestTimeoutException. This simply means that the operation could not be completed within the amount of time provided by the store's timeout property. This probably indicates an overloaded system. Perhaps your network is experiencing a slowdown, or your store's nodes are overloaded with too many operations (especially write operations) coming in too short of a period of time.

To handle a RequestTimeoutException, you could simply log the error and move on, or you could pause for a short period of time and then retry the operation. You could also retry the operation, but use a longer timeout value.

You can also receive an IllegalArgumentException, which will be thrown if a Row that you are writing to the store does not have a primary key or is otherwise invalid.

You can also receive a general FaultException, which indicates that some error occurred which is neither a problem with durability nor a problem with the request timeout. Your only recourse here is to either log the error and move along, or retry the operation.

Finally, if you are using a secure store that requires authentication, you can receive AuthenticationFailureException or AuthenticationRequiredException if you do not provide the proper authentication credentials. When using a secure store, you can also see UnauthorizedException, which means you are attempting an operation for which the authenticated user does not have the proper permissions.