aiodynamo icon indicating copy to clipboard operation
aiodynamo copied to clipboard

Surprising behaviour in `Client.table_exists`

Open darylweir opened this issue 3 years ago • 1 comments

We use Table.exists as part of a health check for the containers in our application, which in turn calls Client.table_exists. Today we had a short outage when all health checks began failing. It turned out the Dynamo table had entered UPDATING status.

The implementation does the following:

async def table_exists(self, name: TableName) -> bool:
        try:
            description = await self.describe_table(name)
        except TableNotFound:
            return False

        return description.status is TableStatus.active

This feels like a bug to us: UPDATING is a valid state while a variety of operations are being applied to the table. So the code should do return description.status in [TableStatus.active, TableStatus.updating].

Thoughts?

darylweir avatar Sep 22 '22 13:09 darylweir

@darylweir thank you for this report. I agree it would make sense for table_exists to also allow .updating. But there's probably also a use case (eg our test suite) for table_active that mirrors the behavior of the current table_exists. I'd be happy to accept a PR that improves this situation.

ojii avatar Sep 26 '22 01:09 ojii