question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrations hang when "default=" is set on a new field, while USING HASH.

See original GitHub issue

What works.

First time table creation, and most other migrations work fine.

What does not work.

Migrations hang when default= is set on a new field, while USING HASH in the table.

message = models.TextField(default='') # Hangs migration.
message2 = models.TextField(null=True) # Works.

Issue Details

This issue is mentioned here: https://github.com/django/django/blob/7e3c9c3205e9646261cea5e5a7af7ec0e806690a/docs/ref/migration-operations.txt#L163

I believe, when the migration has to perform a full rewrite of the table, Django cannot understand crdb_internal_id_shard_16 (or how it fits into the model) when USING HASH is specified.

Possible resolution

Is there a way to ignore or hide fields which CockroachDB generates automatically when using hash sharded index?

If we can get Django to simply ignore anything of crdb_internal_* we could be okay.

Related: 78049 https://github.com/cockroachdb/django-cockroachdb/issues/264

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rafisscommented, Aug 25, 2022

Thanks for this report! Could you share the way of reproducing the bug using only cockroach sql? And file an issue at https://github.com/cockroachdb/cockroach (or post here, and I can file it for you).

0reactions
timgrahamcommented, Aug 25, 2022

Great, thanks. Closing as “not completed” since it’s not applicable to this repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

default for serialized column in activerecord migration
When Rails serializes a hash to save in the db, all it does is convert it to YAML so that it can be...
Read more >
Understanding migrations with Room | by Florina Muntenescu
An important part in the migration internals is played by an identity hash String that is used by Room to uniquely identify every...
Read more >
sql: Use hash-sharded indexes by default · Issue #78049
Migrations hang when "default=" is set on a new field, while USING HASH. cockroachdb/django-cockroachdb#265. Closed. CRDB job hangs ...
Read more >
Avoiding downtime in migrations - GitLab Docs
To rename a column without requiring downtime, we need two migrations: a regular migration and a post-deployment migration. Both these migrations can go...
Read more >
Troubleshooting migration tasks in AWS Database Migration ...
To migrate secondary objects from your database, use the database's native tools if you are migrating to the same database engine as your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found