void deleteRow ( String storeName , Map < String , AttributeValue > key ) { String tableName = storeToTableName ( storeName ) ; m_logger . debug ( "Deleting row from table {}, key={}" , tableName , DynamoDBService . getDDBKey ( key ) ) ; Timer timer = new Timer ( ) ; boolean bSuccess = false ; for ( int attempts = 1 ; ! bSuccess ; attempts ++ ) { try { m_ddbClient . deleteItem ( tableName , key ) ; if ( attempts > 1 ) { m_logger . info ( "deleteRow() succeeded on attempt #{}" , attempts ) ; } bSuccess = true ; m_logger . debug ( "Time to delete table {}, key={}: {}" , new Object [ ] { tableName , DynamoDBService . getDDBKey ( key ) , timer . toString ( ) } ) ; } catch ( ProvisionedThroughputExceededException e ) { if ( attempts >= m_max_commit_attempts ) { String errMsg = "All retries exceeded; abandoning deleteRow() for table: " + tableName ; m_logger . error ( errMsg , e ) ; throw new RuntimeException ( errMsg , e ) ; } m_logger . warn ( "deleteRow() attempt #{} failed: {}" , attempts , e ) ; try { Thread . sleep ( attempts * m_retry_wait_millis ) ; } catch ( InterruptedException ex2 ) { // ignore } } } }
Delete row and back off if ProvisionedThroughputExceededException occurs .