-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Resume file source to complete resources cache path change #14546
Conversation
c8ff475
to
4f2a2a6
Compare
I've made the changes mentioned in the OP and this is ready for a review. |
4f2a2a6
to
f885d46
Compare
@@ -17,6 +17,7 @@ template <typename T> class Thread; | |||
} // namespace util | |||
|
|||
class ResourceTransform; | |||
using PathChangeCallback = std::function<void ()>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a way to communicate failure?
Right now, void OfflineDatabase::changePath(const std::string&)
can throw exception, should developer be notified when setResourceCachePath
fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the way for void OfflineDatabase::changePath(const std::string&)
to throw? Is that only the assert(!db)
and assert(statements.empty())
assertions in OfflineDatabase::initialize()
? If that's the case, we are logging a failure to cleanup beforehand, so I don't think we need to send failure callback just before we crash anyway. Same if we fail to open the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the underlying problem here is that we don't have a proper mechanism for detecting errors when we failed to open the database/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that we'd be able to follow up on in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LukasPaczos almost every line in OfflineDatabase::initialize
throws an exception (db->*, file deletion). ResourcesCachePathChangeCallback
already provides onError
, that might be used on SDK side to notify developer when changePath failed.
This PR did not introduce that issue, so, I think fix for propagating an error on initialize
can be done in separate PR. May be worth creating issue + adding TODO note for PathChangeCallback
that refers to an issue.
@tmpsantos wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #14759 and added a TODO
.
4094844
to
bf759f6
Compare
Comments addressed. |
bf759f6
to
4672464
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm from my side, please don't forget to create an issue for possible failure when database initialization fails.
4672464
to
3d95000
Compare
Closes #14334.
I've initially made
DefaultFileSource::setResourceCachePath
synchronous and managed threading on the java side, but now that I think about it, it might be cleaner to use a callback and do the threading on the core side.