Skip to content

Commit

Permalink
Receive: refactor handler for improved readability and organization (t…
Browse files Browse the repository at this point in the history
…hanos-io#6898)

* [wip] First checkpoint

Signed-off-by: Douglas Camata <[email protected]>

* [wip] Second checkpoint

All tests passing, unit and e2e.

Signed-off-by: Douglas Camata <[email protected]>

* Small random refactors

Signed-off-by: Douglas Camata <[email protected]>

* Add some useful trace tags

Signed-off-by: Douglas Camata <[email protected]>

* Concurrent and traced local writes

Signed-off-by: Douglas Camata <[email protected]>

* Improve variable names in remote writes

Signed-off-by: Douglas Camata <[email protected]>

* Rename `newFanoutForward` function

Signed-off-by: Douglas Camata <[email protected]>

* More refactors

Signed-off-by: Douglas Camata <[email protected]>

* Fix linting issue

Signed-off-by: Douglas Camata <[email protected]>

* Add a quorum test with sloppy quorum

Signed-off-by: Douglas Camata <[email protected]>

* [wip] Try to make retries work

Signed-off-by: Douglas Camata <[email protected]>

* [wip] Checkpoint: wait group still hanging

Signed-off-by: Douglas Camata <[email protected]>

* Some refactors

Signed-off-by: Douglas Camata <[email protected]>

* Add some commented code so I don't lose it

Signed-off-by: Douglas Camata <[email protected]>

* Adapt tests

Signed-off-by: Douglas Camata <[email protected]>

* Remove sloppy quorum code

Signed-off-by: Douglas Camata <[email protected]>

* Move some code around

Signed-off-by: Douglas Camata <[email protected]>

* Remove even more leftover of sloppy quorum

Signed-off-by: Douglas Camata <[email protected]>

* Extract a type to hold function params

Signed-off-by: Douglas Camata <[email protected]>

* Remove unused struct field

Signed-off-by: Douglas Camata <[email protected]>

* Remove useless variable

Signed-off-by: Douglas Camata <[email protected]>

* Remove type that wasn't used enough

Signed-off-by: Douglas Camata <[email protected]>

* Delete function to tighten up max buffered responses

Signed-off-by: Douglas Camata <[email protected]>

* Add comments to some functions

Signed-off-by: Douglas Camata <[email protected]>

* Fix peer up check

Signed-off-by: Douglas Camata <[email protected]>

* Fix size of replication tracking slices

Signed-off-by: Douglas Camata <[email protected]>

* Rename context

Signed-off-by: Douglas Camata <[email protected]>

* Don't do local writes concurrently

Signed-off-by: Douglas Camata <[email protected]>

* Remove extra error logging

Signed-off-by: Douglas Camata <[email protected]>

* Fix syntax after merge

Signed-off-by: Douglas Camata <[email protected]>

* Add missing methods to peersContainer

Signed-off-by: Douglas Camata <[email protected]>

* Fix handler test

Signed-off-by: Douglas Camata <[email protected]>

* Reset peers state on hashring changes

Signed-off-by: Douglas Camata <[email protected]>

* Handle PR comment regarding waitgroup

Signed-off-by: Douglas Camata <[email protected]>

* Set span tags to help debug

Signed-off-by: Douglas Camata <[email protected]>

* Fix concurrency issue

We close the request as soon as quorum is reached and leave a few Go routines running to finish replication and so cleanups.

This means that the context from the HTTP request is cancelled... which ends up also cancelling the pending replication requests.

Signed-off-by: Douglas Camata <[email protected]>

* Fix request ID middleware

Signed-off-by: Douglas Camata <[email protected]>

* Fix `distributeTimeseriesToReplicas` comment

Signed-off-by: Douglas Camata <[email protected]>

* Extract var with 1-indexed replication index

Signed-off-by: Douglas Camata <[email protected]>

* Rename methods in peersContainer interface

Signed-off-by: Douglas Camata <[email protected]>

* Make peerGroup `getConnection` check if peers are up

Signed-off-by: Douglas Camata <[email protected]>

* Remove yet one more not useful log

Signed-off-by: Douglas Camata <[email protected]>

* Remove logger from `h.sendWrites`

Signed-off-by: Douglas Camata <[email protected]>

---------

Signed-off-by: Douglas Camata <[email protected]>
Signed-off-by: hanyuting8 <[email protected]>
  • Loading branch information
douglascamata authored and hanyuting8 committed Jan 19, 2024
1 parent 8462780 commit 0ed4361
Show file tree
Hide file tree
Showing 3 changed files with 365 additions and 265 deletions.
Loading

0 comments on commit 0ed4361

Please sign in to comment.