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

[C#] Allow log compaction to non-record-boundary addresses #361

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

badrishc
Copy link
Contributor

@badrishc badrishc commented Oct 26, 2020

session.Compact can now accept addresses that are not at strict record boundaries. It will return the actual address until which compaction was completed (next nearest record boundary).

For example, you can compact 20% of the log as follows:

  long compactUntil = store.Log.BeginAddress + (store.Log.TailAddress - store.Log.BeginAddress) / 5;
  compactUntil = session.Compact(compactUntil, shiftBeginAddress: false);
  await store.TakeHybridLogCheckpointAsync(CheckpointType.FoldOver);
  store.Log.ShiftBeginAddress(compactUntil);

See documentation here.

Also, added option to ShiftBeginAddress, to snap given address to nearest earlier page start.

@badrishc badrishc merged commit 075a10a into master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant