objectbox / objectbox-java

Android Database - first and fast, lightweight on-device vector database
https://objectbox.io
Apache License 2.0
4.33k stars 297 forks source link

Remove failed with code -30788 #1139

Closed peterpeng07 closed 10 months ago

peterpeng07 commented 11 months ago

I get an io.objectbox.exception.DbException: Remove failed (-30788) (error code -30788) Exception when I try to do a box.removeAll(). I can see from this comment that this can be caused by the data is too large to delete, since a lot of audio data (2-3MB * ~ 8000 entries) are stored in this box. But what's a good way to clear this box? Thanks!

Here's the entity of the box:

    @Id
    private long id;

    @Unique(onConflict = ConflictStrategy.REPLACE)
    @Index
    @NotNull
    private String uid;

    @Convert(converter = VoiceTypeConverter.class, dbType = String.class)
    private VoiceType voiceType;

    @Index
    private String languageId;

    @NotNull
    private String md5;

    @NotNull
    private String displayText;

    @NotNull
    private Date lastModified;

    @NotNull
    private String audioData;
    private int durationMs;

ObjectBox-Java-3.2.1

greenrobot commented 11 months ago

In our tests, we successfully delete much more objects in a single transaction, and we where never able to reproduce this error.

Do we have any chance to have this reproducible? Anything you can share?

peterpeng07 commented 11 months ago

Unfortunately no... I also tried to reproduce this with some mock data but had no luck. It'll be nice to have a way to see what's inside the database without the Admin tool built into the project.

Any other idea why this error message would be thrown during a removeAll()?

greenrobot commented 11 months ago

So, do you have the DB (file) in question still around? That would be great to test with, e.g. query 100 IDs via findIds(0, 100), delete these objects and repeat until no IDs are returned anymore.

greenrobot-team commented 10 months ago

If you can not provide a database file or reproducible example, it would still be helpful to know what device (model, architecture) this occurred on!

peterpeng07 commented 10 months ago

So, do you have the DB (file) in question still around? That would be great to test with, e.g. query 100 IDs via findIds(0, 100), delete these objects and repeat until no IDs are returned anymore.

I have verified that this method does work. Also, removeAll() has been working after I re-created a new database.

greenrobot-team commented 10 months ago

Glad this worked for you!

I also can not reproduce this after filling up a database with objects with an about 2 MB large random String each summing up to around 5 GB in total (created an internal integration test).

github-actions[bot] commented 10 months ago

Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.