Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 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@… 10 years ago.
BackendIsRunning? and IsMasterBackend? functions
ismasterbackend_checkbackend.patch (559 bytes) - added by anonymous 10 years ago.
separate_functions.patch (2.5 KB) - added by gdragon at jetcom.org 10 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@…

Changed 10 years ago by devel@…

comment:1 Changed 10 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 10 years ago by stuartm

  • Milestone changed from unknown to 0.21
  • Owner changed from ijr 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 10 years ago by stuartm

  • Resolution set to fixed
  • Status changed from new to closed

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

Closes #3280

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

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 10 years ago by anonymous

comment:5 Changed 10 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 10 years ago by stuartm

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

Refs #3280

comment:7 follow-up: Changed 10 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 10 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 10 years ago by gdragon

Sorry, that should be #3720

Changed 10 years ago by gdragon at jetcom.org

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 10 years ago by stuartm

  • Resolution set to fixed
  • Status changed from reopened to closed

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

Patch by gdragon

Closes #3280

comment:11 Changed 10 years ago by danielk

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

Add Comment

Modify Ticket

Action
as closed The owner will remain stuartm.
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.