objectbox / objectbox/objectbox-java

ToMany considers changes applied even if put fails

Đang mở
#1,119 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

@greenrobot-team đang làm issue này rồi.

Từ ngày 21/3/2023.

bug
Ngôn ngữ chính
Java
Star
4.6k
Fork
311
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.