learningequality / learningequality/studio

Simultaneous writes to JSON fields could stomp prior changes

Open
#2,331 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P2 - normal TAG: performance
Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

Summary

At the moment we use a DB read and then Python land updating to do partial updates to JSON fields - in the case of concurrent edits, this could cause stomping of other's changes.

We could prevent this by using the JSONField implementation from django-postgres-extensions and the associated JSONBSet function - this would allow us to do specific updates directly in the database, and reduce the risk of change stomping.

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

The issue names no files, tests, or entry points. Start by locating the Python JSONField partial-update path and reviewing the linked django-postgres-extensions JSONField and JSONBSet documentation. Done means concurrent updates to separate JSON paths no longer overwrite each other, with regression coverage for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.