You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed some possible inconsistencies while reading the recently added fixes to close dependent databases when closing leveldb databases.
I am absolutely not an expert on PouchDB and its code base, so I may have misunderstood what was done and what was the correct way to handle these cases. Please correct me if I am wrong.
Here are the previous events to understand my concerns:
I started working on tests but after looking at the codebase, I got very confused about how the things were handled internally and decided I needed more time to understand if fixes proposed in 1. and 3. were properly designed.
At this point, I could patiently wait for release 7.3.2 to ship and consider the issue fixed.
But I'd like to share what I've seen during work done at step 6. so that more knowledgable people can eventually rework the codebase if the fixes listed above actually introduced inconstencies.
So, here we go.
I first took the time to review how things were designed in the code base:
The thing that bothers me is that the common implementation for destroy is responsible for destroying dependent databases, whereas due to fixes introduced in steps 1. and 3. above, the adapter-specific implementation of the close method is reponsible to close dependent databases.
This seems inconstent, and this might introduce various bugs (such as _local/_pouch_dependentDbs referencing databases non longer existing on disk, cf initial use case described in step 1. above (#7331)).
In my opinion, dependent databases should be handled consistently either in the common implementation, or in the adapter-specific implementation, but not with code spread over both sides...
Some reasons to favor the common implementation:
Genericity of the code: other adapters than leveldb may need the same logic
Anteriority of the pattern: the handling of dependent databases at this level dates back to 2014 (35cd3abb), while the "recent" leveldb adapter fixes date back to 2021/2022.
I'll submit a pull request soon to demonstrate what it could look like if we handled dependent databases only in the common implementation. Edit Here it is: #8575
Issue
I noticed some possible inconsistencies while reading the recently added fixes to close dependent databases when closing leveldb databases.
I am absolutely not an expert on PouchDB and its code base, so I may have misunderstood what was done and what was the correct way to handle these cases. Please correct me if I am wrong.
Here are the previous events to understand my concerns:
At this point, I could patiently wait for release
7.3.2to ship and consider the issue fixed.But I'd like to share what I've seen during work done at step 6. so that more knowledgable people can eventually rework the codebase if the fixes listed above actually introduced inconstencies.
So, here we go.
I first took the time to review how things were designed in the code base:
The thing that bothers me is that the common implementation for destroy is responsible for destroying dependent databases, whereas due to fixes introduced in steps 1. and 3. above, the adapter-specific implementation of the close method is reponsible to close dependent databases.
This seems inconstent, and this might introduce various bugs (such as
_local/_pouch_dependentDbsreferencing databases non longer existing on disk, cf initial use case described in step 1. above (#7331)).In my opinion, dependent databases should be handled consistently either in the common implementation, or in the adapter-specific implementation, but not with code spread over both sides...
Some reasons to favor the common implementation:
I'll submit a pull request soon to demonstrate what it could look like if we handled dependent databases only in the common implementation. Edit Here it is: #8575