#23718: TEST_MIRROR setting doesn't work as expected (and has no tests)
-------------------------------------+-------------------------------------
     Reporter:  Ilya Baryshev        |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  assigned
    Component:  Testing framework    |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  replica testing      |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 @Rag Sagar.V, sure feel free to assign the ticket to yourself.

 I'd start by having a look at [https://github.com/django/django/pull/9603
 the previous PR] and make sure to understand the rationale behind why it
 got rejected.

 For what it's worth I gave this ticket a 2-3 hours try by trying to point
 `connections['mirror']` at `connections['mirrored']` Python objects for
 the duration of `TestCase` and I got some failures related to transaction
 handling. I think
 [https://github.com/django/django/pull/9603#issuecomment-388347770 Tim did
 a good job at nailing the issues] with this approach. In short transaction
 handing is alias based so if something goes wrong with
 `connections['mirrored']` then it's also surfaced in
 `connections['mirror']` which differs from what would happen in a real
 life scenario.

 The further I got from getting things working were by setting the
 isolation level on the miror/replica to `READ UNCOMMITED` for the duration
 of the test to allow it to see changes within the testcase transaction.
 This isolation level is not supported on all backends though (e.g.
 PostgreSQL) and was quite unreliable on MySQL from my minimal testing.

 That one might be hard one if you're not familiar with how `TestCase`
 transactions wrapping takes place but you'll definitely learn a lot by
 giving this ticket a shot and seeing how the suite fails. Happy to review
 your changes if you get stuck on Github.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23718#comment:25>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates/067.c2b7294dfb28fdf74dea2cbe7b995a19%40djangoproject.com.

Reply via email to