Skip to content

fixup issues. - #1483

Merged
yuhaijun999 merged 5 commits into
dingodb:mainfrom
visualYJD:yjd-dev
Sep 1, 2026
Merged

yuhaijun999 merged 5 commits into
dingodb:mainfrom
visualYJD:yjd-dev

Conversation

@visualYJD

Copy link
Copy Markdown
Contributor

No description provided.

…core_diff, default_store_region_size)

- balance_region_limit_score_diff: register a strictly-positive gflags
  validator so it can be changed at runtime via brpc /flags.
- balance_region_default_store_region_size: new int64 gflag that overrides
  the config file value when > 0 (0 keeps the config-file semantics);
  ConfigHelper getter widened to int64 so overrides beyond 2GB work.
- Wire both knobs into the coordinator ControlConfig whitelist via new
  Helper::HandleInt64/HandleDoubleControlConfigVariable, mirroring the bool
  handler contract (query mode, invalid value sets is_error_occurred and
  keeps the flag, identical value sets is_already_set).
- Unit tests cover getter precedence (flag > config > built-in 256MB),
  the two handler contracts, and validator rejection of nonsense values.

Neither value is persisted: a coordinator restart falls back to the config
file / built-in default, matching every existing ControlConfig variable.
…per bound

OpenReaderAdaptor and ContextReset built iter_options with the region's
encoded range but passed a default-constructed IteratorOptions() to
NewIterator, so no iterate_upper_bound was ever set; the read loop also
never checked the upper bound. As a result an InstallSnapshot streamed
every key >= the region's start_key to the end of the CF, sending other
regions' data to the follower (region_size 0.2GB -> 426GB snapshots in
production; new replicas polluted with cross-region keys).

Pass the prepared iter_options at both call sites and add an explicit
upper-bound guard (empty-safe) in the read loop.

Verified on a 5-store local cluster:
- head-of-CF region 80001: 24,754,030 B / 938 keys -> 1,061,991 B / 237
  keys (23.3x), sst_dump shows 0 cross-region keys (was 320)
- mid-chain region 80002: 20,991,640 B, own data only (was own+2.6MB)
- CF-tail region 80005: 1,977,970 B, byte-identical before/after
  (no self-truncation)
HandleInt64/HandleDoubleControlConfigVariable assigned the gflag variable
directly, which gflags documents as bypassing registered validators: only
command-line parsing and SetCommandLineOption run them. The brpc /flags
path was therefore guarded while the coordinator ControlConfig RPC could
inject values the validators exist to reject -- strtod happily parses
"0", "-3", "inf" and "nan" for balance_region_limit_score_diff (NaN
defeats the score-diff comparison, +inf silently disables balancing) and
strtoll accepts negative sizes for
balance_region_default_store_region_size.

Apply values through google::SetCommandLineOption so validators run and
unknown flag names are reported instead of silently mutating the passed
variable; reject non-finite doubles up front for a clear error; tighten
ValidatePositiveDouble with std::isfinite since "inf" > 0 would pass it.

Tests: RPC-path rejection cases for 0/-3/inf/-inf/nan/nan(123)/-1 and an
unknown-flag case (all red before this fix -- the injected NaN even
leaked into later DynamicGflagsTest runs); /flags-path inf/nan cases for
the tightened validator.
ad175ae3 said "Remove useless log" but only commented the two lines out;
delete them for real. No behavior change -- time_info and perf summary
population are untouched.

@yuhaijun999 yuhaijun999 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@yuhaijun999
yuhaijun999 added this pull request to the merge queue Sep 1, 2026
Merged via the queue into dingodb:main with commit 232db17 Sep 1, 2026
2 of 4 checks passed
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