Hi Henrique, Thanks for your feedback and testing!
> IMO, if RC2 has this unexpected behaviour (!) maybe we should discourage its > usage? I know, it’s only a RC, but Cayenne has always been so stable for me, > never thought twice of using RCs. I'd say we outrun this by releasing "4.2 final" quickly. It is about time I think. Andrus > On Mar 9, 2023, at 9:00 PM, Henrique Gomes <h...@farol.pt> wrote: > > Hi Nikita, > > Thank you for the feedback! > I have good news, I could not reproduce the fault after cherry picking that > commit on top of 4.2RC2! All my objects were saved on every attempt. > > Just for completeness, `mvn package` in that configuration fails with: > > [ERROR] Failures: > [ERROR] OpIdFactoryTest.testEqualsAndHashCode:57 > expected:<<ObjectId:test,TEMP:-1393483588>> but > was:<<ObjectId:test,TEMP:-1364854437>> > > But that seems to have been fixed in > https://github.com/apache/cayenne/commit/78868d820fd30cf088846e6f89619e91a4206fad > > > I’ve also tested STABLE-4.2 (current at > e6f2f59f369a9fdf5575d35b47f2ac30ee050da3) and all looks good there too. > > IMO, if RC2 has this unexpected behaviour (!) maybe we should discourage its > usage? I know, it’s only a RC, but Cayenne has always been so stable for me, > never thought twice of using RCs. > > For now, I’ll stay with RC1. It’s quite cumbersome for me to use anything > other than official releases on production, too much work to setup the CI to > build my own version of a library. Hoping the next version will be out soon. > > Thank you again for your help! > > Kind regards, > > Henrique Gomes > > >> On 9 Mar 2023, at 09:37, Nikita Timofeev <ntimof...@objectstyle.com> wrote: >> >> Also I've described exact cause of the problem in this issue >> https://issues.apache.org/jira/browse/CAY-2801 >> >> On Thu, Mar 9, 2023 at 11:25 AM Nikita Timofeev >> <ntimof...@objectstyle.com> wrote: >>> >>> Hi! >>> >>> Thanks for the information and even more for the debugging you already did. >>> There was a commit a bit after 4.2.RC2 was released that could be >>> related to your problem. >>> Would be great if you could try it and see if it helps. >>> >>> https://github.com/apache/cayenne/commit/53c9408e026d926601baf6e68b9761489c273397 >>> >>> On Wed, Mar 8, 2023 at 6:26 PM Henrique Gomes <h...@farol.pt> wrote: >>>> >>>> >>>> Hello, >>>> >>>> I want to ask for help debugging an issue: >>>> >>>> On January I updated Cayenne from 4.2.RC1 to 4.2.RC2. >>>> Immediately after that, we had an issue of objects not being persisted to >>>> the db; an http endpoint on our service accepts a batch of records and >>>> creates objects to save: >>>> >>>> ObjectContext ctx = server.newContext(); >>>> >>>> for (Aggregation post : request.getEntries()) { >>>> >>>> MyDataObject dbo = ctx.newObject(MyDataObject.class); >>>> >>>> dbo.setValueDate(post.getValueDate()); >>>> >>>> dbo.setVersion(post.getVersion()); >>>> >>>> dbo.setUuid(post.getUuidBytes()); >>>> >>>> ... etc ... >>>> } >>>> >>>> try { >>>> >>>> ctx.commitChanges(); >>>> >>>> >>>> The endpoint is called with up to 250 items at a time, and we store ~4000 >>>> on each daily run of that job. >>>> We found that after the update, a small number, like 2 sometime more, >>>> records would be missing from the db, but not always. >>>> >>>> >>>> Rolling back seemed to solve the issue. Puzzled, I tried git bisecting >>>> Cayenne from RC1 to RC2. >>>> This is was the result: >>>> >>>> >>>> 7bc235f92e2e61d3f4f04d3bebb65a1756d2e092 is the first bad commit >>>> commit 7bc235f92e2e61d3f4f04d3bebb65a1756d2e092 >>>> Author: Nikita Timofeev <stari...@gmail.com> >>>> Date: Mon Nov 21 12:59:45 2022 +0300 >>>> >>>> CAY-2777 Reverse relationship is not set with single table inheritance >>>> >>>> .../access/flush/DefaultDataDomainFlushAction.java | 3 +- >>>> .../apache/cayenne/access/flush/EffectiveOpId.java | 2 +- >>>> .../access/flush/operation/OpIdFactory.java | 113 ++++++++++++++++++ >>>> .../org/apache/cayenne/map/ObjRelationship.java | 13 +- >>>> .../java/org/apache/cayenne/ManyToManyJoinIT.java | 27 +++++ >>>> .../SelfRelationship.java | 28 +++++ >>>> .../SelfRelationshipSub.java | 28 +++++ >>>> .../auto/_Author.java | 7 +- >>>> .../auto/_SelfRelationship.java | 132 >>>> +++++++++++++++++++++ >>>> .../auto/_SelfRelationshipSub.java | 91 ++++++++++++++ >>>> .../auto/_Song.java | 10 +- >>>> .../relationships-many-to-many-join.map.xml | 37 +++++- >>>> 12 files changed, 472 insertions(+), 19 deletions(-) >>>> create mode 100644 >>>> cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/OpIdFactory.java >>>> create mode 100644 >>>> cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_many_to_many_join/SelfRelationship.java >>>> create mode 100644 >>>> cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_many_to_many_join/SelfRelationshipSub.java >>>> create mode 100644 >>>> cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_many_to_many_join/auto/_SelfRelationship.java >>>> create mode 100644 >>>> cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_many_to_many_join/auto/_SelfRelationshipSub.java >>>> >>>> I also tried reverting this commit on top of RC2 and that also seems to >>>> have solved it. >>>> >>>> The entity is quite simple, no relationships at all. >>>> The database is MySQL 8. >>>> The PK is regular mysql generated ID: >>>> >>>> <db-attribute name="id" type="BIGINT" isPrimaryKey="true" >>>> isGenerated="true" isMandatory="true" length="20"/> >>>> >>>> I can share more info, code etc, with someone who wants help debugging it, >>>> but can not expose too much company info here, sorry. >>>> It is of course possible that the bug is outside Cayenne, on our code, db, >>>> etc, and somehow only triggered if that commit is present. >>>> I can not say with 100% certainty that it is an issue with Cayenne. >>>> >>>> The issue is sporadic, but quite frequent. If there are any ideas on how I >>>> can further debug this, do let me know. >>>> >>>> Thanks for the attention given, I really would like to get the bottom of >>>> this. >>>> >>>> Kind regards, >>>> >>>> Henrique Gomes >>>> >>>> >>>> >>> >>> >>> -- >>> Best regards, >>> Nikita Timofeev >> >> >> >> -- >> Best regards, >> Nikita Timofeev >