# Bucket locality does not imply hierarchy locality

Hesela constructed arithmetic, 26 October 2026. No empirical data or Ceph
execution. The original CRUSH paper already describes the hierarchy effect;
this is an explanatory counterexample, not a new algorithmic discovery.

## Reproduce

Run with Node.js (validated version recorded in the session checkpoint):

```sh
node model.mjs
node --test model.test.mjs
```

No dependencies, network, randomness, device access or file writes are needed.
The article calls the same buildWitness() function at build time; the command
prints its complete inputs, outputs and controls as JSON. All arithmetic
comparisons use integer cross-products; printed fractions are reduced.

## Construction and proof boundary

Root children X and Y contain leaves (A,B) and (C,D), respectively. Initial leaf
weights are all 1. Only A changes, to 3; X's aggregate weight changes from 2 to 4.
At every bucket choose the smallest fixed positive draw/weight. Draws are
root (X=3,Y=2), X (A=4,B=1), Y (C=1,D=2). Root changes Y to X while X still
selects B. The end-to-end destination changes C to B although neither leaf's
own weight changed.

At one bucket, unchanged items retain their score and their tie-breaking order.
Their relative winner cannot change. Consequently any winner change must
involve the reweighted item. A finite 3,645-case test checks small positive
integer inputs; the argument, not that finite enumeration, explains the scope.
The hierarchy changes the parent item X as well as the leaf A, so a local
property cannot be relabelled as a global leaf property.

Controls retain the original weights, freeze root weights despite A's change
(an intentionally inconsistent-weight intervention), and reverse the update.
None estimates the frequency of this witness in a hashed placement algorithm.

## Source map (accessed 2026-10-26)

- Weil, Brandt, Miller and Maltzahn, SC 2006, CRUSH: Controlled, Scalable,
  Decentralized Placement of Replicated Data, section 3.3 and Figure 3:
  https://ceph.io/assets/pdfs/weil-crush-sc06.pdf
  The paper explains why changing aggregate weights at multiple levels can
  move data to leaves other than the item responsible for the change.
- Ceph Squid CRUSH Maps, hammer/CRUSH_V4:
  https://docs.ceph.com/en/squid/rados/operations/crush-map/#hammer-crush-v4
  The straw2 remapping statement is about bucket items, not an end-to-end
  leaf migration bound. This later algorithm is not the 2006 straw design.
- Ceph v19.2.0 mapper.c, generate_exponential_distribution and
  bucket_straw2_choose:
  https://github.com/ceph/ceph/blob/v19.2.0/src/crush/mapper.c
  The implementation uses hashed inputs, a logarithm approximation and
  fixed-point weights. Our supplied positive draws and rational arithmetic
  do not execute or reproduce that code.

Verified source bytes (SHA-256, streamed from the original URLs above):
- Paper PDF: ed1ae30f9869a53843129ef47be7318137de5c7ee7b2b96653ba38eb5297f4fa
- v19.2.0 mapper.c: d320fffa1a4b4b1c2d25b1c966f928b3d5ba2636889261054177cc37c41dbef7

## Limits and reuse

One target and two levels; no replica collision, chooseleaf retry, device
eligibility filtering, weight sets, upmap, PG contents, migration scheduling
or failure process. No cluster-wide movement percentage, byte estimate,
latency or availability claim follows. Use the actual before/after maps and
supported tooling for a real deployment. No third-party source or figure is
redistributed. Original model and tests: Copyright 2026 Hesela contributors,
licensed under MIT (https://opensource.org/license/mit).

## Operator interpretation (reviewed 2026-11-07)

The freeze-ancestor control is not a model of ceph osd reweight. Squid's
[Control Commands](https://docs.ceph.com/en/squid/rados/operations/control/)
distinguish a CRUSH capacity weight from a 0-to-1 override. The latter does not
update ancestor weights. This model has no override rejection or retry logic.

The pinned mapper's get_choose_arg_weights selects an alternative weight set
by position (clamped to the last available set). get_choose_arg_ids can replace
the hash-input IDs, but bucket_straw2_choose returns bucket->h.items[high].
A substitute hash ID is not itself the selected destination. A weight-only
comparison must hold these other inputs fixed.

The original four rows and 3,645-case sweep are unchanged. They remain exact
arithmetic controls, not observed Ceph mappings or measured migration traffic.
