freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
552 stars 151 forks source link

IntegrityError: During docket upload due to unique_docket_per_court constraint #3852

Open sentry-io[bot] opened 8 months ago

sentry-io[bot] commented 8 months ago

The latest event in this case is related to: https://www.courtlistener.com/docket/313475/allen-v-woodford/ court: caed pacer_case_id: 140442 docket_number: 1:05-cv-1104 docket_number_core: 0501104

and https://www.courtlistener.com/docket/5690626/allen-v-woodford/ court: caed pacer_case_id: 140442 docket_number: 1:05-cv-01104 docket_number_core: 0501104

The metadata is identical except for the docket number. Therefore, the upload selected 313475, but during the save process, it attempted to update the docket number, which triggered an IntegrityError due to the unique_docket_per_court constraint.

Sentry Issue: COURTLISTENER-62T

UniqueViolation: duplicate key value violates unique constraint "unique_docket_per_court"
DETAIL:  Key (md5(docket_number), pacer_case_id, court_id)=(c70156c609c181659b99a51d97fb0064, 140442, caed) already exists.
  File "django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
  File "psycopg/cursor.py", line 732, in execute
    raise ex.with_traceback(None)

IntegrityError: duplicate key value violates unique constraint "unique_docket_per_court"
DETAIL:  Key (md5(docket_number), pacer_case_id, court_id)=(c70156c609c181659b99a51d97fb0064, 140442, caed) already exists.
(29 additional frame(s) were not displayed)
...
  File "cl/recap/views.py", line 65, in perform_create
    await asyncio.shield(recap_upload_task)
  File "cl/recap/tasks.py", line 114, in process_recap_upload
    docket = await process_recap_docket(pq.pk)
  File "cl/recap/tasks.py", line 583, in process_recap_docket
    await d.asave()
  File "cl/search/models.py", line 859, in save
    super(Docket, self).save(update_fields=update_fields, *args, **kwargs)

Filed by: @albertisfu

sentry-io[bot] commented 7 months ago

Related: Sentry Issue: COURTLISTENER-714

Filed by: @albertisfu

sentry-io[bot] commented 7 months ago

Related: Sentry Issue: COURTLISTENER-71D

Filed by: @albertisfu