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

Improve storing of the package configs #2724

Open
mfocko opened this issue Feb 19, 2025 · 0 comments
Open

Improve storing of the package configs #2724

mfocko opened this issue Feb 19, 2025 · 0 comments
Labels
area/database Related to the Packit's database complexity/single-task Regular task, should be done within days. kind/internal Doesn't affect users directly, may be e.g. infrastructure, DB related.

Comments

@mfocko
Copy link
Member

mfocko commented Feb 19, 2025

Related to packit/packit#2306

This topic came up during an arch discussion about logging of the package configs. Currently we store the configs as JSON in the database with each of the project events, this “may” be a bit wasteful, given that the configs should not change that often.

To optimize this, we should be able to hash a canonical JSON as a string. This would allow us to store the JSON only once (in a separate table) and reference it from the “project event model”.

As for the canonical from, only nested dictionaries do not guarantee an order, but json.dump provides an option to resolve this, therefore it should be possible to obtaine a canonical JSON by following:

json.dumps(
  package_config,
  separators=(',', ':'),  # minimize whitespace
  sort_keys=True,         # sort the keys in dictionaries
)

Permalink to the field as of the time of creating this issue:

packages_config = Column(JSON)

@mfocko mfocko added area/database Related to the Packit's database complexity/single-task Regular task, should be done within days. kind/internal Doesn't affect users directly, may be e.g. infrastructure, DB related. labels Feb 19, 2025
@mfocko mfocko moved this from new to backlog in Packit Kanban Board Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Related to the Packit's database complexity/single-task Regular task, should be done within days. kind/internal Doesn't affect users directly, may be e.g. infrastructure, DB related.
Projects
Status: backlog
Development

No branches or pull requests

1 participant