Skip to content

Atomically create table and its partitions

Andreas Brandl requested to merge ab/partitioning-race into master

What does this MR do?

This change addresses the race condition discussed in omnibus-gitlab#5597 (comment 401127156), but with a different solution than proposed.

We observe a race condition when the partitioned table is created, but the migration fails to create its partitions. Now the automatic partitioning kicks in, creating potentially different partitions than we intended to have.

Now the underlying problem is that this isn't atomic:

  1. Create partitioned table
  2. Create partitions

In this change, we're making this an atomic operation and wrap those steps into a transaction.

Closes omnibus-gitlab#5597 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by Andreas Brandl

Merge request reports