Possible to run DB reorg outside of MP? (1 Viewer)

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    ok talking to myself :p

    not all settings were being loaded from config using original source and constructor does not set them for you...
    I have now added in calls to populate the settings.

    Issue with not updating last update time was actually down to the settings being update by DB Reorg call but that just updated the xml cache and as this is not inside MP it was never actually written to disk. Adding in a call of Settings.SaveCache before exit seems to solve that one.

    Now I am happy it is working as it should... As no-one else has piped up here I am assuming no-one else is interested in code? I will post source and binary here if people want...
     

    Guzzi

    Retired Team Member
  • Premium Supporter
  • August 20, 2007
    2,161
    747
    AW: Possible to run DB reorg outside of MP?

    Yes, please post code, I am interested :)
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Re: AW: Possible to run DB reorg outside of MP?

    Yes, please post code, I am interested :)
    OK slightly tweaked version of the code attached.
    You will need to sort out the references to core, databases and utils DLLs
     

    Attachments

    • MusicShareUpdater.zip
      30.6 KB

    Guzzi

    Retired Team Member
  • Premium Supporter
  • August 20, 2007
    2,161
    747
    AW: Re: AW: Possible to run DB reorg outside of MP?

    Yes, please post code, I am interested :)
    OK slightly tweaked version of the code attached.
    You will need to sort out the references to core, databases and utils DLLs

    Thanks, I think I will try a solution where I run it on the server and resync it to the clients afterwards - thus taking the load and unnecessary uptime away from the clients. UNfortunately there is afaik no good solution for central DBs - at least I had quite some problems when I tried it last time (long ago, I admit...)
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    OK just a warning....
    I have had this actually wipe my music collection twice now :eek:

    I am not sure why this is happening and I will do some more investigating. I have a feeling that it is down to my music being stored on a NAS device and when this kicks off and checks to see what needs deleting that it does not find any tracks as the NAS is sleeping so deletes them all. Then when it gets to the next stage the NAS has woken up but as nothing has changed since I last ran it then nothing is loaded into database....

    Will look at this at some point to see what is happening but you have been warned....
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    Yes. the above is correct. We try to match the files in the DB to the share and delete non-existing files.
    So when the NAS is not accessible, we bail out and remove all files from the db.

    I think i need some sort of check.
    e.g. when the database has 10,000 files and a scan just found 1% or even nothing, then we should stop the reorg.
    Any other suggestions are welcome.
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    I think i need some sort of check.
    e.g. when the database has 10,000 files and a scan just found 1% or even nothing, then we should stop the reorg.
    Any other suggestions are welcome.
    My check is very rough.... (but this runs as a backround user at 5am...)

    I have added a check to Directory.Exists(SharePath)
    then I attempt five times to connect, sleeeping in between (although this is currently sleeping the GUI thread so not good code). If after five attempts the directory has not been found then I take it out of m_shares

    Well at least that is my current plan....
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    The problem is that this part of code is also executed in "normal" situations, running out of config for example.
    i wonder that this hasn't happened more often already.
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    The problem is that this part of code is also executed in "normal" situations, running out of config for example.
    i wonder that this hasn't happened more often already.

    When I boot up my machine and generally when I start MP I can hear the NAS start to spin up and wake up (disks hibernate on my box). I am running this as a scheduled task and I think it it running too soon after the machine resumes and before it has had chance to wake the NAS.

    I have never had this happen running via config etc but I guess this is because I am running outside of MP so I don't have that small delay opening up MP / config etc.

    I guess the simplest solution might actually be to either schedule a job to ping the NAS box a minute or so before this one. Either way I was struggling to replicate the issue myself but will attempt to when I get some time.
     

    Users who are viewing this thread

    Top Bottom