Skip to content

ToMany considers changes applied even if put fails #1119

Open
@GautaA

Description

@GautaA

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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions