Skip to content

Fix MLPA tail increment; add cmdline options to Garnet BDN#1872

Open
TedHartMS wants to merge 1 commit into
mainfrom
tedhar/mlpa-fix
Open

Fix MLPA tail increment; add cmdline options to Garnet BDN#1872
TedHartMS wants to merge 1 commit into
mainfrom
tedhar/mlpa-fix

Conversation

@TedHartMS

Copy link
Copy Markdown
Contributor
  • Changed MultiLevelPageArray to use PageOffset for its tail and incrementing, fixing a rare lost-id
  • Add cmdline options to Garnet BDN, replacing the environment-variable approach

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Tsavorite’s MultiLevelPageArray allocation scheme to use a packed (Page, Offset) tail (via PageOffset) to avoid rare lost/duplicated ids under concurrent page growth and retry paths, and modernizes the Garnet BenchmarkDotNet harness to accept command-line options instead of environment variables.

Changes:

  • Refactors MultiLevelPageArray<TElement> to use a PageOffset-backed tail with Interlocked.Add/Exchange coordination for page turns (including a DEBUG-only AddPage failure injection hook).
  • Adds/updates Tsavorite recovery tests to stress the OOM rewind-and-retry path deterministically in DEBUG builds.
  • Adds BenchmarkDotNet CLI parsing for framework selection and operations parameter selection (--frameworks/--fw, --opparams/--op).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
libs/storage/Tsavorite/cs/test/test.recovery/ObjectIdMapTests.cs Renames allocation loop terminology and adds a DEBUG-only multi-thread OOM stress test using the new MLPA injection hook.
libs/storage/Tsavorite/cs/src/core/Utilities/SimpleConcurrentStack.cs Updates Clear parameter naming to “retainedPageCount” to align with MLPA terminology.
libs/storage/Tsavorite/cs/src/core/Utilities/MultiLevelPageArray.cs Core change: packed tail (PageOffset) allocation protocol + page growth path refactor + DEBUG-only failure injection hook.
libs/storage/Tsavorite/cs/src/core/Allocator/PageUnit.cs Clarifies PageOffset.Offset semantics via doc comment.
libs/storage/Tsavorite/cs/src/core/Allocator/ObjectIdMap.cs Adjusts assertions and clear-retention constants to match MLPA’s new Count/tail semantics.
benchmark/BDN.benchmark/Program.cs Adds custom CLI arg consumption and wires it into BDN configuration; replaces env-var behavior.
benchmark/BDN.benchmark/Operations/OperationsBase.cs Reworks operation parameter gating to be driven by CLI-selected flags (and adds a helper to set all flags).

Comment on lines +309 to +313
for (var page = 0; page <= lastPageIndex; page++)
{
Array.Clear(book[chapter], 0, MultiLevelPageArray.ChapterSize);
if (chapter > retainedChapterCount)
book[chapter] = null;
Array.Clear(book[page], 0, MultiLevelPageArray.PageSize);
if (page > retainedPageCount)
book[page] = null;
Comment on lines 333 to 336
{
var maxPage = chapter < lastChapterIndex ? MultiLevelPageArray.ChapterSize : lastPageIndex;
for (var page = 0; page < maxPage; page++)
var maxBlock = page < lastPageIndex ? MultiLevelPageArray.PageSize : lastBlockIndex;
for (var block = 0; block < maxBlock; block++)
{
Comment on lines +339 to 343
book[page][block] = default;
}
if (chapter > retainedChapterCount)
book[chapter] = null;
if (page > retainedPageCount)
book[page] = null;
}
Comment on lines +21 to +22
// Extract our custom CLI options (--runtime / --ops) before forwarding remaining args to BDN.
var passthroughArgs = ConsumeCustomArgs(args);
Comment on lines +95 to +97
BDN.benchmark.Operations.OperationsBase.SetAllParams(false);
var ops = Program.bdnOpParam.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).Select(p => p.ToLower()).ToArray();
foreach (var op in ops)
Comment on lines +58 to 61
#if DEBUG

#else
.Run(args, new BaseConfig());
#endif
Comment on lines 43 to +56
/// <summary>
/// Set by environment variable BDNRUN_OP_PARAM - determines if running with only "None" parameters (no ACLs, no AOF) or with all combinations of parameters
/// Clear and set all args before selecting the specific ones to be set by cmdline arg --bdnOpParam
/// </summary>
internal static bool ParamsNoneOnly;
public static void SetAllParams(bool isEnabled)
{
ParamsNone = isEnabled;
ParamsACL = isEnabled;
ParamsAOF = isEnabled;
ParamsAAD = isEnabled;
}

/// <summary>
/// Set by cmdline arg --bdnOpParam
/// </summary>
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.

2 participants