Skip to content
This repository was archived by the owner on Jul 14, 2023. It is now read-only.
This repository was archived by the owner on Jul 14, 2023. It is now read-only.

TableService: batch operations do not end immediately on non-transient errors #41

Open

Description

@Janci144

Which service(blob, file, queue) does this issue concern?

Tabls

Which version of the SDK was used? Please provide the output of pip freeze.

azure-cosmosdb-table==1.0.5

What problem was encountered?

When you try to insert the same items (that already exist) in a batch operation, it is trying to do retryies (even though it's not transient). The reason is that the batch operations REST API is returning a 202 code (ACCEPTED), but the exceptions are packaged inside the response body. The response body exception is not taken into consideration when chosing retry policy, so it's using the 202 code (ACCEPTED) from the batch response, and not the 409 code that is packaged inside the response body

Have you found a mitigation/solution?

For now we do something like this:

table_service = TableService(connection_string=connection_string)

def fff(ctx):
    if ctx.exception.status_code == 409:
        raise ctx.exception
table_service.retry_callback = fff  # this is what terminates the code immediately on conflict rows

logs_table_name = 'my_table'
batch = TableBatch()
entity= Entity()
entity.PartitionKey = "server-3677"
entity.RowKey = "0000000000000000000"
# ... other things
batch.insert_entity(entity)
table_service.commit_batch(logs_table_name, batch, timeout=1)  # this timeout is also ignored

Activity

  1. Janci144 commented on Jul 31, 2019

    @Janci144
    Author

    Also the timeout is doing nothing because initial_backoff is by default 15 seconds which is too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions