[PR #1791] [MERGED] rework mapsession #2320

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

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1791
Author: @kradalby
Created: 2/23/2024
Status: Merged
Merged: 4/15/2024
Merged by: @juanfont

Base: mainHead: mapper-refac


📝 Commits (4)

  • 210fceb Rework map session
  • 1ba079d clean up use of log.Error where errors could be wrapped
  • 9e423d9 improve testing of route failover logic
  • a329442 more log.Error -> fmt.Errorf cleanup

📊 Changes

38 files changed (+2236 additions, -1913 deletions)

View changed files

📝 .github/workflows/test-integration.yaml (+2 -1)
📝 hscontrol/app.go (+79 -67)
📝 hscontrol/auth.go (+14 -19)
📝 hscontrol/db/node.go (+38 -102)
📝 hscontrol/db/node_test.go (+9 -9)
📝 hscontrol/db/preauth_keys.go (+0 -4)
📝 hscontrol/db/preauth_keys_test.go (+2 -2)
📝 hscontrol/db/routes.go (+144 -174)
📝 hscontrol/db/routes_test.go (+592 -306)
📝 hscontrol/db/users.go (+2 -7)
📝 hscontrol/derp/derp.go (+2 -2)
📝 hscontrol/grpcv1.go (+55 -58)
📝 hscontrol/handlers.go (+0 -19)
📝 hscontrol/mapper/mapper.go (+110 -194)
📝 hscontrol/mapper/mapper_test.go (+33 -32)
📝 hscontrol/mapper/tail.go (+10 -20)
📝 hscontrol/mapper/tail_test.go (+6 -3)
📝 hscontrol/noise.go (+126 -2)
📝 hscontrol/notifier/notifier.go (+58 -41)
📝 hscontrol/oidc.go (+7 -36)

...and 18 more files

📄 Description

This commit restructures the map session in to a struct
holding the state of what is needed during its lifetime.

For streaming sessions, the event loop is structured a
bit differently not hammering the clients with updates
but rather batching them over a short, configurable time
which should significantly improve cpu usage, and potentially
flakyness.

The use of Patch updates has been dialed back a little as
it does not look like its a 100% ready for prime time. Nodes
are now updated with full changes, except for a few things
like online status.

In addition, there is a lot of simplifications, removing internal states in the mappers,
lots of error cleanups and more tests.

Signed-off-by: Kristoffer Dalby kristoffer@tailscale.com


🔄 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/1791 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 2/23/2024 **Status:** ✅ Merged **Merged:** 4/15/2024 **Merged by:** [@juanfont](https://github.com/juanfont) **Base:** `main` ← **Head:** `mapper-refac` --- ### 📝 Commits (4) - [`210fceb`](https://github.com/juanfont/headscale/commit/210fceb713b05f0635e7fe1afff838633c325427) Rework map session - [`1ba079d`](https://github.com/juanfont/headscale/commit/1ba079dd57259d6559df1872f7ae78c899fc8667) clean up use of log.Error where errors could be wrapped - [`9e423d9`](https://github.com/juanfont/headscale/commit/9e423d95eca8510ce6100e2ab745d6fd22fb2f4c) improve testing of route failover logic - [`a329442`](https://github.com/juanfont/headscale/commit/a32944203285d23c0891f3d89b0958d7e1840a44) more log.Error -> fmt.Errorf cleanup ### 📊 Changes **38 files changed** (+2236 additions, -1913 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test-integration.yaml` (+2 -1) 📝 `hscontrol/app.go` (+79 -67) 📝 `hscontrol/auth.go` (+14 -19) 📝 `hscontrol/db/node.go` (+38 -102) 📝 `hscontrol/db/node_test.go` (+9 -9) 📝 `hscontrol/db/preauth_keys.go` (+0 -4) 📝 `hscontrol/db/preauth_keys_test.go` (+2 -2) 📝 `hscontrol/db/routes.go` (+144 -174) 📝 `hscontrol/db/routes_test.go` (+592 -306) 📝 `hscontrol/db/users.go` (+2 -7) 📝 `hscontrol/derp/derp.go` (+2 -2) 📝 `hscontrol/grpcv1.go` (+55 -58) 📝 `hscontrol/handlers.go` (+0 -19) 📝 `hscontrol/mapper/mapper.go` (+110 -194) 📝 `hscontrol/mapper/mapper_test.go` (+33 -32) 📝 `hscontrol/mapper/tail.go` (+10 -20) 📝 `hscontrol/mapper/tail_test.go` (+6 -3) 📝 `hscontrol/noise.go` (+126 -2) 📝 `hscontrol/notifier/notifier.go` (+58 -41) 📝 `hscontrol/oidc.go` (+7 -36) _...and 18 more files_ </details> ### 📄 Description This commit restructures the map session in to a struct holding the state of what is needed during its lifetime. For streaming sessions, the event loop is structured a bit differently not hammering the clients with updates but rather batching them over a short, configurable time which should significantly improve cpu usage, and potentially flakyness. The use of Patch updates has been dialed back a little as it does not look like its a 100% ready for prime time. Nodes are now updated with full changes, except for a few things like online status. In addition, there is a lot of simplifications, removing internal states in the mappers, lots of error cleanups and more tests. Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> --- <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:46 +01:00
adam closed this issue 2025-12-29 03:20:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2320