Skip to content

A3-3: Distributed mode config documentation and validation #152

Closed

Description

@scttfrdmn

Summary

Add input validation for cluster configuration and create docs/admin-guide/distributed.md documenting the distributed architecture, configuration reference, upgrade procedure, and cache sizing formula.

Validation Changes (internal/config/config.go)

Add these checks to the config validation pass:

Condition Error message
cluster.enabled = true AND cluster.advertise_addr = "" cluster.advertise_addr is required when cluster.enabled is true
cluster.persistent_log = true AND cluster.data_dir = "" cluster.data_dir is required when cluster.persistent_log is true
cluster.enabled = true AND len(cluster.seeds) == 0 Warning (not error): cluster.seeds is empty; node will not join an existing cluster

objectfs mount --dry-run output

When cluster.enabled = true, --dry-run prints:

Cluster config:
  enabled:        true
  node_id:        node-1
  advertise_addr: 10.0.1.1:7946
  seeds:          10.0.1.2:7946, 10.0.1.3:7946
  persistent_log: true
  data_dir:       /var/lib/objectfs/node-1

New doc: docs/admin-guide/distributed.md

Sections:

  1. Architecture overview — ASCII diagram showing gossip + Raft + FUSE data path; which layer handles what
  2. Config reference — every cluster.* field, type, default, description
  3. Upgrade procedure — in-memory → persistent log migration (rename data dir, set persistent_log = true, restart one node at a time)
  4. Cache sizing formula: cache_size_gb ≥ (hot_dataset_gb × replication_factor) / node_count; worked example
  5. Consistency modes — when does ObjectFS choose Eventual vs Session vs Strong?
  6. Limitations and roadmap — explicit list of what is NOT production-ready yet

configs/example.yaml changes

Add commented-out cluster section:

# cluster:
#   enabled: false
#   node_id: ""            # default: hostname
#   advertise_addr: ""     # required if enabled: "host:7946"
#   seeds: []              # peer addresses to join
#   persistent_log: false  # set true for production (requires data_dir)
#   data_dir: ""           # e.g. /var/lib/objectfs
#   peer_fetch_timeout: 500ms

Acceptance Criteria

  • Config validation catches advertise_addr missing with descriptive error
  • Config validation catches data_dir missing with descriptive error
  • --dry-run prints cluster section only when cluster is enabled
  • docs/admin-guide/distributed.md exists with all 6 sections
  • configs/example.yaml includes commented cluster section
  • Doc linked from README and included in mkdocs.yml nav
  • go test ./internal/config/... passes (table-driven validation tests)

Dependencies

  • Requires A3-1 (persistent_log config option)
  • Requires B1-1 (--dry-run flag for mount subcommand)

Activity

  1. added
    type: documentation
    priority: medium
    area: config
    on Apr 7, 2026
  2. added
    effort: small
    on Aug 3, 2026
  3. scttfrdmn commented on Aug 9, 2026

    @scttfrdmn
    OwnerAuthor

    Moved to v0.14.0. The validation table in this issue is written against cluster.persistent_log and cluster.data_dir, and neither key exists in ClusterConfig — zero hits across internal/config. So the work as scoped is to validate fields that would have to be added first, and the fields belong with the persistence they configure (#150/#151 landed the bbolt implementations; nothing on the mount path reaches them).

    Validation for a key that does not exist would be a test asserting that a config file is rejected for naming something ObjectFS has no concept of, which strict decoding already does generically. The useful version of this issue is: add the keys with the feature, then validate them — which is a v0.14.0 shape.

  4. scttfrdmn commented on Aug 9, 2026

    @scttfrdmn
    OwnerAuthor

    Re-checked against c47be1b now that #147 has merged. Two of the three validation rows are writable today; one is still blocked.

    Row Status
    cluster.enabled = true AND advertise_addr = "" Writable. Both fields exist on config.ClusterConfig (config.go:695,698) and nothing validates the pair — grepped, there is no advertise reference anywhere in the validation pass. This row can be implemented as specified.
    cluster.persistent_log = true AND data_dir = "" Still blocked. Neither field exists, in internal/config or internal/distributed. This was the original reason for deferral and nothing since has added them.
    cluster.enabled = true AND no seeds Writable, with a correction: the field is seed_nodes (SeedNodes), not seeds. The issue body says len(cluster.seeds) == 0; using that name in the docs would fail TestDocumentedConfigYAMLMatchesTheSchema.

    The --dry-run block in the body needs the same corrections plus one more: it shows advertise_addr: 10.0.1.1:7946 and persistent_log: true. The default ListenAddr is 0.0.0.0:8080 (internal/distributed/cluster.go:246), not port 7946 — that number appears only in test fixtures, presumably carried over from memberlist's convention — and persistent_log should come out of the example entirely until the field exists.

    Suggested rescope, so this stops waiting on a field nobody has scheduled: implement the two writable rows and the --dry-run block now, drop the persistent_log/data_dir row, and let it come back with whatever change introduces persistent logging. That is the same split #148 just got — the parts that describe real behaviour get written, the parts that describe a spec wait for the spec to become code.

    Also worth noting for distributed.md: the "cache sizing formula" this issue shares with #148 multiplies hot dataset size by replication_factor, and that factor does not mean what the formula assumes. It is a selection width — only the first node returned is used, because S3 holds the single copy (see the field comment in internal/distributed/cluster.go). Each node caches what it reads, so a per-node cache figure has no replication term in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configeffort: smallpriority: mediumtype: documentation

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions