k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.65k stars 237 forks source link

Fix bad check in compact query #62

Closed brandond closed 3 years ago

brandond commented 3 years ago

Test:

  1. Run k3s with kine backend (any SQL backend; doesn't matter): k3s --debug server
  2. Wait for compaction message to appear in log output - something like level=debug msg="COMPACT deleted 0 rows from 3 revisions in 2.484763ms - compacted to 3/1745"
  3. Stop k3s+kine
  4. Run query: SELECT id, name FROM kine WHERE name = "/registry/health";
  5. Run query: UPDATE kine SET prev_revision = 1 WHERE name = 'compact_rev_key'; - use the ID from the previous step instead of 1 if it was different.
  6. Start k3s; wait for compaction message to appear in log output
  7. Run query: SELECT id, name FROM kine WHERE name = "/registry/health"
  8. Confirm that /registry/health entry still present with the same ID

Signed-off-by: Brad Davidson brad.davidson@rancher.com

ibuildthecloud commented 3 years ago

LGTM

brandond commented 3 years ago

Can tackle additional query optimizations later, for now how about we just stop deleting things we shouldn't. Patch is updated.