I found a (dummy) solution for this. The error was occurring when a Signal
from post_save of User model was being triggered. In that signal I was
performing a SomeModel.objects.get_or_create.
So, apparently the get_or_create method was implemented using transactions
with savepoints enabled. All I had to do was check if the Signal is called
when the instance of SomeModel is created and use SomeMode.objects.create
instead of SomeMode.objects.get_or_create.
But it still sucks tho, because everytime I use @transaction.atomic I have
to pass a savepoint=False parameter to it. The sucky part is, if I'm
undertanding it right, I have to implement my own database backend only to
disable savepoints by default on all transactions and I don't thinks it
worths the effort.
Well, anyway, if someone already knows where I can find a MySQL NDBCLUSTER
implementation of a django database backend I would be glad. Thank you all!
Em quarta-feira, 22 de janeiro de 2020 17:19:42 UTC-3, Victor Guimarães
Nunes escreveu:
>
> Hi,
>
> I'm having some trouble setting up a Django project with a MySQL NDB
> Cluster. I found I had to set the storage engine on
> DATABASES['default']['OPTIONS'] and I did it.
>
> DATABASES = {
> 'default': config('DATABASE_URL', cast=db_url)
> }
>
> # Check if mysql database engine is NDBCLUSTER
> if config('USE_NDBCLUSTER', cast=bool, default=False):
> DATABASES['default'].update({
> 'OPTIONS': {
> 'init_command': 'SET default_storage_engine=NDBCLUSTER;',
> }
> })
>
> but almost always when I try to perform some write action on the database
> I get the following esception:
>
> OperationalError at /admin/auth/user/add/
>
> (1178, "The storage engine for the table doesn't support SAVEPOINT")
>
>
> I don't quite get what I supposed to do about once the cluster demands a
> NDBCLUSTER storage engine to work properly and I don't have any ideia of
> what is savepoints and where/how I can disabled it.
>
> Any thoughts about this issue?
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e92ee650-63da-4c7d-846b-fa19b37a37dd%40googlegroups.com.