mySQL vs Path Substitution
#1
Hi,

I looked through the path substitution posts and it doesn't seem that anyone else has brought this up.

What are the advantages of setting up a mySQL database on a server for all the home PCs to access vs just using path substitution to a network share for the library?

On the path substitution page of the wiki I see that it says not to share the library, but I do not understand why.

I currently have 4 windows boxes and an ubuntu server. The server has most(95%) of the media stored on it. I was wondering why I can not just setup a shared folder on the server with basically the complete contents of the xbmc/userdata folder from one of the client PCs. All of the clients would refer to the shared folder through path substitution in the advancedsettings.xml file, which would relieve the need to set up the mySQL database on the server.

I ask this because I would like to run as few services on the ubuntu box as possible. I have had issues with accessing the ubuntu box in the past (through tightVNC) and I don't want to have to bother with something like that whenever I deal with admin tasks. The ubuntu server is mostly used as an oversized NAS share box, so I am hoping to reduce the number of times I have to connect it to my monitor directly to as few as possible. (in other news, if anyone would love to help me get my tightVNC working again, that would be wonderful. It worked great for a few months and just randomly stopped letting me connect one day).

Thanks in advance for your help.

Reply
#2
The problem is that the database of xbmc (the internal one) uses SQLite that is not multiuser capable, so if 2 instances try to write to it at once, they will probably corrupt it. You could use that setup for some time without any problem and suddenly one day al the information there could become corrupt and so all the data is lost.
Reply
#3
MySQL allows multiple users to access the database at the same time.

SQLite (the default) is single user. You could set it up with path substitution only if one XBMC instance accesses it at a time.
Reply
#4
Thanks.

I was thinking it was something along those lines.

Right now I actually have all of the computers symlink the library to a dropbox folder, which I guess would have the same corruption issue that you've mentioned. It's been working for the last couple weeks but after reading this I realize I should probably undo that.

I've noticed that xbmc will only write to the database when you open a file and when you close it (by either stopping midway or natually going to the end). Would that mean that the corruption could occur when you play a file(different files at the same time) simultaneously on two different computers? I guess that would be something I would watch out for.

I guess in the end the mySQL would be the best bet. God I wish linux wasn't such a pain to remote desktop into...

Reply
#5
(2012-05-31, 19:26)pko66 Wrote: The problem is that the database of xbmc (the internal one) uses SQLite that is not multiuser capable, so if 2 instances try to write to it at once, they will probably corrupt it. You could use that setup for some time without any problem and suddenly one day al the information there could become corrupt and so all the data is lost.

This is actually not true ..

If you read the SQLite FAQ, you will see that it can maintain multiple clients / connections, provided they are reading (SELECTing) if they are requiring write (UPDATE / SELECT) access, the DB file / table is locked .. considering the fact that the bulk of the traffic will be reading, I cant really see this as a problem .. unless the XBMC code is not written in a way to wait for DB timeouts gracefully ..

I have used MANY production databases that use this exact methodology, and if the client side code is well written, the worst that will happen is that the client will wait until the INSERT / UPDATE is complete, and then continue as normal.

Reply
#6
(2012-07-08, 20:22)jet-lee Wrote:
(2012-05-31, 19:26)pko66 Wrote: The problem is that the database of xbmc (the internal one) uses SQLite that is not multiuser capable, so if 2 instances try to write to it at once, they will probably corrupt it. You could use that setup for some time without any problem and suddenly one day al the information there could become corrupt and so all the data is lost.

This is actually not true ..

If you read the SQLite FAQ, you will see that it can maintain multiple clients / connections, provided they are reading (SELECTing) if they are requiring write (UPDATE / SELECT) access, the DB file / table is locked .. considering the fact that the bulk of the traffic will be reading, I cant really see this as a problem .. unless the XBMC code is not written in a way to wait for DB timeouts gracefully ..

I have used MANY production databases that use this exact methodology, and if the client side code is well written, the worst that will happen is that the client will wait until the INSERT / UPDATE is complete, and then continue as normal.

Search the forums on this topic to see responses/explanation from our devs. Or feel free to try it yourself and watch as eventually your library DB gets corrupted and you have to rebuild your entire library.
Reply
#7
I use MySQL for shared video and music databases, but for the other ones not available in MySQL (addon.db, etc), I share the SQLite databases between my ~8 XBMC clients. I haven't had any problem with corruption in the past year of heavy use.

That being said, i still have every revision of my .db files backed up using a volume shadow copy at 5 minute intervals in case I need to revert (thanks to Crashplan).
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply

Logout Mark Read Team Forum Stats Members Help
mySQL vs Path Substitution0