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

RNET-1154, RNET-1151, RNET-1139: Compact-related fixes #3618

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

nirinchev
Copy link
Member

Description

Fixes #3617
Fixes #3583
Fixes #3612

TODO

  • Changelog entry
  • Tests

Comment on lines -52 to -61
/// <summary>
/// A callback, invoked when opening a Realm for the first time during the life
/// of a process to determine if it should be compacted before being returned
/// to the user.
/// </summary>
/// <param name="totalBytes">Total file size (data + free space).</param>
/// <param name="bytesUsed">Total data size.</param>
/// <returns><c>true</c> to indicate that an attempt to compact the file should be made.</returns>
/// <remarks>The compaction will be skipped if another process is accessing it.</remarks>
public delegate bool ShouldCompactDelegate(ulong totalBytes, ulong bytesUsed);
Copy link
Member Author

Choose a reason for hiding this comment

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

these are moved to RealmConfigurationBase so they become available to sync configs.

@@ -321,50 +321,6 @@ public void RealmObjectClassesOnlyAllowRealmObjects()
Assert.That(ex.Message, Does.Contain("must descend directly from either RealmObject, EmbeddedObject, or AsymmetricObject"));
}

[TestCase(true)]
[TestCase(false)]
public void ShouldCompact_IsInvokedAfterOpening(bool shouldCompact)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is moved to SynchronizedInstanceTests.

@@ -463,6 +419,32 @@ public void Compact_WhenResultsAreOpen_ShouldReturnFalse()
token.Dispose();
}

[Test]
public void Compact_WhenShouldDeleteIfMigrationNeeded_PreservesObjects()
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the test for #3583 and #3612

Copy link

coveralls-official bot commented Jun 6, 2024

Pull Request Test Coverage Report for Build 9396984287

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.009%) to 81.261%

Files with Coverage Reduction New Missed Lines %
Realm/Realm/Realm.cs 1 93.41%
Totals Coverage Status
Change from base Build 9396954693: -0.009%
Covered Lines: 6830
Relevant Lines: 8261

💛 - Coveralls

@nirinchev nirinchev merged commit 61db0ed into main Jun 12, 2024
71 of 78 checks passed
@nirinchev nirinchev deleted the ni/compact-fixes branch June 12, 2024 12:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
1 participant