[PR #1685] [CLOSED] WIP DB work #2253

Closed
opened 2025-12-29 03:20:25 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1685
Author: @kradalby
Created: 1/12/2024
Status: Closed

Base: mainHead: deadlock-hunting


📝 Commits (9)

📊 Changes

33 files changed (+1481 additions, -1129 deletions)

View changed files

📝 cmd/headscale/headscale.go (+0 -14)
📝 flake.nix (+1 -1)
📝 go.mod (+2 -0)
📝 go.sum (+4 -0)
📝 hscontrol/app.go (+52 -6)
📝 hscontrol/auth.go (+45 -18)
📝 hscontrol/db/addresses.go (+13 -6)
📝 hscontrol/db/addresses_test.go (+30 -16)
📝 hscontrol/db/api_key.go (+6 -27)
📝 hscontrol/db/db.go (+47 -15)
📝 hscontrol/db/node.go (+209 -350)
📝 hscontrol/db/node_test.go (+28 -52)
📝 hscontrol/db/preauth_keys.go (+60 -63)
📝 hscontrol/db/preauth_keys_test.go (+12 -8)
📝 hscontrol/db/routes.go (+193 -229)
📝 hscontrol/db/routes_test.go (+276 -47)
📝 hscontrol/db/suite_test.go (+0 -2)
📝 hscontrol/db/users.go (+53 -51)
📝 hscontrol/db/users_test.go (+3 -3)
📝 hscontrol/derp/server/derp_server.go (+1 -1)

...and 13 more files

📄 Description

nothing to see yet.

TLDR: make sure we use SQL Transactions to ensure data consistency (do not use locks). Move "notifying"/ sending state updates out of the database, should reduce risk of deadlock.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/1685 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 1/12/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `deadlock-hunting` --- ### 📝 Commits (9) - [`690ed47`](https://github.com/juanfont/headscale/commit/690ed47bbf553ab8a008bbbfc22bf83467268715) Replace database calls with transactions - [`39f9eb4`](https://github.com/juanfont/headscale/commit/39f9eb49b2d2862459f71bf31187b3882a65eeb4) move sleep for route test - [`1224b84`](https://github.com/juanfont/headscale/commit/1224b84a57eb48135dae5f7740fe72a3592dcce9) fix nil point - [`5642df0`](https://github.com/juanfont/headscale/commit/5642df0f81cace9bc065fe1bba70eea98901cab0) add timeout to notify calls - [`0207516`](https://github.com/juanfont/headscale/commit/02075166a42436385ddd1e502b4a189baffb25a8) go-deadlock - [`4a30024`](https://github.com/juanfont/headscale/commit/4a30024931d5f40e64aa773edd791c1a32702c8a) fix errs - [`f1ad37a`](https://github.com/juanfont/headscale/commit/f1ad37a50c88a37172e6f3358a65d39ba232e848) remove 1.36, failing http2 connections - [`becbcdf`](https://github.com/juanfont/headscale/commit/becbcdf498ec8035d161b7c3988ad6032dee23f1) fix nil pointer in tags call - [`ace116a`](https://github.com/juanfont/headscale/commit/ace116a320cd67cc6b5983b373d51f78f51d215a) revert is primary change ### 📊 Changes **33 files changed** (+1481 additions, -1129 deletions) <details> <summary>View changed files</summary> 📝 `cmd/headscale/headscale.go` (+0 -14) 📝 `flake.nix` (+1 -1) 📝 `go.mod` (+2 -0) 📝 `go.sum` (+4 -0) 📝 `hscontrol/app.go` (+52 -6) 📝 `hscontrol/auth.go` (+45 -18) 📝 `hscontrol/db/addresses.go` (+13 -6) 📝 `hscontrol/db/addresses_test.go` (+30 -16) 📝 `hscontrol/db/api_key.go` (+6 -27) 📝 `hscontrol/db/db.go` (+47 -15) 📝 `hscontrol/db/node.go` (+209 -350) 📝 `hscontrol/db/node_test.go` (+28 -52) 📝 `hscontrol/db/preauth_keys.go` (+60 -63) 📝 `hscontrol/db/preauth_keys_test.go` (+12 -8) 📝 `hscontrol/db/routes.go` (+193 -229) 📝 `hscontrol/db/routes_test.go` (+276 -47) 📝 `hscontrol/db/suite_test.go` (+0 -2) 📝 `hscontrol/db/users.go` (+53 -51) 📝 `hscontrol/db/users_test.go` (+3 -3) 📝 `hscontrol/derp/server/derp_server.go` (+1 -1) _...and 13 more files_ </details> ### 📄 Description nothing to see yet. TLDR: make sure we use SQL Transactions to ensure data consistency (do not use locks). Move "notifying"/ sending state updates out of the database, should reduce risk of deadlock. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:20:25 +01:00
adam closed this issue 2025-12-29 03:20:25 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2253