cms-dev / cms-dev/cms

Fix ignoring of IntegrityError in FileCacher

Open
#59 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

db file_storage
Dominant language
Python
Stars
1k
Forks
412
Avg merge
6d 10h
Merged PRs (30d)
3

Description

See the description of commit e2358b7, quoted here for convenience:

Ignore IntegrityError when pushing a file to the database.

Such IntegrityError is probably due to the concurrent access to
the database by more than one process: by default, PostgreSQL
enforces only a partial isolation level between concurrent
transactions, so it can happen that two get_from_digest() doesn't
detect a file, but the file exists at the moment of actually
committing the transaction.

This commit requires further intervention, since we should at least
check that the IntegrityError actually comes from such a condition.

For more information about isolation levels:

http://www.postgresql.org/docs/9.1/static/transaction-iso.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating FileCacher and its get_from_digest() database path. Read the PostgreSQL transaction-isolation documentation linked in the issue, then determine how to distinguish the concurrent-insert IntegrityError from other integrity failures. Done means only the expected concurrent condition is ignored while unrelated IntegrityError cases remain visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.