objectbox / objectbox/objectbox-java

ToMany considers changes applied even if put fails

Aperta
#1,119 4 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@greenrobot-team ci sta già lavorando.

Dal 21/3/2023.

bug
Lingua principale
Java
Stelle
4.6k
Fork
311
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

ObjectBox version (are you using the latest version?): 3.5.0
Reproducibility: Every time
Device: Multiple Android devices
OS: Android

Hi, I'm wondering whether the issue I'm experiencing is a intended behavior or a bug.

Our working flow goes like this:
We have a model with a lot of different fields but two most important ones are ToMany relations with list of specific events. Single object that contains all of the data that we are adding to the database, and the said object gets updated till the data gets uploaded to our server, and the cleared and deleted from the database.

Under specific circumstances the database gets full and we have a need to extend it.

We do so by caching the exception, closing the database, increasing the maxSizeInKByte value and rebuilding it. The problem I have noticed is it that when Objectbox tries to add data after the database has extended it won't add the events (that are stored in the Lists and are connected to the main object by ToMany relations) that happened in those last few seconds between us closing the database and rebuilding it. Or to be more precise the data that was supposed to be added but wasn't successfully because of the exception will never be added, even though it's still in the object itself, and the same said object always is sent to be added.

I'm guessing this has something to do with caching or some similar mechanism, here is what else I tried:

  1. Deleting all files from the database and re-adding the object -> results in only data after extending the database being added (which confirms in someway that the data that Objectbox added before isn't getting re-added for some reason, even though database is empty and the object still has the data)
  2. Serializing and deserializing the object so it has a completely new memory address, still the same result as in 1.
  3. Playing around with ids of ToMany objects, methods like reset(), setTarget() and so on, nothing has worked so far.

Please if you could point me into the right direction and tell me what I'm doing wrong it would be greatly appreciated.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.