Skip to content

[Feature Request/Discussion] Splitting tenant schemas into pieces to run in multiple processes. #550

@kingbuzzman

Description

@kingbuzzman

The need has arisen to distribute our schema migrations, we have 150+ schemas and while parallel is a great add-on, and greatly speeds up our process, i'd like to propose a way to break migrations down further.

What i'm proposing is something like:

./manage.py migrate_schemas --shared  # do public schema alone..
./manage.py migrate_schemas --tenant --part 1 --of 3 &  # break tenant schema into 3 pieces and do the 1st piece
./manage.py migrate_schemas --tenant --part 2 --of 3 &
./manage.py migrate_schemas --tenant --part 3 --of 3 &

All the schemas would be retrieved, sorted by their pk, and split into parts, then the "part" you want would be the one that runs, using a good ol' python splice.

Naturally this wouldn't run on the same machine, my automated deployment would figure out how many servers i have to deploy the code, and divide the work once the public schema has been migrated.

What do you guys think?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions