Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3280 closed patch (fixed)

Add IsMasterBackend and BackendIsRunning functions to mythcontext

Reported by: anonymous Owned by: stuartm
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords: mythcontext backend frontend master
Cc: mythtv-dev@… Ticket locked: no

Description

Moves BackendIsRunning? and adds new IsMasterBackend? function to mythcontext.

These both return boolean values and are used in mythbackend and mythtv-setup. They are also useful elsewhere and this makes them available to every app utilising mythcontext.

Attachments (4)

backend_functions.diff (4.7 KB) - added by devel@… 11 years ago.
BackendIsRunning? and IsMasterBackend? functions
backend-functions-180707.diff (4.6 KB) - added by devel@… 11 years ago.
BackendIsRunning? and IsMasterBackend? functions
ismasterbackend_checkbackend.patch (559 bytes) - added by anonymous 11 years ago.
separate_functions.patch (2.5 KB) - added by gdragon at jetcom.org 11 years ago.
Per suggestion: separated out IsMasterHost? and IsMasterBackend?. Also changed a couple previous calls to new function, IsMasterHost? which is the intended functionality of those cases.

Download all attachments as: .zip

Change History (15)

Changed 11 years ago by devel@…

Attachment: backend_functions.diff added

Changed 11 years ago by devel@…

comment:1 Changed 11 years ago by devel@…

This patch also changes the prompt to run mythfilldatabase in mythtv-setup so that it only prompts if it is actually running on the master server.

comment:2 Changed 11 years ago by stuartm

Milestone: unknown0.21
Owner: changed from Isaac Richards to stuartm

Your patches appear to be malformed, maybe you are editing them manually? If you could provide working patches, preferably created against SVN head it would be appreciated.

comment:3 Changed 11 years ago by stuartm

Resolution: fixed
Status: newclosed

(In [14166]) Apply (malformed) patch from devel@… to create two new functions in mythcontext BackendIsRunning?() and IsMasterBackend?().

Closes #3280

comment:4 Changed 11 years ago by gdragon at jetcom.org

Resolution: fixed
Status: closedreopened

The IsMasterBackend? committed here does not check to ensure that the copy of the context is actually a backend. This function would erroneously return true for other processes running on the same host. Patch attached.

Changed 11 years ago by anonymous

comment:5 Changed 11 years ago by Matthew Wire <devel@…>

  1. Before your patch: IsMasterBackend? would return true if the master ip matches the host ip. So the backend does not actually have to be running for this to be the case.
  1. After your patch: IsMasterBackend? will only return true if we are on the master backend and the backend is currently running.

I think (1.) is the better behaviour here. If you want behaviour like (2.) you can do (IsMasterBackend? && BackendIsRunning?).

There may be situations where you want to know whether you are running on the master backend even when it is not running - for example, the backend should be stopped while running mythtv-setup but there may be settings you only want to display on the master backend etc.

comment:6 Changed 11 years ago by stuartm

(In [14202]) Tidy up IsMasterBacked? a little.

Refs #3280

comment:7 Changed 11 years ago by stuartm

I agree with Matthew about the usefulness of IsMasterBackend?() even when the calling process is not a backend, which is why I committed it, but I can also see the that the naming might be confusing.

IsBackend?() is true only if the process is a backend, IsMasterBackend?() is true if we are on the same machine as the backend. Clearly we need to rename the current function (IsMasterMachine??) so that it doesn't appear related to IsBackend?() and then we add a new IsMasterBackend?() that is only true for the backend process.

comment:8 in reply to:  7 Changed 11 years ago by gdragon at jetcom.org

Replying to stuartm:

I agree with Matthew about the usefulness of IsMasterBackend?() even when the calling process is not a backend, which is why I committed it, but I can also see the that the naming might be confusing.

IsBackend?() is true only if the process is a backend, IsMasterBackend?() is true if we are on the same machine as the backend. Clearly we need to rename the current function (IsMasterMachine??) so that it doesn't appear related to IsBackend?() and then we add a new IsMasterBackend?() that is only true for the backend process.

Agreed. There needs to be two functions. My ticket #3270 depends on the IsMasterBackend? true for master host && backend process. Depending on the outcome of this ticket, there may be some changes needed there.

comment:9 Changed 11 years ago by gdragon

Sorry, that should be #3720

Changed 11 years ago by gdragon at jetcom.org

Attachment: separate_functions.patch added

Per suggestion: separated out IsMasterHost? and IsMasterBackend?. Also changed a couple previous calls to new function, IsMasterHost? which is the intended functionality of those cases.

comment:10 Changed 11 years ago by stuartm

Resolution: fixed
Status: reopenedclosed

(In [14473]) Split IsMasterBackend?() into IsMasterHost?() and IsMasterBackend?().

Patch by gdragon

Closes #3280

comment:11 Changed 11 years ago by danielk

(In [14475]) Refs #3280. Updates MYTH_BINARY_VERSION for [14473].

Note: See TracTickets for help on using tickets.