Skip to content
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

realm compact #1005

Merged
merged 23 commits into from
Nov 4, 2022
Merged

realm compact #1005

merged 23 commits into from
Nov 4, 2022

Conversation

blagoev
Copy link
Contributor

@blagoev blagoev commented Nov 3, 2022

Support realm compact.

fixes #803

@blagoev blagoev requested review from nielsenko, desistefanova and nirinchev and removed request for desistefanova November 3, 2022 16:37
@cla-bot cla-bot bot added the cla: yes label Nov 3, 2022
Copy link
Contributor

@nielsenko nielsenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think it is prudent not to spawn an isolate - users can do that themselves. Would be nice if realm-core exposed an async interface for this though.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3387542209

  • 0 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 88.978%

Totals Coverage Status
Change from base Build 3385625020: -0.7%
Covered Lines: 2220
Relevant Lines: 2495

💛 - Coveralls

@coveralls
Copy link

coveralls commented Nov 3, 2022

Pull Request Test Coverage Report for Build 3394922515

  • 16 of 17 (94.12%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 89.104%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/src/realm_class.dart 12 13 92.31%
Totals Coverage Status
Change from base Build 3393646855: 0.3%
Covered Lines: 2756
Relevant Lines: 3093

💛 - Coveralls

@blagoev
Copy link
Contributor Author

blagoev commented Nov 3, 2022

@nielsenko added a test for a worker isolate.

Copy link
Contributor

@desistefanova desistefanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to test if:

  • a compacted realm could be opened
  • a synced realm populated with data could be compacted and the opened with the same number of rows.
  • the size of compacted realm file is less than the size of a synced populated ream that had been frozen before the compaction.

lib/src/realm_class.dart Outdated Show resolved Hide resolved
test/test.dart Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
test/test.dart Outdated Show resolved Hide resolved
lib/src/realm_class.dart Show resolved Hide resolved
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API should be sync

test/realm_test.dart Outdated Show resolved Hide resolved
lib/src/realm_class.dart Outdated Show resolved Hide resolved
lib/src/realm_class.dart Show resolved Hide resolved
lib/src/realm_class.dart Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly there - the main remaining thing is to make sure we're not polluting tests by subscribing to all objects from a collection.

test/realm_test.dart Outdated Show resolved Hide resolved
test/test.dart Outdated Show resolved Hide resolved
test/realm_test.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@desistefanova desistefanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some small suggestions about formatting and naming. It looks good.

@blagoev blagoev merged commit 991142d into master Nov 4, 2022
@blagoev blagoev deleted the blagoev/realm-file-compact branch November 4, 2022 16:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Realm Compaction support
5 participants