Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • S slapos.core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 38
    • Merge requests 38
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • slapos.core
  • Merge requests
  • !423

slapproxy: Make rows unique for forwarded requests

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Xavier Thompson requested to merge xavier_thompson/slapos.core:fix/slapproxy-forwarded-requests-database-bloat into master Sep 19, 2022
  • Overview 17
  • Commits 6
  • Pipelines 0
  • Changes 11

Avoid bloating the proxy database due to each instance processing adding the same entries for forwarded requests as duplicate rows again and again, leading to unbounded growth.

The code for adding the entries to the database already seemed to do the right thing by using INSERT OR REPLACE, but that SQLite command is a bit misleading: it only replaces existing rows that have the same values if the insertion would cause a UNIQUE or PRIMARY KEY constraint violation, so this only works as intended if the inserted combination of keys is marked as unique when the table is created. See https://www.sqlite.org/lang_conflict.html.

To fix this, the keys of the forwarded_partition_request table are now constrained together as a PRIMARY KEY.

Edited Sep 23, 2022 by Xavier Thompson
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/slapproxy-forwarded-requests-database-bloat
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7