Skip to content

Remove delete logic from mixed_db_client.go #383

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zbud-msft
Copy link
Contributor

@zbud-msft zbud-msft commented Apr 23, 2025

Why I did it

Race condition fixed in #375 in db_client.go. Same logic was copied which introduced issue in #139 was copied in #271. Removing it.

#139 introduced a race condition where one goroutine can read the values in msidata, while another goroutine can write to the same msidata map when constructing data to send. This causes a panic and causes process to crash.

How I did it

Removed logic of adding delete filed to map and deleting it introduced in #139, coped in #271.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft
Copy link
Collaborator

This is a disruptive feature reverting. Let's explore a proper bugfix.

@zbud-msft
Copy link
Contributor Author

zbud-msft commented May 28, 2025

@qiluo-msft We should remove this code from mixed_db_client.go as this is a path only used by community and has a clear race condition. MS ADO for proper bug fix. 32962839

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Jun 13, 2025

What is "a path only used by community"
Could you explain more in PR description "a clear race condition"?
Could you add UT to protect?

@qiluo-msft qiluo-msft requested review from ganglyu and Copilot June 13, 2025 18:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the legacy delete-field logic from mixed_db_client.go, simplifying message construction and preventing the outdated “delete” marker from being added or processed.

  • Removed injection of a "delete" key into the MSI map in dbSingleTableKeySubscribe
  • Deleted the corresponding removal and handling of the "delete" field in the sendMsiData helper
Comments suppressed due to low confidence (1)

sonic_data_client/mixed_db_client.go:1882

  • After removing the delete-field logic, add or update unit tests to verify that MSI messages no longer include a "delete" key and that downstream behavior remains correct.
newMsi["delete"] = "null_value"

Copy link
Contributor

@ganglyu ganglyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants