CBL v1.2.x opens forestdb with FDB_COMPACTION_MANUAL. CBL 1.3.x fails to create c4View instance because v1.3.x use FDB_COMPACTION_AUTO option. So need to retry to open index with FDB_COMPACTION_MANUAL option, and update compaction mode to FDB_COMPACTION_AUTO.
ABOUT WORKAROUND: c4View's MapReduceIndex_index variable calls Database::getKeyStore(...) in constructor, and it calls fdb_kvs_open(...) with _viewDB. It increments reference count of _viewDB._fileHandle. So calling fdb_switch_compaction_mode(...) after c4View instance is created fails. Switching compaction mode before creating c4View instance is workaround.
Original Issue: https://github.com/couchbase/couchbase-lite-android/issues/974
CBL v1.2.x opens forestdb with FDB_COMPACTION_MANUAL. CBL 1.3.x fails to create c4View instance because v1.3.x use FDB_COMPACTION_AUTO option. So need to retry to open index with FDB_COMPACTION_MANUAL option, and update compaction mode to FDB_COMPACTION_AUTO.
ABOUT WORKAROUND:
c4View
'sMapReduceIndex
_index
variable callsDatabase::getKeyStore(...)
in constructor, and it callsfdb_kvs_open(...)
with_viewDB
. It increments reference count of_viewDB._fileHandle
. So callingfdb_switch_compaction_mode(...)
afterc4View
instance is created fails. Switching compaction mode before creating c4View instance is workaround.