objectbox / objectbox-swift

Swift database - fast, simple and lightweight (iOS, macOS)
https://swift.objectbox.io
Apache License 2.0
465 stars 30 forks source link

dbFull(message: "Remove failed"): && ObjectBox.ObjectBoxError.dbFull(message: "Could not put") #40

Closed technotricks closed 4 years ago

technotricks commented 4 years ago

Issue Basics

ObjectBoxSwift Version :- v1.3.0

Description:-

My scenario is to store a large amount of data to the DB. I got an Exception when I try to put data into the database and delete data from DB(Happened after a few days).

Issue 1:- dbFull(message: "Remove failed") Log:- [ERROR] Storage error code -30792 Error occurred: Remove failed (10101) Fatal error: Unexpected error creating query: dbFull(message: "Remove failed"): file /Users/markus/dev/objectbox-swift/ios-framework/CommonSource/Query/Box+Query.swift, line 58

Issue 2:- ObjectBox.ObjectBoxError.dbFull(message: "Could not put") Log:- [ERROR] Storage error code -30792 Error occurred: Could not put (10101) ObjectBox.ObjectBoxError.dbFull(message: "Could not put")

Please advice the solution for this

greenrobot commented 4 years ago

ObjectBox has a maximum size setting to prevent your database from growing to unexpected sizes; e.g. image you did a programming error and inserted data until your drive is full.

The default setting is currently 500 MB (we might increase that in the future), and you can change it using the Store initializer, which has a signature like this:

public init(directory: String = "objectbox", maxDbSizeInKByte: UInt64 = 500 * 1024,
            fileMode: UInt32 = 0o755, maxReaders: UInt32 = 0) throws

E.g. to allow 2 GB:

let store = try Store(directoryPath: myDir, maxDbSizeInKByte: 2 * 1024 * 1024)

technotricks commented 4 years ago

Thanks for the faster replay. I have increased the DB size but Is there any way to check the db size instead of throwing error. Because I need some unlimited storage without any limit.

greenrobot commented 4 years ago

Since this is not documented very well (yet), I've also posted this Q&A on StackOverflow. Please post further questions there related to this topic.

Getting file size is a good idea. We'll add it.

I need some unlimited storage

Sounds like you are using ObjectBox on desktop/server? Just curious about what you are doing...

greenrobot commented 4 years ago

OK, question was answered, I guess we can close this...