-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] cluster migrations #114
Comments
Yes, it's intentional. Think of this situation. There is a cluster of two node A and node B. A Model of MergeTree engine is defined as: class Student(models.ClickhouseModel):
name = models.StringField()
address = models.StringField()
score = models.Int8Field()
class Meta:
engine = models.MergeTree() DATABASES = {
"default": {
"ENGINE": "clickhouse_backend.backend",
"OPTIONS": {
"migration_cluster": "cluster",
}
},
"B": {
"ENGINE": "clickhouse_backend.backend",
"PORT": 9001,
"OPTIONS": {
"migration_cluster": "cluster",
}
}
} First, apply migrations on the default database, python manage.py runmigrations Then, apply migrations on Node B. python manage.py runmigrations --database B If migrations table is created on cluster, django will see that Student have already been created, so Student is not created in node B. Remember, models with plain MergeTree engine will only be created in the node which you have If you want to query all tables created in the cluster, use the following SQL: select app, name, applied from clusterAllReplicas('your cluster name', currentDatabase(), 'django_migrations') where not deleted |
I understand this, but I would like to be able to check migrations in node B when node A is down |
I did hit similar issue (actually unable to apply RunSQL migration that use After thinking a bit I came to the following question: Should we run That would raise some concern about requirement to run migration multiple time and that migration runner needs to known the list of Clickhouse nodes addresses. But doing so should:
Without running migration on every nodes, since running Does my thinking makes sense and is it the clickhouse-backend's expectation that we call |
Maybe you are right, migration table should be distributed, add an host field to track node running migration. |
I noticed that the MergeTree engine is always applied to the migration table, which is why migration data is not replicated to other nodes, even with
"migration_cluster": "cluster"
in the database settings.django-clickhouse-backend/clickhouse_backend/patch/migrations.py
Line 33 in 52ced95
Is this done on purpose? I would like to be able to track the migration history on all nodes in the cluster.
@jayvynl
The text was updated successfully, but these errors were encountered: