Skip to content

Commit b4421e7

Browse files
Clarify using of the ALTER SERVER options (neo4j#2551)
Co-authored-by: Nick Giles <[email protected]>
1 parent 9acedc9 commit b4421e7

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

modules/ROOT/pages/clustering/servers.adoc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Likewise, if `ALTER SERVER '25a7efc7-d063-44b8-bdee-f23357f89f01' SET OPTIONS {a
426426

427427
The possible options when altering a server are:
428428

429-
[options="header", width="100%", cols="2a,2,^.^"]
429+
[options="header", width="100%", cols="1a,2,2"]
430430
|===
431431
| Option
432432
| Allowed values
@@ -435,7 +435,7 @@ The possible options when altering a server are:
435435
| modeConstraint
436436
| `PRIMARY`, `SECONDARY`, `NONE`
437437
| Databases may only be hosted on the server in the mode specified by the constraint.
438-
`None` means there is no constraint and any mode is allowed.
438+
`NONE` means there is no constraint and any mode is allowed.
439439

440440
| allowedDatabases
441441
| list of database names, e.g. `["db1", "db2"]`
@@ -459,10 +459,34 @@ This may not be specified in combination with `allowedDatabases`.
459459

460460
As with the `DEALLOCATE DATABASES FROM SERVER ...` command, if the alteration of a server's options renders it impossible for the cluster to satisfy one or more of the databases' topologies, then the command fails and no changes are made.
461461

462-
[NOTE]
462+
[IMPORTANT]
463463
====
464464
Input provided to `SET OPTIONS {...}` replaces **all** existing options, rather than being combined with them.
465-
For instance if `SET OPTIONS {modeConstraint:'SECONDARY'}` is executed followed by `SET OPTIONS {allowedDatabases:['foo']}`, the execution of the second `ALTER` removes the mode constraint.
465+
466+
Any previously set values must be specified every time you run the `ALTER SERVER` command; otherwise they will be overwritten to the unset values.
467+
468+
For instance, you run two statements one after the other:
469+
470+
[source,cypher]
471+
----
472+
ALTER SERVER '25a7efc7-d063-44b8-bdee-f23357f89f01' SET OPTIONS {modeConstraint:'SECONDARY'};
473+
----
474+
475+
[source,cypher]
476+
----
477+
ALTER SERVER '25a7efc7-d063-44b8-bdee-f23357f89f01' SET OPTIONS {allowedDatabases:['foo']};
478+
----
479+
480+
The execution of the second `ALTER SERVER` removes the mode constraint `SECONDARY`, replacing it with `NONE`.
481+
482+
If you want to keep both values `modeConstraint:'SECONDARY'` and `allowedDatabases:['foo']`, you have to explicitly set them in the options for the `ALTER SERVER` command:
483+
484+
[source,cypher]
485+
----
486+
ALTER SERVER '25a7efc7-d063-44b8-bdee-f23357f89f01' SET OPTIONS {modeConstraint:'SECONDARY', allowedDatabases:['foo']};
487+
----
488+
489+
Always check the current configuration with `SHOW SERVERS YIELD *` and reapply unchanged options when using `ALTER SERVER`.
466490
====
467491

468492
=== Renaming a server

0 commit comments

Comments
 (0)