MySQL embedded and pthreads

Ian Monroe ian at monroe.nu
Tue Jul 29 05:39:50 CEST 2008


On Mon, Jul 28, 2008 at 3:17 PM, Edward Hades <edward.hades at gmail.com>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi, guys!
>
> As you possibly know, I've been working on MySQLe integration with
> Amarok. I have encountered several issues.
>
> First, MySQLe needs patching.


That isn't really acceptable. We need to be able to depend on the distro
provided packages.


> By default it compiles without -fPIC flag
> that we need,

fPIC is a build option, so what I said above doesn't apply. :)


> it has a maximum key limit of 1000 bytes (although large
> key usage in amarok is a concern itself, but more of an optimization
> nature). Also, it calls exit() whenever feels like it was offended; I
> guess that should be changed to something at least printing what
> happened.


We have a contact within MySQL/Sun who has offered to answer questions that
we have. Sounds like a good time to invoke him. :) I'll find the email
address and send it to you.


> I'll make a build script to simplify life for us, but
> packaging questions will remain (luckily it's a build-dep only, so this
> is not hard to settle).
>

Why is it a build-only dep? Maybe I'm misunderstanding something.

Also, there is a thread safety issue. MySQL requires every thread to
> invoke certain procedures (mysql_thread_init and mysql_thread_end)
> before accessing its data and before death respectively. I've done some
> street pthread magic that takes care of initialization, but I still
> didn't come up with a way to run mysql_thread_end before thread exit.


Yea pthread isn't portable and shouldn't be used directly really.

Just an off-my-top, didn't-look-at-code idea:
You could use QThread::currentThread() to see if the current thread has been
initialized or not, and do so in the sqlcollection itself if it needs to be.

That doesn't solve the uninitialized issue...

Seems like the only solution is to explictly call the mysqle uninitalize
code when the thread is being deleted. This might not be that hard, its
quite possible only the sqlcollection's querybuilders threads access it
(outside of the gui thread).


>
> Ideas much appreciated ;). It works fine without it, but it results in
> wasted resources.
>
> This being my first post, I'd like to thank you all for the marvelous
> piece of software you make and express honor and delight of being
> allowed to stick my dirty fingers in it ;) You rock!
>

Awesome work. :)


>
> All the best,
> Edward "Hades" Toroshchin
> IRC nickname: Aides
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/amarok-devel/attachments/20080728/489e02c5/attachment.html 


More information about the Amarok-devel mailing list