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

feat(MOS): support OpenMedia's hot standby #1169

Open
wants to merge 7 commits into
base: release51
Choose a base branch
from

Conversation

olzzon
Copy link
Contributor

@olzzon olzzon commented Mar 21, 2024

About the Contributor

This PR is made on behalf of BBC

Type of Contribution

This is a Feature

Current Behavior

Currently the Primary and Secondary MOS connection are expected to be online at the same time.

New Behavior

OpenMedia treats the Secondary server as a Hot Standby, so it's not connected while Primary server is connected.
To handle this, a "Hot Spare" option is added in settings to the Secondary server.

When hot spare is activated, status messages are:

  • GOOD - When running on Primary, the status of Secondary is ignored.
  • GOOD - When running on Secondary the status of Primary is is ignored.
  • BAD - If neither Primary or Secondary is connected.

Testing Instructions

Connect MOS gateway to a 2 server OpenMedia setup.

Time Frame

We intend to finish the development on this feature in two weeks time.

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@jstarpl jstarpl changed the title Feat/mos openmedia hot standby feat(MOS): support OpenMedia's hot standby Mar 22, 2024
@jstarpl jstarpl added the Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) label Jun 13, 2024
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.87%. Comparing base (8b25212) to head (e2fe446).
Report is 172 commits behind head on release51.

Additional details and impacted files
@@              Coverage Diff              @@
##           release51    #1169      +/-   ##
=============================================
- Coverage      57.94%   57.87%   -0.08%     
=============================================
  Files            523      526       +3     
  Lines          84719    84969     +250     
  Branches        4415     4303     -112     
=============================================
+ Hits           49094    49172      +78     
- Misses         35570    35744     +174     
+ Partials          55       53       -2     

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

Copy link
Member

@Julusian Julusian left a comment

Choose a reason for hiding this comment

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

I'm not keen on the name 'hot standby', I find that confusing.
I would expect the 'hot standby' mode to be the one where there is a 'hot spare' connection maintained the whole time, not when the connection is 'cold' except when the primary is down.
I would prefer that the field was renamed to be more descriptive to how the connection will behave, and the description could include something like For OpenMedia Hot Standby to make it clear it should be used with this

packages/mos-gateway/src/mosHandler.ts Outdated Show resolved Hide resolved
@olzzon olzzon marked this pull request as ready for review October 8, 2024 10:50
@olzzon olzzon requested a review from a team as a code owner October 8, 2024 10:50
Copy link
Member

@jstarpl jstarpl left a comment

Choose a reason for hiding this comment

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

I think it would be nice if we grouped these out-of-spec behavior flags into some sort of an options object.


private _messageQueue: Queue

constructor(parent: CoreHandler, mosDevice: IMOSDevice, mosHandler: MosHandler) {
constructor(parent: CoreHandler, mosDevice: IMOSDevice, mosHandler: MosHandler, openMediaHotStandby: boolean) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if this should be put into an options object? Carrying these opaque flags enabling out-of-spec behavior seems like something that will get problematic very quickly. What about?

Suggested change
constructor(parent: CoreHandler, mosDevice: IMOSDevice, mosHandler: MosHandler, openMediaHotStandby: boolean) {
constructor(parent: CoreHandler, mosDevice: IMOSDevice, mosHandler: MosHandler, opts?: { openMediaHotStandby? : boolean }) {

async registerMosDevice(
mosDevice: IMOSDevice,
mosHandler: MosHandler,
openMediaHotStandby: boolean
Copy link
Member

Choose a reason for hiding this comment

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

Same as above - I understand that these additional options are necessary to pass around, but maybe we could group these flags into some sort of an options object where their meaning will be available, and not as just boolean arguments into functions?

Suggested change
openMediaHotStandby: boolean
opts?: { openMediaHotStandby?: boolean }

@@ -482,6 +488,11 @@ export class MosHandler {
deviceOptions.primary.heartbeatInterval =
deviceOptions.primary.heartbeatInterval || DEFAULT_MOS_HEARTBEAT_INTERVAL

if (deviceOptions.secondary?.id && this._openMediaHotStandby[deviceOptions.secondary.id]) {
//@ts-expect-error this is not yet added to the official mos-connection
deviceOptions.secondary.openMediaHotStandby = true
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that this PR is not mergable yet? Because there needs to be an update to mos-connection before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) Contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants