Skip to content

Conversation

@neilalexander
Copy link
Contributor

@neilalexander neilalexander commented Dec 13, 2024

This contains various backports from Harmony:

  • Reduced allocations and performance improvements in state resolution
  • Reduced allocations and performance improvements in JSON handling
  • Event auth fixes, including correct error surfacing
  • Correct event ordering when returning from PerformBackfill calls
  • Improved handling rejected events in state resolution applies

Closes #439 as superseded by changes in this PR.

Signed-off-by: Neil Alexander [email protected]

This contains various backports:
* Reduced allocations and performance improvements in state resolution
* Reduced allocations and performance improvements in JSON handling
* Event auth fixes, including correct error surfacing
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2024

Codecov Report

❌ Patch coverage is 77.62238% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.68%. Comparing base (dbd5f31) to head (0d17b17).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
stateresolutionv2.go 79.71% 11 Missing and 3 partials ⚠️
stateresolutionv2heaps.go 73.33% 4 Missing and 4 partials ⚠️
eventauth.go 40.00% 2 Missing and 1 partial ⚠️
handlejoin.go 40.00% 2 Missing and 1 partial ⚠️
handleleave.go 40.00% 2 Missing and 1 partial ⚠️
authstate.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
- Coverage   59.85%   59.68%   -0.18%     
==========================================
  Files          51       51              
  Lines        7146     7158      +12     
==========================================
- Hits         4277     4272       -5     
- Misses       2477     2489      +12     
- Partials      392      397       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@S7evinK S7evinK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

authstate.go Outdated
Comment on lines 168 to 171
authEvents, err := NewAuthEvents(nil)
if err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this always returns a nil error, may be worth to remove the err check? (Similar for other call sites where we pass in nil)

)

go 1.18
go 1.22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

addFromAuthEventsIfNotRejected := func(event PDU, eventType, stateKey string) {
for _, authEventID := range event.AuthEventIDs() {
if _, ok := r.isRejectedCache[authEventID]; !ok {
r.isRejectedCache[authEventID] = r.isRejectedFn(authEventID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid having to lookup the authEventID right after setting it

Suggested change
r.isRejectedCache[authEventID] = r.isRejectedFn(authEventID)
isRejected := r.isRejectedFn(authEventID)
r.isRejectedCache[authEventID] = isRejected
if isRejected {
continue
}

@S7evinK S7evinK merged commit e86ab16 into matrix-org:main Dec 15, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants