Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
1fe96a1
Spec: split backfill by date, pack message-ids, seal files into blobs…
xbmc4lyfe Oct 5, 2026
384ca8f
Plan: split backfill, packed message-ids, sealed blobs, auto compact
xbmc4lyfe Oct 5, 2026
e8277c6
Spread groups over servers, bigger header requests
xbmc4lyfe Oct 5, 2026
538ac99
Ignore .worktrees
xbmc4lyfe Oct 5, 2026
60fee3b
Ignore .superpowers scratch
xbmc4lyfe Oct 5, 2026
a7f4dff
Find the article posted at a time by binary search
xbmc4lyfe Oct 5, 2026
a43a2c0
Day chunks of backfill in the main database
xbmc4lyfe Oct 5, 2026
2f2e187
Fix: make claim atomic, wrap add in transaction, add doc comments
xbmc4lyfe Oct 5, 2026
4b19f73
Index one day chunk of a group on one server
xbmc4lyfe Oct 5, 2026
4b73578
Split big groups' backfill into day chunks across servers
xbmc4lyfe Oct 5, 2026
59ce566
Probe split servers without moving groups, back off chunk errors
xbmc4lyfe Oct 5, 2026
c60947e
Backfill page shows day chunk progress of split groups
xbmc4lyfe Oct 5, 2026
700a2af
Fix: use aggregate query for split group chunk stats instead of N+1
xbmc4lyfe Oct 5, 2026
e668f5b
Pack message-id locals by alphabet
xbmc4lyfe Oct 5, 2026
1fd874f
Compressed per-file segment blob codec
xbmc4lyfe Oct 5, 2026
358e267
Fix blob encode doc: whole file articles sort first
xbmc4lyfe Oct 5, 2026
e4f9edd
Seal a file's articles into one blob; reads and late articles see it
xbmc4lyfe Oct 5, 2026
a9d365d
Seal fixes: one snapshot for NZB reads, sealable walks by scanned files
xbmc4lyfe Oct 5, 2026
6459f6a
Shard writers seal due files between transactions
xbmc4lyfe Oct 5, 2026
3505b7e
Seal ticks: skip files that fail, time budget, ack before sealing
xbmc4lyfe Oct 5, 2026
f505308
Compact re-encodes locals and seals due files
xbmc4lyfe Oct 5, 2026
6fe0dac
auto_run_compact: compact every 24 hours from the indexer
xbmc4lyfe Oct 5, 2026
19972c7
Auto compaction honors stop, joins writers first, keeps the start time
xbmc4lyfe Oct 5, 2026
1a8b277
Document split backfill, sealed files, packed message-ids, auto_run_c…
xbmc4lyfe Oct 5, 2026
ad0f171
README: tighten split backfill, sealing and compaction wording
xbmc4lyfe Oct 5, 2026
6e0f770
Date search skips missing numbers forward instead of guessing left
xbmc4lyfe Oct 5, 2026
6f112d4
Writers seal what their saves completed, walk for stale files once a …
xbmc4lyfe Oct 5, 2026
3d7f317
Stopping skips sealing and drops slices nobody waits for
xbmc4lyfe Oct 5, 2026
6a5a776
Idle workers only take chunks of tracked groups in a backfilling mode
xbmc4lyfe Oct 5, 2026
e45868f
Menu writes wait while the database is being compacted
xbmc4lyfe Oct 5, 2026
1dbb145
Keep split days between 2000-01-01 and today
xbmc4lyfe Oct 5, 2026
e939e46
Compaction checks every rewritten message-id against the original
xbmc4lyfe Oct 5, 2026
156c59a
A failing day chunk returns its own error, not a failed release
xbmc4lyfe Oct 5, 2026
e4d5b54
Self-review: clamp survives a pre-2000 clock, writers never seal lega…
xbmc4lyfe Oct 5, 2026
c727bc8
Date search finds the first article after a hole, not one past it
xbmc4lyfe Oct 5, 2026
26c5a97
Days a server doesnt keep go back for a server that has them
xbmc4lyfe Oct 5, 2026
3cc24d6
README: days past a server's retention go to another server
xbmc4lyfe Oct 5, 2026
39fc0c5
Date search reads the span a bisect skipped
xbmc4lyfe Oct 5, 2026
86fea56
A server that goes down only moves its own groups
xbmc4lyfe Oct 5, 2026
b070409
Only a chunk's current claim finishes or gives it back
xbmc4lyfe Oct 5, 2026
321e8ed
Chunks done in the last hour count by when they finished
xbmc4lyfe Oct 5, 2026
c28a052
Compaction and menu writes share a real lock
xbmc4lyfe Oct 5, 2026
b480b26
A save that rolls back takes its new domains with it
xbmc4lyfe Oct 5, 2026
e15cf77
The indexer holds off compaction while it indexes
xbmc4lyfe Oct 5, 2026
8c062a9
Only the server going back furthest does a split's oldest day
xbmc4lyfe Oct 5, 2026
6b4b47d
A chunk dropped by stopping is given back right away
xbmc4lyfe Oct 5, 2026
1baafc7
auto_run_compact applies on config reload
xbmc4lyfe Oct 5, 2026
c60c9e3
A cap on headers fetched and not saved yet, over every pass
xbmc4lyfe Oct 5, 2026
5edbd1c
Name lookups go to the least busy server
xbmc4lyfe Oct 5, 2026
664abfb
420 No Articles Selected is an empty range, like 423
xbmc4lyfe Oct 5, 2026
b4444ca
A test that saving keeps nothing per header
xbmc4lyfe Oct 6, 2026
7fc321b
A compaction cut short mid swap gets its original back
xbmc4lyfe Oct 6, 2026
d64a8b7
A split finds each carrier's oldest article across gaps
xbmc4lyfe Oct 6, 2026
7291a6e
The deepest server is forgotten once it drops the group
xbmc4lyfe Oct 6, 2026
974226d
The date search reads the numbers its spread out windows stepped over
xbmc4lyfe Oct 6, 2026
3a991e9
Header requests are cut down to the unsaved budget
xbmc4lyfe Oct 6, 2026
94eb9dd
An idle writer still seals what comes due
xbmc4lyfe Oct 6, 2026
c383c4d
A split group reaches back when a server goes back further
xbmc4lyfe Oct 6, 2026
68c53dd
A broken config.json is reported as broken, not missing
xbmc4lyfe Oct 6, 2026
882fc8f
The wipe removes every shard along with the main database
xbmc4lyfe Oct 6, 2026
8bcd03d
A config.json whose root isnt an object is reported, not set up over
xbmc4lyfe Oct 6, 2026
44a8927
A test that the date search holds a bounded number of headers
xbmc4lyfe Oct 6, 2026
eef60ab
The date search reads at most 6,400 rows of any listing
xbmc4lyfe Oct 6, 2026
1ef382a
A test for articles found only between spread out windows
xbmc4lyfe Oct 6, 2026
9fb93be
A range is empty only once what its windows stepped over is read too
xbmc4lyfe Oct 6, 2026
7d9200a
A test for a split whose oldest day a server comes to keep more of
xbmc4lyfe Oct 6, 2026
e0aab0c
A shard next to its precompact backup refuses writes till one is removed
xbmc4lyfe Oct 6, 2026
3b54f03
A split's oldest day is redone when a server keeps more of that day
xbmc4lyfe Oct 6, 2026
bbf0fac
Merge branch 'date-search-bounded' into sdd/faster-backfill
xbmc4lyfe Oct 6, 2026
55770fd
Files with more than 50,000 segment rows never seal into a blob
xbmc4lyfe Oct 6, 2026
c1f8cd0
A claimed oldest day is reset when a server reaches further into it
xbmc4lyfe Oct 6, 2026
2ac9286
The Backfill page follows a split group's chunks, not its frozen cursor
xbmc4lyfe Oct 6, 2026
919a0be
What a server keeps of a group is remembered by its host, not its poo…
xbmc4lyfe Oct 6, 2026
9f305b6
A split reaches back from its newest chunk, not its frozen cursor
xbmc4lyfe Oct 6, 2026
2d3a23d
The deepest server is forgotten once it no longer keeps the oldest day
xbmc4lyfe Oct 6, 2026
40587cd
A conversion has the database to itself for its whole run
xbmc4lyfe Oct 6, 2026
cbbe800
The wipe removes the main database only after every shard
xbmc4lyfe Oct 6, 2026
8e8c734
A split isnt made from post dates that make no sense
xbmc4lyfe Oct 6, 2026
5449c48
The indexer converts at start under the exclusive lock too
xbmc4lyfe Oct 6, 2026
271bcb8
A split is refused when its newest day is before its oldest
xbmc4lyfe Oct 6, 2026
d3d1010
A used main database with no shard is not a new install
xbmc4lyfe Oct 6, 2026
e145b6f
The dashboard's db size counts the shards too
xbmc4lyfe Oct 6, 2026
4a9f80c
The sealed cache holds a bounded number of decoded segments
xbmc4lyfe Oct 6, 2026
657acec
The small-budget cap test runs four passes, not sixteen
xbmc4lyfe Oct 6, 2026
9045d16
Forged Dates dont make a day chunk miss the day's posts
xbmc4lyfe Oct 6, 2026
1aa995d
A compaction's backup keeps its WAL, and a checkpoint held back is re…
xbmc4lyfe Oct 6, 2026
f748dcb
The sealed cache lets its least recently used file go, and a save dec…
xbmc4lyfe Oct 6, 2026
fe27860
A day chunk's range ends where the next day's starts, soo no post is …
xbmc4lyfe Oct 6, 2026
7a8dfee
Shards without their main database are refused, not adopted
xbmc4lyfe Oct 6, 2026
1288a5d
A row a full blob already has is dropped before the blob is counted
xbmc4lyfe Oct 6, 2026
444e66b
A conversion's swap refuses a held back checkpoint, and atlas.old.db …
xbmc4lyfe Oct 6, 2026
2858351
Compaction drops a loose row its file's blob already has
xbmc4lyfe Oct 6, 2026
cfe1640
A max_unsaved_headers past the pool's limit doesnt restart the indexe…
xbmc4lyfe Oct 6, 2026
8cfa93d
A server's retention is judged from its first windows, and old days a…
xbmc4lyfe Oct 6, 2026
fc1f14d
A day chunk reaches 5,000 numbers past each end for neighbours done e…
xbmc4lyfe Oct 6, 2026
f9cae07
A stopped conversion only resumes from a copy of the same old database
xbmc4lyfe Oct 6, 2026
5e7ccca
A conversion's swap cut short between its renames is finished or undo…
xbmc4lyfe Oct 6, 2026
7d54218
A split group's home backfill sweeps on for what its day chunks missed
xbmc4lyfe Oct 6, 2026
3c23875
Every carrier of a split group sweeps its own numbers once the chunks…
xbmc4lyfe Oct 6, 2026
c1c608d
A split group's sweep waits only for its own day chunks
xbmc4lyfe Oct 6, 2026
06d12fb
A stopped conversion copies again when only the old cursors moved
xbmc4lyfe Oct 6, 2026
532c176
Dropping a fallback copy takes it out of the release and shard totals
xbmc4lyfe Oct 6, 2026
520f3d8
A carrier's sweep cursor doesnt count as a second home in the split h…
xbmc4lyfe Oct 6, 2026
e163025
Reaching a split back undoes its carriers' sweeps
xbmc4lyfe Oct 6, 2026
e867337
Wiping the database takes a conversion's old and new main databases too
xbmc4lyfe Oct 6, 2026
cf19e37
A group never falls over to a server kept out of indexing
xbmc4lyfe Oct 6, 2026
ac50239
A due sweep comes before other split groups' day chunks
xbmc4lyfe Oct 6, 2026
41e0e41
Days before every server's first post are dropped from a split
xbmc4lyfe Oct 6, 2026
b016b68
A server not carrying a group stays noted as such, so its first-post …
xbmc4lyfe Oct 6, 2026
5f8356e
A file with a message-id too long for a blob stays rows, and a blob a…
xbmc4lyfe Oct 6, 2026
8550b70
Servers sharing a host are named by host:port (and user) in cursors, …
xbmc4lyfe Oct 6, 2026
6cb88a2
A converted shard is made durable before it is marked copied
xbmc4lyfe Oct 6, 2026
ff7c90b
A split's days older than any other server goes back stop once one ha…
xbmc4lyfe Oct 6, 2026
3916d40
A lost atlas.db after a finished conversion doesnt bring the old data…
xbmc4lyfe Oct 6, 2026
646efc5
A conversion keeps a release's shard per release, not a byte per id u…
xbmc4lyfe Oct 6, 2026
75aa13f
A server's key comes from its own settings, and cursors under an olde…
xbmc4lyfe Oct 6, 2026
82fba25
Only a window of the days one server alone has is chunks at once, ext…
xbmc4lyfe Oct 6, 2026
e499147
Reaching back keeps to the speculative window, kept in the database
xbmc4lyfe Oct 6, 2026
c665286
Each window of the days one server alone has meets the yield on its own
xbmc4lyfe Oct 6, 2026
bb8f1f4
A plain 119 and an ssl 563 on one host are two servers with two keys
xbmc4lyfe Oct 6, 2026
6907158
Domain use is counted for the ids present, not for every id up to the…
xbmc4lyfe Oct 6, 2026
bf2e8f8
Purging broken releases takes what it deleted off the totals inside i…
xbmc4lyfe Oct 6, 2026
75ddd9a
A due recovery sweep is taken before a worker's normal groups, soo bu…
xbmc4lyfe Oct 6, 2026
3727fbe
A release saved again with no parts yet is counted once, found by the…
xbmc4lyfe Oct 6, 2026
6c8b621
A sealed segment whose message-id outgrows a blob's bound when its do…
xbmc4lyfe Oct 6, 2026
1fb36fa
A stopped conversion resumes only for the same old database: its own …
xbmc4lyfe Oct 6, 2026
b9ac720
A worker that just swept takes a due group of its own next, so a lone…
xbmc4lyfe Oct 6, 2026
b0a16d8
A late row is a copy of a blob's segment by its message-id, stored wh…
xbmc4lyfe Oct 6, 2026
dff0a0f
A successful atlas --compact notes last_compact, so auto compaction w…
xbmc4lyfe Oct 6, 2026
1c48c57
A spilled blob segment and its loose duplicate are one row in compact…
xbmc4lyfe Oct 6, 2026
0a3b553
A loose copy in the streamed tail of a big file is dropped like one i…
xbmc4lyfe Oct 6, 2026
acf80ce
A chunk claim taken over leaves the speculative window and older days…
xbmc4lyfe Oct 6, 2026
fcff8ca
--convert finishes a swap cut short instead of saying there is nothin…
xbmc4lyfe Oct 6, 2026
850e60e
A fallback copy of a sealed article doesnt leave its file's parts or …
xbmc4lyfe Oct 6, 2026
2a7e0f7
atlas --compact refuses shards whose main database is missing instead…
xbmc4lyfe Oct 6, 2026
f5414bc
A new article past the decode budget has its totals and subject held …
xbmc4lyfe Oct 6, 2026
ae69130
Compaction dropping fallback copies works their file's parts and rele…
xbmc4lyfe Oct 6, 2026
e47daf8
Compacting a shard from before sealing gives it the held_back table f…
xbmc4lyfe Oct 6, 2026
d9c60df
Compaction dedups a huge file's streamed tail against the copy, not a…
xbmc4lyfe Oct 6, 2026
e560f61
A file too big to seal still gets what it held back settled by the se…
xbmc4lyfe Oct 6, 2026
c53984c
A message-id already under another file of its release isnt saved again
xbmc4lyfe Oct 6, 2026
ebc381f
A release with more files checks a new article against them all with …
xbmc4lyfe Oct 6, 2026
9d7499d
Compaction streams a file's held back entries and keeps the release i…
xbmc4lyfe Oct 6, 2026
50afe4f
Indexing a release streams a file's loose rows instead of collecting …
xbmc4lyfe Oct 6, 2026
ba29ba2
A server's explicit key keeps its case in the cursor key
xbmc4lyfe Oct 6, 2026
0df0948
Compaction checks the stop flag while it streams a file's held back e…
xbmc4lyfe Oct 6, 2026
bbf6b0e
A subject claiming a part past its file's total or past MAX_PARTS is …
xbmc4lyfe Oct 6, 2026
b3e731c
The held back stop hook is removed by a guard when its test ends
xbmc4lyfe Oct 6, 2026
e4b2942
Compaction checks the stop flag every STOP_EVERY rows of a file's tai…
xbmc4lyfe Oct 6, 2026
0f39c80
A sweep chosen before the split reached back isnt noted done after it
xbmc4lyfe Oct 6, 2026
4021482
A speculative window is judged when its last day is done, and a windo…
xbmc4lyfe Oct 6, 2026
781cca5
The forged daily split test forges six years of days, not 26, and wai…
xbmc4lyfe Oct 6, 2026
6c3cad0
Compaction counts each domain's uses in a database file of its own, n…
xbmc4lyfe Oct 6, 2026
5084425
A lone server with an explicit key keeps its cursors under that key
xbmc4lyfe Oct 6, 2026
bb7199a
The compaction check compares a sample of releases by a digest of the…
xbmc4lyfe Oct 6, 2026
561c277
The domain count lets go of the original shard before the swap rename…
xbmc4lyfe Oct 6, 2026
4bae787
A wipe takes a compaction's scratch databases too, the domain counts …
xbmc4lyfe Oct 6, 2026
05be498
The plain cursors go only to the server that kept them, recorded whil…
xbmc4lyfe Oct 6, 2026
929c37f
A copies only file that goes takes the release's index with it once o…
xbmc4lyfe Oct 6, 2026
f7a771f
Opening the main database never makes one, and an empty one made in a…
xbmc4lyfe Oct 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ atlas.db-*
# the shards, and files the conversion and compaction leave while they run
atlas.*.db
atlas.*.db-*
atlas.compacting
status.json
stats.json
*.json.tmp
Expand All @@ -66,3 +67,7 @@ __pycache__/
*.pyc
mock_nntp_server.py
dev_nntp_server.py

# git worktrees for isolated work
/.worktrees/
/.superpowers/
43 changes: 42 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ getrandom = "0.3"
indexmap = "2"
ratatui = "0.30"
regex = "1"
rusqlite = { version = "0.40", features = ["bundled"] }
rusqlite = { version = "0.40", features = ["bundled", "hooks"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12", "logging"] }
rustyline = "18"
serde = { version = "1", features = ["derive"] }
Expand All @@ -35,6 +35,7 @@ unicode-width = "0.2"
ureq = { version = "3", default-features = false, features = ["json", "rustls"] }
webbrowser = "1"
webpki-roots = "1"
zstd = "0.13"

[target.'cfg(unix)'.dependencies]
signal-hook = "0.4"
Expand Down
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ On first run, Atlas asks for one server (host, username, password, and port) and
"group": "alt.binaries.example",
"groups": ["alt.binaries.example", "alt.binaries.another"],
"index_mode": "dynamic",
"batch_size": 50000,
"request_size": 1000,
"batch_size": 500000,
"request_size": 10000,
"parallel_groups": 20,
"api_host": "0.0.0.0",
"api_port": 9090,
Expand All @@ -132,12 +132,15 @@ On first run, Atlas asks for one server (host, username, password, and port) and
| `groups` | `[]` | Newsgroups to index. Add them from the Groups menu or edit the list. |
| `group` | | The current group, used by the menu's current-group search. |
| `index_mode` | `dynamic` | `dynamic` alternates backfill and live passes, `backfill` indexes older posts only, and `live` indexes new posts only. |
| `batch_size` | `50000` | Article numbers per indexing pass over a group. The cursor moves only after a whole pass finishes. |
| `request_size` | `1000` | Article numbers per header request, which is one connection's slice of a pass. |
| `batch_size` | `500000` | Article numbers per indexing pass over a group. The cursor moves only after a whole pass finishes. |
| `request_size` | `10000` | Article numbers per header request, which is one connection's slice of a pass. Providers spend most of a request's time on their side, so on old articles 10,000 per request is 3–6 times faster per connection than 1,000. |
| `parallel_groups` | 1 per 5 connections | Total groups indexed at the same time, shared between servers by their `connections`. Every server gets at least one. |
| `api_host` | `127.0.0.1` | Address the Newznab API listens on. Use `0.0.0.0` to reach it from other machines. |
| `api_port` | `9090` | Newznab API port. |
| `api_key` | generated | Newznab API key. Atlas creates it on first start and stores it here. |
| `split_min_backlog` | `10000000` | Article numbers of backfill left before a group's backfill is split into day chunks that every server carrying the group can take. |
| `auto_run_compact` | `false` | Compact the database every 24 hours; indexing pauses while it runs. |
| `max_unsaved_headers` | `500000` | Headers the indexer fetches ahead of saving them, over all groups at once. This bounds its memory: 500,000 headers take about 0.3 GB. A header request waits for room before it goes out, and its room comes back once its slice is saved. Raise it if the Bottleneck page shows it full while the database writers and connections have time to spare. Set below `request_size`, header requests are cut down to it, which makes them small and slow. |

Atlas keeps any other keys you add to the file when it saves it.

Expand All @@ -150,17 +153,18 @@ Atlas keeps any other keys you add to the file when it saves it.
| `port` | `563` | `563` is SSL and `119` is plain text. |
| `ssl` | from the port | Forces SSL on or off. |
| `connections` | `10` | Requests Atlas keeps in flight on this server at once. Set it to what your plan allows. See [Measure connection limits](#measure-connection-limits). |
| `priority` | `99` | Atlas asks servers with lower values first when it looks up par2 and nfo articles. Servers with equal priority keep their order in the file. |
| `priority` | `99` | Order of the servers for failover and for par2 and nfo lookups among equally busy servers. Lower values come first. Servers with equal priority keep their order in the file. |
| `index` | `true` | Whether the server takes part in indexing. `false` keeps it for article lookups only, for example a block account whose data you don't want to spend on headers. |
| `compress` | `true` | Requests gzip-compressed header listings. Servers without compression get plain requests, and Atlas turns compression off for a server that sends unreadable data. |
| `key` | | Sets the server apart in Atlas's stored progress (cursors, day chunks, sweeps). Atlas names a server by its host, plus `:port` when the port isn't the default for its SSL setting, and adds `#key` when this is set. Adding or removing other servers never changes the name. Set it only for a second account on the same host and port whose provider numbers articles differently; otherwise both share one progress. |

The old single-server layout, with `host`, `username`, `password`, and `port` at the top level, still works and becomes a one-server list.

### How Atlas uses the servers

- **Indexing uses every server at once, whatever its priority.** Atlas spreads groups over the indexing servers in proportion to their `connections`, and each server runs its own groups, so all connections stay busy. Each group stays on one server, because article numbers, and therefore the indexing cursors, differ between providers.
- **Indexing uses every server at once, whatever its priority.** Atlas spreads groups over the indexing servers in proportion to their `connections`, and each server runs its own groups, so all connections stay busy. Each group stays on one server, because article numbers, and therefore the indexing cursors, differ between providers. A server that stops answering hands only its own groups to the others for a while.
- **A group that a server doesn't carry:** Atlas looks it up on the other servers.
- **par2 and nfo articles:** Atlas asks the servers in priority order until one has them.
- **par2 and nfo articles:** Atlas asks the least busy indexing server first, so lookups don't all queue on one server. If it doesn't have the article, Atlas asks the other indexing servers from least to most busy, and then the remaining servers, such as those with `index: false`, in priority order.
- **A server that can't connect:** Atlas skips it for a minute and moves its groups to the other servers. When a group moves, its cursor on the new server starts from the top. Atlas re-scans those articles but de-duplicates them, so it doesn't store anything twice.

Atlas also handles these provider quirks on its own:
Expand All @@ -173,8 +177,8 @@ Atlas also handles these provider quirks on its own:

The background indexer reads `config.json` again every 5 seconds:

- New groups, `index_mode`, `batch_size`, and `request_size` apply immediately.
- Changes to servers, logins, `connections`, or `parallel_groups` rebuild the connection pool. A login you fix in the file, or in **Settings > Usenet servers**, takes effect within a few seconds.
- New groups, `index_mode`, `batch_size`, `request_size`, and `auto_run_compact` apply immediately.
- Changes to servers, logins, `connections`, `parallel_groups`, or `max_unsaved_headers` rebuild the connection pool. A login you fix in the file, or in **Settings > Usenet servers**, takes effect within a few seconds.
- `api_host` and `api_port` apply when the API restarts. Restart Atlas, or use **Settings > Change API port**.

### Measure connection limits
Expand Down Expand Up @@ -235,11 +239,17 @@ Start the indexer from the main menu with option 1. The indexer runs as a backgr
| `backfill` | Indexes backward from the newest article only. |
| `live` | Indexes forward from the newest article only and ignores older posts. |

### Splitting big groups

When two or more indexing servers carry a group and its backfill has more than `split_min_backlog` article numbers left, Atlas splits the rest of its history into UTC day chunks. A worker with nothing of its own to do claims the newest pending chunk on any server that carries the group, so idle connections help with big groups. A server that doesn't keep a day from its start, because its retention is shorter, gives the chunk back for a server that does. No server keeps the oldest day of the split from its start; the server that goes back furthest on it indexes what there is. Every hour, and when the indexer starts, Atlas checks whether a server now goes back further, for example one you added. If one does, the older days get chunks too, and the old oldest day is done again in full. Live indexing stays on the group's home server. The Backfill page of the stats dashboard shows split groups and their day chunks.

### How the database is stored

Atlas splits releases and their articles over 8 database files next to `atlas.db`, named `atlas.s0.db` to `atlas.s7.db`, by group. Each file has its own writer thread, so the 8 save in parallel, and slices that arrive while a writer is busy are saved together in one transaction. `atlas.db` keeps the per-group cursors.

Articles are stored compactly, at about a quarter of the space of the old layout: each file of a release is stored once with the subject its NZB uses, and each article is a short row with its message ID, part number, and size. Message IDs share their domain and store hex IDs as bytes. NZBs come out exactly as before.
Articles are stored compactly, at about a quarter of the space of the old layout: each file of a release is stored once with the subject its NZB uses, and each article is a short row with its message ID, part number, and size. Message ID locals are packed by alphabet using specialized encodings (hex at half the size for hexadecimal locals, base-N encoding for other alphabets), and domains are shared. NZBs come out exactly as before.

Atlas seals each file that is complete, or untouched for three days, into one zstd-compressed blob, which takes far less space than its article rows. Each shard writer seals the files its own saves completed between saves, up to 2,000 files or 100 milliseconds at a time, and looks through its shard for files untouched for three days once a minute. Writers leave files from before the upgrade alone; the first `--compact` seals those. Articles that arrive after a file is sealed are stored as rows and merged into its NZB. The `--compact` command seals every file that's due and re-encodes message IDs across the whole database.

A release ID tells Atlas which file holds the release, and IDs keep counting up across all 8 files in the order releases are added, so the newest releases still come first.

Expand All @@ -252,10 +262,16 @@ The first time the new indexer starts on a database from an older version, it co
3. It checks a sample of releases: their NZBs, sizes, part counts, and completeness must come out the same as from the old database.
4. Only then does it swap the files. The old database stays as `atlas.old.db`; delete it once you're happy.

The menu shows the progress meanwhile, and searches don't work until the conversion finishes. On a 488 GB database it takes about 1.5 hours. If anything fails, Atlas leaves the old database as it was and tries again on the next start. To convert in the foreground instead, stop indexing and run `atlas --convert`.
The menu shows the progress meanwhile, and searches don't work until the conversion finishes. On a 488 GB database it takes about 1.5 hours. If anything fails, Atlas leaves the old database as it was and tries again on the next start. To convert in the foreground instead, stop indexing and run `atlas --convert`. It refuses to start while the indexer, a compaction or another `--convert` is using the database.

Release IDs change in the conversion, so NZB links that Prowlarr or your apps saved before it no longer work. Search again to get the new ones.

### Compacting a database

The `--compact` command rewrites every shard into a fresh database file while the indexer is stopped. It re-encodes message IDs with the current packing and seals every file that's due. The copy has no free space in it. Expect the first compaction to shrink the database a lot, roughly from 138 GB to 60 GB on a full database. Atlas checks each shard's copy before it replaces the original. If a shard fails, Atlas keeps its original and reports the error; the other shards are still compacted.

With `auto_run_compact` set to `true`, the indexer compacts the database every 24 hours. Indexing pauses while it runs and resumes afterward. Stopping the indexer during a compaction stops it within seconds and keeps the originals of unfinished shards. A failed shard is tried again 24 hours later. While a compaction runs, it holds a lock on the `atlas.compacting` file next to `atlas.db`, and the indexer, the menu's AI search saves and the broken release purge refuse to run until it's done. A compaction doesn't start while the indexer runs (outside its own auto compaction), while one of those is saving, or while another compaction runs; auto compaction then tries again 10 minutes later. The lock goes away with the process that holds it, so a crash leaves nothing to clean up (the file itself stays). A crash in the middle of swapping a shard can leave its original moved aside as `atlas.sN.precompact.db` with nothing in its place. The next start of atlas, the indexer or a compaction puts it back (and removes the half swapped copy), taking the lock first. A shard that is missing with no backup next to it, while the other shards are there, stops atlas from starting instead of being made again empty; put it back first. A shard with an `atlas.sN.precompact.db` next to it, when it isn't known which of the two is whole (the crash may have come after the copy went in, or an older atlas made an empty shard beside the backup), is not touched: the menu still opens, but the indexer, AI search saves and purging refuse to write, and the message names both files and how to go on (keep the shard and delete the backup, or the other way round).

A group that has caught up rests for 10 seconds before Atlas checks it again. Atlas parks a group that fails 3 times in a row for 5 minutes.

Stopping the indexer takes about a second. Atlas drops any requests still in flight and closes their connections instead of reusing them. A pass that didn't finish leaves its cursor where it was, so Atlas indexes that range again on the next start.
Expand All @@ -279,7 +295,7 @@ AI search lets you describe what you want in plain language, for example `find m
- **Usenet servers:** list, add, edit, and remove servers, including host, login, port, SSL, connections, and priority.
- **Change indexer mode:** switch between dynamic, live, and backfill.
- **Purge broken releases:** delete incomplete releases to free up space.
- **Wipe DB and cache:** clear the database, logs, status, and stats. Stop the indexer first.
- **Wipe DB and cache:** clear the database (`atlas.db` and every `atlas.sN.db` shard, with leftovers of a compaction), logs, status, and stats. Stop the indexer first; it is refused while the indexer, a compaction or a save has the database.
- **Change API port:** move the Newznab API and restart it with the current `api_host`.

## Stats dashboard
Expand Down Expand Up @@ -342,7 +358,7 @@ Names what limits indexing right now, and shows how busy each resource has been
| Database writer | Share of the time the writer thread spends saving slices, how many slices wait for it, and how many slices go into each transaction. |
| Usenet connections | Connections in use against what the providers allow, and requests waiting for a free connection. |
| CPU | Cores the indexer uses, and how many of them parse headers. |
| Memory | System memory in use. |
| Memory | System memory in use, and headers fetched but not saved yet against `max_unsaved_headers`. |
| Provider latency | How long a header request takes, and how many requests are in flight. |
| Network | Data received from the servers per second. |
| Disk | Data the indexer reads from and writes to disk per second. |
Expand Down
2 changes: 2 additions & 0 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"alt.binaries.boneless"
],
"index_mode": "backfill",
"auto_run_compact": false,
"max_unsaved_headers": 500000,
"api_port": 9090,
"api_host": "0.0.0.0"
}
Loading
Loading