Skip to content

cli/start+init: Deprecate implicit initialization on absence of --join flag #24118

@bdarnell

Description

@bdarnell

There are currently two ways to initialize a cluster: Starting the first node without a --join flag, or starting all nodes with --join flags and running a separate cockroach init command. This redundancy is confusing (our docs use both methods without explaining the difference. cockroachdb/docs#2756) and it's easy to accidentally initialize a new cluster by restarting your first node with the wrong flags. (This could have catastrophic consequences in 1.1 because data from the two clusters could get mixed. We've added safeguards against this in 2.0 but it's still an easy way to break things)

I think that we should deprecate this implicit initialization mode and make the --join flag mandatory when starting a node (and therefore the init command would be mandatory too). To avoid adding too much complexity to single-node clusters, I propose a new cockroach start-single-node command to perform the start and init combination that is today implicit in the absence of a --join flag.

This would have a side benefit that we would know when the user intends to keep the cluster as a single node instead of adding more later. The start-single-node command could therefore set the replication factor to 1 to disable the "underreplicated ranges" warning (as suggested in #21429 (comment)).

In some deployment environments, it's not possible to predict the addresses or hostnames that will be assigned to other nodes until they are started. This makes it difficult to set the join flag correctly on the first node (without awkward hacks like joining the first node to itself). However, in most environments this works just fine (and in fact always passing the join flag is easier in most cases than passing it sometimes but not others).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions