Range commands
The nova commands that show a scalable stream's ranges and ask Nova to split or merge them.
A scalable stream spreads its records over ranges. Each range owns a span
of a 32-bit hash ring, holds the records whose routing key hashes into it, and
has its own leader. Nova splits a busy range on its own. These commands show
the ranges and let you split or merge them by hand, for example before a
known burst. They are admin commands. They need a host:port address in
--addr or NOVA_ADDR, and a credential that holds nova:admin. Over HTTP
they fail with the admin plane is wire-only, and with a bucket token they
fail with admin verb requires the nova:admin marker.
export NOVA_ADDR=localhost:7781
nova stream create nova://demo/clicks --kind scalable --initial-ranges 2| Command | Does |
|---|---|
nova stream ranges | Prints a stream's ranges, with each range's leader and size |
nova stream split | Asks for one open range to be cut in two |
nova stream merge | Asks for adjacent open ranges to be joined into one |
A split or a merge is a request. The command returns once Nova accepts it.
Nova then makes the change in the background, usually within about 30
seconds. Run nova stream ranges to see the new map.
nova stream ranges
Prints a stream's range map: one row per range, open and sealed.
nova stream ranges [options] <nova://bucket/key>Show a scalable stream's ranges
After six appends, on a cluster of four nodes:
nova stream ranges nova://demo/clicksmap version 1, 2 of 256 entries
ID ORDINAL SPAN STATE HOLDER FRONTIER RETAINED
01a2048a-626b-7bee-bb1a-b3547c4ef4d7 0 [0, 2147483648) open 01a20489-a8d4-7a8b-b0e9-794da77a3afc 5 135
01a2048a-626b-7bf2-840a-ac023a624d19 1 [2147483648, 4294967296) open 01a20489-bc94-7470-be26-5fe92cdda479 1 27Show a plain stream
A plain stream is one range that covers the whole ring:
nova stream ranges nova://demo/ordersplain stream, 1 entry
ID ORDINAL SPAN STATE HOLDER FRONTIER RETAINED
01a2048a-5fb2-7cec-b8f3-1156c83e24aa 0 [0, 4294967296) open - 0 0The first line is the map's version, which every split or merge raises, and how many of the 256 allowed entries the map uses. Sealed ranges that still hold records count toward the 256.
| Column | Shows |
|---|---|
ID | The range's ID, which split and merge take |
ORDINAL | The range's place in the order Nova uses to spread leaders over nodes, fixed when the range is created |
SPAN | The hashes the range owns, from the first up to, but not including, the second |
STATE | open, or sealed@N once a split or merge closed it. N is one past its last record |
HOLDER | The node that leads the range now, or - when no node does |
FRONTIER | One past the last record that is durable in object storage |
RETAINED | Bytes the range still stores |
The command prints this table even with --output json.
The concept is Keys and ranges. The Go SDK's admin client lists ranges too. See Split and merge ranges. The HTTP API has no range routes.
nova stream split
Asks for one open range of a scalable stream to be cut in two.
nova stream split [options] <nova://bucket/key>Split a range at its midpoint
nova stream split nova://demo/clicks --range 01a2048a-626b-7bee-bb1a-b3547c4ef4d7split accepted at map version 1; the auditor performs itOnce Nova has made the change, the map has a new version:
nova stream ranges nova://demo/clicksmap version 2, 4 of 256 entries
ID ORDINAL SPAN STATE HOLDER FRONTIER RETAINED
01a2048a-626b-7bee-bb1a-b3547c4ef4d7 0 [0, 2147483648) sealed@5 - 5 135
01a2048a-626b-7bf2-840a-ac023a624d19 1 [2147483648, 4294967296) open 01a20489-bc94-7470-be26-5fe92cdda479 1 27
587e347b-3e86-555b-ae81-265909ddaa48 0 [0, 1073741824) open - 0 0
e922cb92-69d8-5394-bb36-0a6dbfdfccb9 2 [1073741824, 2147483648) open - 0 0The parent is sealed at its tail, 5, and keeps its records for readers. Its two children split its span between them and take new appends.
--point picks where to cut, as a hash inside the range's span. Without it,
the cut is at the middle. A plain stream fails with
nova: client: entry too large: admin: demo/orders is not a scalable stream
and exit code 1. Nova refuses a split that would take the map past 256
entries.
The concept is Scalable streams. The same task is Split and merge ranges with the Go SDK. The HTTP API has no range routes.
nova stream merge
Asks for two or more adjacent open ranges of a scalable stream to be joined into one.
nova stream merge [options] <nova://bucket/key>Merge two ranges
nova stream merge nova://demo/clicks --ranges 587e347b-3e86-555b-ae81-265909ddaa48,e922cb92-69d8-5394-bb36-0a6dbfdfccb9merge accepted at map version 3; the auditor performs itOnce Nova has made the change, both ranges are sealed and one new range owns their spans:
map version 4, 7 of 256 entries
ID ORDINAL SPAN STATE HOLDER FRONTIER RETAINED
01a2048a-626b-7bee-bb1a-b3547c4ef4d7 0 [0, 2147483648) sealed@5 - 5 135
01a2048a-626b-7bf2-840a-ac023a624d19 1 [2147483648, 4294967296) sealed@1 - 1 27
587e347b-3e86-555b-ae81-265909ddaa48 0 [0, 1073741824) sealed@0 - 0 0
e922cb92-69d8-5394-bb36-0a6dbfdfccb9 2 [1073741824, 2147483648) sealed@0 - 0 0
b7a83554-14d9-5c1b-bb69-4653cde720e8 1 [2147483648, 3221225472) open - 0 0
4807fbad-b541-588d-8764-25d809b67ed7 3 [3221225472, 4294967296) open - 0 0
b400e176-2315-54b2-9bab-ae542ad2fd6c 0 [0, 2147483648) open - 0 0This map went through two changes after the split listing above. First, the
second original range, 01a2048a-626b-7bf2-…, was split too, at version 3.
That is why it is sealed, and why its children b7a83554… and 4807fbad…
own its span. Then the merge, at version 4, sealed 587e347b… and
e922cb92… and opened b400e176…, which owns their joined span
[0, 2147483648).
Nova refuses a merge that names a sealed range:
nova: merge refused at map version 4: range 587e347b-3e86-555b-ae81-265909ddaa48 is sealedNaming one range fails with nova: a merge names two or more sibling ranges.
Both refusals exit 1. Nova also merges idle ranges on its own; see
Keys and ranges.
The concept is Scalable streams. The same task is Split and merge ranges with the Go SDK. The HTTP API has no range routes.
The concept is Scalable streams.