-
Notifications
You must be signed in to change notification settings - Fork 9
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
DB: Uniqueness constraint in "waveforms_continuoustrace" needs to be extended #84
Comments
https://docs.djangoproject.com/en/1.11/topics/migrations/ basically change your model - after changes are done run |
in order to set the unique constraint you also need to use https://stackoverflow.com/questions/2201598/how-to-define-two-fields-unique-as-couple |
And django knows which migrations were already acted on because it stores that info in the DB in "django_migrations" table, I guess?
Mhm.. that's the spot in source code I saw will need changing So.. django creates the migration automatically?
? |
correct
it tries hard - it detects all kind of changes - adding/changing the
careful!
-> so essentiall generating migrations should be done on development server, on productive you only apply the migrations .... |
alright.. fingers crossed 🙈 |
In real life, it unfortunately sometimes happens that data is duplicated in local files, e.g. mostly identical miniseed packets (maybe with just a different sequence number) duplicated in the same file. I know this can happen e.g. when accidentally running two
slarchive
processes (to save data from seedlink buffer to disk) where only a single one should run.Example:
Right now, jane can not index such files (if at least one contiguous data chunk in the file is fully duplicated), because during indexing a unique constraint on
waveforms_contiguoustrace
gets violated:To add to initial confusion, the conflicting and supposedly "existing" database entry mentioned in the postgres error (here some file with id 15868162 in
waveforms_file
) can not even be found in the database, because the conflict happens during one transaction that is then never committed but instantly rolled back.Two problematic outcomes of this are:
waveforms_contiguoustrace
gets blown up (incremented by entries that are immediately rolled back and that never make it into the table actually) which might lead to further problems when hitting the maximum possible number of the id field (if this problem is not detected soon enough)Two implications:
waveforms_contiguoustrace
needs to be changed, it has to includepos
field (which I assume gives index of Trace when reading the file into a Stream in ObsPy). then jane should be able to index such problematic filesThe text was updated successfully, but these errors were encountered: