Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bdarnell opened this issue Mar 21, 2018 · 10 comments · Fixed by #28495
Closed

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

bdarnell opened this issue Mar 21, 2018 · 10 comments · Fixed by #28495
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@bdarnell
Copy link
Contributor

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).

@bdarnell
Copy link
Contributor Author

cc @dianasaur323

@bdarnell
Copy link
Contributor Author

The just-added cockroach demo command is similar to my proposed cockroach start-single-node command but it uses an in-memory store instead of on-disk (and does some other stuff like creating a database). We should think about whether we want two distinct commands here or if it makes sense to combine them. cc @jordanlewis

@knz knz changed the title cli: Deprecate implicit initialization on absence of --join flag cli/start+init: Deprecate implicit initialization on absence of --join flag Apr 11, 2018
@bdarnell bdarnell added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Apr 26, 2018
@petermattis petermattis modified the milestones: 2.1, 2.2 Sep 25, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
@knz
Copy link
Contributor

knz commented Jul 9, 2019

@piyush-singh @jseldess FYI I have prepared a PR (#28495) to address this issue a while ago; however it's not merged yet and Ben suggests in #28495 (comment) that you should be the folk green lighting this work. What do you think?

@knz
Copy link
Contributor

knz commented Jul 9, 2019

(If doc bandwidth is an issue, I could volunteer to draft the necessary changes myself.)

@jseldess
Copy link
Contributor

@knz, I'm all in favor of this change and can commit to make the required docs changes. Will be a good opportunity to clean things up anyway. Let me know what else you need from me.

@piyush-singh
Copy link

Agreed that we should take this on from a PM perspective - I've seen user confused by this across several support channels and I know I was confused about this myself when I first started. I can help acceptance test and work with Jesse on any docs reviews.

@knz
Copy link
Contributor

knz commented Jul 11, 2019

ok then I'll revive the pr

@awoods187
Copy link
Contributor

awoods187 commented Jul 11, 2019

Are we blocking natural growth by not allowing a path from one node to many nodes? I could easily imagine a test with one node and then adding two more nodes to the cluster to see what three-node looks like. Part of our value prop is easily scaling up the number of nodes.

I suppose you could make the argument that one node setup is for testing and no production cluster should have less than three nodes but it seems like this might add friction.

@knz
Copy link
Contributor

knz commented Jul 11, 2019

The path would still exist - it would still be possible to grow the cluster from 1 to more, but there would be one additional step: increase the replication factor from 1 to N

craig bot pushed a commit that referenced this issue Aug 2, 2019
28495: cli: new command 'start-single-node' r=knz a=knz

Fixes #24118.
Fixes #21429.

Suggested/requested by @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) 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.

This patch implements the new `start-single-node` command as follows:

- the new command does not accept `--join`.
- it attempts to set the replication factor to 1 upon starting up.

Meanwhile `cockroach start` is changed to produce a deprecation
warning if `--join` is not specified.

Release note (cli change): a new command `cockroach start-single-node`
is introduced to start single-node clusters with replication disabled.

Release note (cli change): using `cockroach start` without `--join` is
now deprecated and this mode of execution will be removed in a later
version of CockroachDB. Consider using `cockroach start-single-node`
instead or combine `cockroach start` with `cockroach init`.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig craig bot closed this as completed in #28495 Aug 2, 2019
@knz
Copy link
Contributor

knz commented Aug 2, 2019

it is done

irfansharif added a commit to irfansharif/cockroach that referenced this issue Jul 10, 2020
Fixes cockroachdb#44116. Informs cockroachdb#24118.
Reviving cockroachdb#44112.

Release note (backward-incompatible change): A CockroachDB node
started with cockroach start without the --join flag no
longer automatically initializes the cluster. The cockrach init
command is now mandatory. The auto-initialization behavior had
been deprecated in version 19.2.
irfansharif added a commit to irfansharif/cockroach that referenced this issue Jul 15, 2020
Fixes cockroachdb#44116. Informs cockroachdb#24118. Reviving cockroachdb#44112.

We remove the deprecated behavior of crdb where we previously
auto-initialized the cluster when `cockroach start` was invoked without
a corresponding `--join` flag. We update a few tests along the way that
made use of this behavior by changing them to either explicitly init, or
now lean on `roachprod` changes (from cockroachdb#51329) that transparently manage
initialization.

Release note (backward-incompatible change): A CockroachDB node
started with cockroach start without the --join flag no
longer automatically initializes the cluster. The `cockroach init`
command is now mandatory. The auto-initialization behavior had
been deprecated in version 19.2.

Release note (backward-incompatible change): `cockroach start` without
`--join` is no longer supported. It was deprecated in a previous
release.
irfansharif added a commit to irfansharif/cockroach that referenced this issue Jul 17, 2020
Fixes cockroachdb#44116. Informs cockroachdb#24118. Reviving cockroachdb#44112.

We remove the deprecated behavior of crdb where we previously
auto-initialized the cluster when `cockroach start` was invoked without
a corresponding `--join` flag. We update a few tests along the way that
made use of this behavior by changing them to either explicitly init, or
now lean on `roachprod` changes (from cockroachdb#51329) that transparently manage
initialization.

Release note (backward-incompatible change): A CockroachDB node
started with cockroach start without the --join flag no
longer automatically initializes the cluster. The `cockroach init`
command is now mandatory. The auto-initialization behavior had
been deprecated in version 19.2.

Release note (backward-incompatible change): `cockroach start` without
`--join` is no longer supported. It was deprecated in a previous
release.
craig bot pushed a commit that referenced this issue Jul 17, 2020
51245: cli: remove auto-init with `cockroach start` without `--join` r=irfansharif a=irfansharif

Fixes #44116. Informs #24118. Reviving #44112.

Release note (backward-incompatible change): A CockroachDB node
started with cockroach start without the --join flag no
longer automatically initializes the cluster. The cockrach init
command is now mandatory. The auto-initialization behavior had
been deprecated in version 19.2.

Co-authored-by: irfan sharif <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants