Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Moved db to new machine, mythtv still finds old recordings

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


thomas at boerkel

Nov 20, 2009, 11:02 AM

Post #1 of 9 (731 views)
Permalink
Moved db to new machine, mythtv still finds old recordings

HI!

I copied my mythtv db from my production machine to a test machine and
modified the db (like explained in the mythtv docs), so that the backend
hostname was replaced with the new machine's name.

Then I changed IP addresses and the default storage dir (no storage
groups) to the local disk of the new machine in mythtv-setup.

Now, when I record something on the new machine, it records to the new
directory as expected.

But I can also watch the old recordings, that are still in the database,
that were recorded with the old machine. The path is accessible (NFS),
but how does mythtv know, where they are located? Because I changed the
hostname and I changed the default storage dir. And I see no path in the
recorded table.

Just curious...

Thanks!

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


thomas at boerkel

Nov 20, 2009, 2:34 PM

Post #2 of 9 (691 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

HI!

Some more info. I realized, that while the new machine records to the
new directory, it will play all recordings (also new ones) from the old
machine's directory.

Looking at the db dump, I found this (the new machine's name is "linux",
the old machine's name is "backend"):

Table storagegroup:
(5,'Default','linux','/mnt/mybook1/video/recordings/')

Table settings:
('RecordFilePrefix','/mythtv/backend/video/recordings/','linux')

The first entry (in storagegroup) is what I entered in mythtv-setup for
the new machine after converting the db.

The second entry (in settings) is the old directory.

While moving the DB from the old machine ("backend") to the new machine
("linux"), I converted first all "linux" to "linuxalt" in the DB and
then all "backend" to "linux".

So, I guess that's why I have that old directory in table settings. But
where do I edit that? And why does mythtv use it for playback, when
there is an entry in table storagegroup?

Thanks!

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mtdean at thirdcontact

Nov 20, 2009, 5:18 PM

Post #3 of 9 (697 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

On 11/20/2009 05:34 PM, Thomas Börkel wrote:
> Some more info. I realized, that while the new machine records to the
> new directory, it will play all recordings (also new ones) from the old
> machine's directory.
>
> Looking at the db dump, I found this (the new machine's name is "linux",
> the old machine's name is "backend"):
>
> Table storagegroup:
> (5,'Default','linux','/mnt/mybook1/video/recordings/')
>
> Table settings:
> ('RecordFilePrefix','/mythtv/backend/video/recordings/','linux')
>
> The first entry (in storagegroup) is what I entered in mythtv-setup for
> the new machine after converting the db.
>
> The second entry (in settings) is the old directory.
>
> While moving the DB from the old machine ("backend") to the new machine
> ("linux"), I converted first all "linux" to "linuxalt" in the DB and
> then all "backend" to "linux".
>
> So, I guess that's why I have that old directory in table settings. But
> where do I edit that? And why does mythtv use it for playback, when
> there is an entry in table storagegroup?

You can't. It's the legacy, 0.20 and below, pre-SG setting for the
recordings directory. It doesn't even exist in a database created with
0.21 or higher. It's only being used as a fallback because the files do
not exist where they should--in one of the directories in the directory
list for the specified storage group.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


thomas at boerkel

Nov 21, 2009, 12:34 AM

Post #4 of 9 (686 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

HI!

Michael T. Dean wrote:

>> So, I guess that's why I have that old directory in table settings. But
>> where do I edit that? And why does mythtv use it for playback, when
>> there is an entry in table storagegroup?
>
> You can't. It's the legacy, 0.20 and below, pre-SG setting for the
> recordings directory. It doesn't even exist in a database created with
> 0.21 or higher. It's only being used as a fallback because the files do
> not exist where they should--in one of the directories in the directory
> list for the specified storage group.

Ah, I see. But it seems to prefer the old directory, because it also
uses it for new recordings, which *do* exist in the new default SG
directory.

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


thomas at boerkel

Nov 21, 2009, 1:47 PM

Post #5 of 9 (653 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

HI!

I just proved it by unmounting/mounting the old directory.

Playback prefers the RecordFilePrefix in the settings table over the
default storage group. Only if RecordFilePrefix is not available, it
will play from the defined default storage group.

Recording always goes to the default storage group.

This is 0.21.

I will now delete the RecordFilePrefix setting in the db.

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


thomas at boerkel

Nov 21, 2009, 2:28 PM

Post #6 of 9 (658 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

HI!

Deleting the RecordFilePrefix in table settings did not help.

Then I realized, I had several entries in table storagegroup for SG
"Default". All for different hosts (new backend, frontends). And all
those entries (besides the one of the new host), pointed to the old
directory.

Apparently, it used any of them to find the recording. It even used the
Default SG of another host, after I changed the SGs in table recorded to
a different value (not "Default").

After I deleted all SGs but the ones from the new host, it did not try
to play from the old directory anymore.

Now I have 2 SGs and this works:
- "backend", pointing to the old dir, for older recordings (changed in
table recorded)
- "Default", pointing to the new dir, for newer recordings

Sounds like a bug to me.

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mtdean at thirdcontact

Nov 21, 2009, 5:43 PM

Post #7 of 9 (635 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

On 11/21/2009 05:28 PM, Thomas Börkel wrote:
> Deleting the RecordFilePrefix in table settings did not help.
>
> Then I realized, I had several entries in table storagegroup for SG
> "Default". All for different hosts (new backend, frontends). And all
> those entries (besides the one of the new host), pointed to the old
> directory.
>
> Apparently, it used any of them to find the recording. It even used the
> Default SG of another host, after I changed the SGs in table recorded to
> a different value (not "Default").
>
> After I deleted all SGs but the ones from the new host, it did not try
> to play from the old directory anymore.
>
> Now I have 2 SGs and this works:
> - "backend", pointing to the old dir, for older recordings (changed in
> table recorded)
> - "Default", pointing to the new dir, for newer recordings
>
> Sounds like a bug to me.

No, it's working fine in 0.22.

On your master backend, you define a storage group and create a list of
directories associated with that storage group. Then, you're done. Do
not create directory lists for that same storage group on other
hosts--otherwise, you get the issues you're having. Instead, once a
storage group is defined on the master backend, /all/ hosts use
("inherit") the same list of directories for that storage group.

If, and only if, you have a host that /needs/ a different list of
directories--meaning that you have a directory path that exists on more
than just the one host, but it is important that that one host is the
only host that uses the directory path--then, you can /override/ the
directory list defined on the master backend for the remote host. Note,
however, you really would be better off fixing your directory paths so
all hosts can use the same directory list. Does this mean that all the
directories in the list must exist on all the hosts? No. A missing
directory in the directory list is ignored. As a matter of fact, it is
not even important that all the directories in the directory list exist
on the master backend. Again, a missing directory in the directory list
is ignored.

Why should you only define the directory list one time on the master
backend instead of re-defining the exact same (or worse, slightly
different) lists on multiple backends? Well, if the question didn't
answer it for you, let me be a bit more overt this time... If you
define the same information multiple times on multiple hosts, then when
you need to change the information, you have to change it multiple times
on multiple hosts. Also, you can /only/ edit the directory list for a
given host /from/ that host's mythtv-setup. Therefore, if you retire a
host (or hostname) without explicitly deleting the directory list
override for the storage group on that host, you leave garbage in the
database which could cause issues with storage group fallback months or
even years down the road. These issues were worse in 0.21-fixes (and
are exactly what caused the problems for you).

In 0.22, deleting a storage group from the master backend's mythtv-setup
deletes the group (the list of directories associated with that group on
/all/ hosts). Whereas, "deleting a storage group" from a remote
system's mythtv-setup simply deletes the override (the list of
directories used only for that host). Therefore, if you have garbage
from old hosts, use mythtv-setup from 0.22-fixes or higher to delete the
group, then define it properly only on the master backend and let
inheritance make it easier to maintain your directory lists.

Note that in 0.21-fixes, there are some issues with inheritance for any
non-Default storage group, but if you use only the Default storage
group, everything works fine when configured as I described.

Note, also, that it is /critical/ that you do not specify a mount point
directory path in a storage group directory list. If you do and the
file system is not mounted, MythTV will happily write recordings to the
"parent" file system--usually the root file system--and, in conjunction
with other apps writing to that file system, may actually fill it up and
cause problems. Always specify a subdirectory under the mount point.
That way, if the file system isn't mounted, Myth will see it's a missing
directory and ignore it.

Mike



_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


thomas at boerkel

Nov 21, 2009, 11:35 PM

Post #8 of 9 (634 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

HI!

Thanks a lot for the very good explanation! Now I understand, what was
going on and why.

I don't remember defining the same storage group on each and every host.
I once defined the old RecordFilePrefix on each and every host. Maybe
this was converted to a SG during an update or I did it manually. ;-)

Anyway, it's working now as specified and I can upgrade to 0.22 soon on
my test system.

Thanks!

Thomas
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mtdean at thirdcontact

Nov 22, 2009, 5:22 AM

Post #9 of 9 (621 views)
Permalink
Re: Moved db to new machine, mythtv still finds old recordings [In reply to]

On 11/22/2009 02:35 AM, Thomas Börkel wrote:
> HI!
>
> Thanks a lot for the very good explanation! Now I understand, what was
> going on and why.
>
> I don't remember defining the same storage group on each and every host.
> I once defined the old RecordFilePrefix on each and every host. Maybe
> this was converted to a SG during an update or I did it manually. ;-)
>

Yeah, the auto conversion did that. There wasn't really a better way at
the time, so some people may want to clean up their configs, now.

> Anyway, it's working now as specified and I can upgrade to 0.22 soon on
> my test system.

Great.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.