#2377 - Wrong order in batch save, fix transaction depth

The guts of this fix is in DefaultPersister.saveAssocOne() with the change to use the new transaction.depthDecrement() method. For our failing test cases this changes the depth from -1, 0 to be 0, 1.

We can see the impact of this change in the batch ordering via the logging of:
 io.ebean.SUM - txn[1001] BatchControl flush ...
This commit is contained in:
rbygrave committed 2021-09-17 17:58:20 +12:00
1 parent b38a21f8c4
commit f51f2269fb
10 files changed
+134 -59

No files matched your search

@@ -7,10 +7,11 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.relates.*;
public class TransactionTest extends BaseTestCase {
private Relation1 r1 = new Relation1("R1");
private Relation2 r2 = new Relation2("R2");
private Relation3 r3 = new Relation3("R3");
class TransactionTest extends BaseTestCase {
private final Relation1 r1 = new Relation1("R1");
private final Relation2 r2 = new Relation2("R2");
private final Relation3 r3 = new Relation3("R3");
private Transaction txn;
@@ -27,14 +28,14 @@ public class TransactionTest extends BaseTestCase {
}
@Test
public void testMultiSave1() {
void testMultiSave1() {
r2.setWithCascade(r3);
r1.setWithCascade(r2);
DB.save(r1);
}
@Test
public void testMultiSave2() {
void testMultiSave2() {
r2.setWithCascade(r3);
r1.setWithCascade(r2);
DB.save(r3);
@@ -42,7 +43,7 @@ public class TransactionTest extends BaseTestCase {
}
@Test
public void testMultiSave3() {
void testMultiSave3() {
r2.setWithCascade(r3);
r1.setWithCascade(r2);
DB.save(r3);
@@ -51,7 +52,7 @@ public class TransactionTest extends BaseTestCase {
}
@Test
public void testMultiSave4() {
void testMultiSave4() {
r2.setNoCascade(r3);
r1.setWithCascade(r2);
DB.save(r3);
@@ -60,11 +61,20 @@ public class TransactionTest extends BaseTestCase {
}
@Test
public void testMultiSave5() {
void testMultiSave4_usingRelation4() {
Relation4 r4 = new Relation4("foo");
r2.setR4NoCascade(r4);
r1.setWithCascade(r2);
DB.save(r4);
DB.save(r1);
}
@Test
void testMultiSave5() {
r2.setNoCascade(r3);
r1.setNoCascade(r2);
DB.save(r3);
DB.save(r2);
DB.save(r1);
}
}
}