-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow deletion of ephemeral objects before commit #7064
Conversation
src/realm/table.cpp
Outdated
@@ -3385,6 +3385,17 @@ void Table::remove_object(ObjKey key) | |||
{ | |||
Group* g = get_parent_group(); | |||
|
|||
if (is_asymmetric()) { | |||
REALM_ASSERT(g); | |||
auto it = std::find_if(g->m_objects_to_delete.begin(), g->m_objects_to_delete.end(), |
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.
nit: auto& objects_to_delete = g->m_objects_to_delete;
Pull Request Test Coverage Report for Build github_pull_request_280703
💛 - Coveralls |
8a87283
to
f167bd4
Compare
f167bd4
to
8b3028e
Compare
src/realm/db.cpp
Outdated
for (auto it : transaction.m_objects_to_delete) { | ||
transaction.get_table(it.table_key)->remove_object(it.obj_key); | ||
// Checking ttl would go here |
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.
this would be lazy checking
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.
But I guess if we ever get this implemented, this would be the place to check which objects were due to be deleted. BTW if we skip recording the time the object was created, we can make this even more efficient. @danieltabacaru should we do that?
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 am not saying it's a bad place to check, it's just that we would be relying on other things being committed. I am not sure if it's the same idea, but we don't really need the object keys, the table keys is enough (we can then clear the tables). we can optimize it further by also skipping storing the table keys by iterating through the tables and clearing the asymmetric ones.
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.
Of course - the table keys are sufficient. Even better!
src/realm/sync/subscriptions.cpp
Outdated
sub_sets->get_object_with_primary_key(Mixed{version_id})); | ||
auto obj = sub_sets->get_object_with_primary_key(Mixed{version_id}); | ||
if (!obj) { | ||
throw KeyNotFound("Subscription set not found"); |
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.
we should include the version_id in the message
src/realm/sync/subscriptions.cpp
Outdated
std::lock_guard<std::mutex> lk(m_pending_notifications_mutex); | ||
if (version_id < m_min_outstanding_version) { | ||
return SubscriptionSet(weak_from_this(), version_id, SubscriptionSet::SupersededTag{}); | ||
} | ||
throw; | ||
throw KeyNotFound("Subscription set not found"); |
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.
same here
What, How & Why?
Likely to fix realm/realm-kotlin#1537
☑️ ToDos
[ ] C-API, if public C++ API changed.