Skip to content
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

Make topic deletion logic transactional #20289

Open
kevintab95 opened this issue May 10, 2024 · 0 comments
Open

Make topic deletion logic transactional #20289

kevintab95 opened this issue May 10, 2024 · 0 comments
Labels
bug Label to indicate an issue is a regression

Comments

@kevintab95
Copy link
Member

Describe the bug

The code for topic deletion involves deletion of several associated models. See below:

topic_rights_model = topic_models.TopicRightsModel.get(topic_id)
topic_rights_model.delete(
committer_id, feconf.COMMIT_MESSAGE_TOPIC_DELETED,
force_deletion=force_deletion)
# Delete the summary of the topic (regardless of whether
# force_deletion is True or not).
delete_topic_summary(topic_id)
topic_model = topic_models.TopicModel.get(topic_id)
for subtopic in topic_model.subtopics:
subtopic_page_services.delete_subtopic_page(
committer_id, topic_id, subtopic['id'])

This issue is to ensure that the deletion of topic and related models happen in a transactional manner i.e. if an operation fails, none of the associated models should be committed to the datastore. This prevents data inconsistencies / corruption on the server.

URL of the page where the issue is observed.

NA

Steps To Reproduce

NA -- no changes to functionality.

Expected Behavior

NA

Screenshots/Videos

No response

What device are you using?

Desktop

Operating System

Linux

What browsers are you seeing the problem on?

No response

Browser version

No response

Additional context

No response

Tips for developers

Before addressing the bug, please identify which PR caused the issue (you can follow the steps here). If you identify the PR, comment on the issue with a link to it. If not, mention the commit hash of the oldest commit you saw the bug on (and the month and year it was made in).

Then, please leave a comment with details of the approach that you plan to take to fix the issue (see example).

Note: If this is your first Oppia issue, please make sure to follow our guidelines for choosing an issue and setting things up. You will also need to show a demo of the fix working correctly on your local machine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label to indicate an issue is a regression
Projects
Status: Todo
Development

No branches or pull requests

2 participants