Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

balancer: unload duplicate rooms #1131

Merged
merged 2 commits into from
Nov 6, 2023
Merged

balancer: unload duplicate rooms #1131

merged 2 commits into from
Nov 6, 2023

Conversation

dyc3
Copy link
Owner

@dyc3 dyc3 commented Nov 4, 2023

closes #1130

Copy link

codecov bot commented Nov 4, 2023

Codecov Report

Merging #1131 (4dd4f99) into master (5c61552) will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master      #1131   +/-   ##
===========================================
  Coverage   60.4202%   60.4202%           
===========================================
  Files           115        115           
  Lines          9280       9280           
  Branches       1131       1131           
===========================================
  Hits           5607       5607           
  Misses         3673       3673           

Copy link

cypress bot commented Nov 4, 2023

2 failed tests on run #678 ↗︎

2 66 1 0 Flakiness 0

Details:

Merge 4dd4f99 into 5c61552...
Project: OpenTogetherTube Commit: 1eb126885f ℹ️
Status: Failed Duration: 03:51 💡
Started: Nov 4, 2023 2:35 PM Ended: Nov 4, 2023 2:39 PM
Failed  client/tests/e2e/component/ShareInvite.cy.ts • 1 failed test • Component - electron

View Output Video

Test Artifacts
An uncaught error was detected outside of a test Output Screenshots Video
Failed  tests/e2e/integration/playback.spec.ts • 1 failed test • E2E - electron

View Output Video

Test Artifacts
Video playback > should add and play a video Output Screenshots Video

Review all test suite changes for PR #1131 ↗︎


let recv = m2.collect_recv();
assert_eq!(recv.len(), 1);
assert!(matches!(recv[0], MsgB2M::Unload(B2MUnload { .. })));
Copy link
Contributor

Choose a reason for hiding this comment

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

in general what does the exclamation point after certain functions mean?
Couple questions for this line:

  • what's stored in recv[0]
  • What does the { .. } statement do

Copy link
Owner Author

Choose a reason for hiding this comment

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

return Err(anyhow::anyhow!("room already loaded"));
}
std::cmp::Ordering::Greater => {
// we have an newer version of this room, remove it
self.remove_room(&metadata.name, locator.monolith_id())
self.unload_room(locator.monolith_id(), metadata.name.clone())
Copy link
Contributor

Choose a reason for hiding this comment

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

difference between unload_room() and remove_room()?

Copy link
Owner Author

Choose a reason for hiding this comment

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

unload_room sends a message to the monolith that the room should be unloaded

remove_room modifies BalancerContext to remove the room from the balancer's state but doesn't send a message.

@@ -343,12 +345,15 @@ impl BalancerContext {
match locator.load_epoch().cmp(&load_epoch) {
std::cmp::Ordering::Less => {
// we already have an older version of this room
self.unload_room(monolith_id, metadata.name.clone()).await?;
return Err(anyhow::anyhow!("room already loaded"));
}
std::cmp::Ordering::Greater => {
Copy link
Contributor

Choose a reason for hiding this comment

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

are rooms ordered by id?

Copy link
Owner Author

Choose a reason for hiding this comment

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

No, this code compares the load_epoch of the room. Only the room with the lowest load_epoch should be loaded, as specified in our spec doc.

@dyc3 dyc3 merged commit 32e8c2e into master Nov 6, 2023
13 of 15 checks passed
@dyc3 dyc3 deleted the balancer-unloads branch November 6, 2023 15:59
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.

balancer: Unload duplicate rooms
2 participants