Skip to content

Commit 789b152

Browse files
Add new unquarantine procedure + deprecate quarantine (#1985)
Added docs for brand-new `unquarantineDatabase` procedure and for the now deprecated `quarantineDatabase` procedure. --------- Co-authored-by: NataliaIvakina <[email protected]>
1 parent 668d8bd commit 789b152

File tree

2 files changed

+67
-53
lines changed

2 files changed

+67
-53
lines changed

modules/ROOT/pages/database-administration/standard-databases/errors.adoc

Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -160,74 +160,44 @@ It produces a database dump that can be further examined and potentially repaire
160160
[[quarantine]]
161161
== Quarantined databases
162162

163-
There are two ways to get a database into a `quarantined` state:
164-
165-
* By using the xref:procedures.adoc#procedure_dbms_quarantineDatabase[`dbms.quarantineDatabase`] procedure locally to isolate a specific database.
166-
The procedure must be executed on the instance whose copy of the database you want to quarantine.
167-
A reason for that can be, for example, when a database is unable to start on a given instance due to a file system permissions issue with the volume where the database is located or when a recently started database begins to log errors.
168-
The quarantine state renders the database inaccessible on that instance and prevents its state from being changed, for example, with the `START DATABASE` command.
169-
+
170-
[NOTE]
171-
====
172-
If running in a cluster, database management commands such as `START DATABASE foo` will still take effect on the instances which have *not* quarantined `foo`.
173-
====
174-
175-
* When a database encounters a severe error during its normal run, which prevents it from a further operation, Neo4j stops that database and brings it into a `quarantined` state.
163+
When a database encounters a severe error during its normal run, which prevents it from a further operation, Neo4j stops that database and brings it into a `quarantined` state.
176164
Meaning, it is not possible to restart it with a simple `START DATABASE` command.
177-
You have to execute `CALL dbms.quarantineDatabase(databaseName, false)` on the instance with the failing database in order to lift the quarantine.
165+
You have to run `CALL dbms.unquarantineDatabase(server, database, operation)` to lift the quarantine, specifying as `server` the instance with the failing database.
178166

179-
After lifting the quarantine, the instance will automatically try to bring the database to the desired state.
167+
The `dbms.unquarantineDatabase()` procedure is introduced in Neo4j 2025.01 to replace the now-deprecated xref:procedures.adoc#procedure_dbms_quarantineDatabase[`dbms.quarantineDatabase`()].
180168

181-
[NOTE]
182-
====
183-
It is recommended to run the quarantine procedure over the `bolt://` protocol rather than `neo4j://`, which may route requests to unexpected instances.
184-
====
169+
After lifting the quarantine, the instance will automatically try to bring the database to the desired state.
185170

186171
*Syntax:*
187172

188-
`CALL dbms.quarantineDatabase(databaseName,setStatus,reason)`
173+
`CALL dbms.unquarantineDatabase(server, database, operation)`
189174

190-
*Arguments:*
175+
*Input arguments:*
191176

192177
[options="header"]
193178
|===
194179
| Name | Type | Description
195-
| `databaseName` | String | The name of the database that will be put into or removed from quarantine.
196-
| `setStatus` | Boolean | `true` for placing the database into quarantine; `false` for lifting the quarantine.
197-
| `reason` | String | (Optional) The reason for placing the database in quarantine.
180+
| `server` | String | The identifier of the server where the quarantine for database will be lifted.
181+
| `database` | String | The name of the database that will be put into or removed from quarantine.
182+
| `operation` | String | Optional operation to apply while lifting the quarantine.
198183
|===
199184

200-
*Returns:*
185+
The possible values for the optional operation are:
201186

202-
[options="header"]
203-
|===
204-
| Name | Type | Description
205-
| `databaseName` | String | The name of the database.
206-
| `quarantined` | String | Actual state.
207-
| `result` | String | Result of the last operation.
208-
The result contains the user, the time, and the reason for the quarantine.
209-
|===
187+
* `keepStateKeepStore` -- do nothing; leave store and cluster state as they are.
188+
* `replaceStateKeepStore` -- join as a new member, clearing the current cluster state but keeping the store.
189+
* `replaceStateReplaceStore` -- join as a new member, clearing both the current cluster state and the store.
210190

211-
[NOTE]
212-
====
213-
The `dbms.quarantineDatabase` procedure replaces xref:procedures.adoc#procedure_dbms_cluster_quarantinedatabase[`dbms.cluster.quarantineDatabase`], which has been deprecated in Neo4j 4.3 and will be removed with the next major version.
214-
====
191+
If you choose to clear the current cluster state, the server will try to join as a new member,
192+
but this joining can succeed if and only if there is a majority of old members "letting" the new members in.
193+
Let's assume our cluster has a topology with three primaries.
194+
If there is only one server in `QUARANTINED` mode, then it is safe to choose `replaceStateKeepStore` or `replaceStateReplaceStore`.
195+
If there are two servers in `QUARANTINED` mode, then you should not use concurrently `replaceStateKeepStore` or `replaceStateReplaceStore` for both servers because there would be no majority to let them in.
215196

216-
.Quarantine a database
217-
[source, cypher]
218-
----
219-
neo4j@system> CALL dbms.quarantineDatabase("foo",true);
220-
----
221-
[queryresult]
222-
----
223-
+--------------------------------------------------------------------------------------+
224-
| databaseName | quarantined | result |
225-
+--------------------------------------------------------------------------------------+
226-
| "foo" | TRUE | "By neo4j at 2020-10-15T15:10:41.348Z: No reason given" |
227-
+--------------------------------------------------------------------------------------+
197+
*Return arguments:*
198+
199+
The procedure doesn't return any value.
228200

229-
3 row available after 100 ms, consumed after another 6 ms
230-
----
231201

232202
.Check if a database is quarantined
233203
[source, cypher]
@@ -251,7 +221,7 @@ neo4j@system> SHOW DATABASE foo;
251221
====
252222
A `quarantined` state is persisted for user databases.
253223
This means that if a database is quarantined, it will remain so even if that Neo4j instance is restarted.
254-
You can remove it only by running the xref:procedures.adoc#procedure_dbms_quarantineDatabase[`dbms.quarantineDatabase`] procedure on the instance where the quarantined database is located, passing `false` for the `setStatus` parameter.
224+
You can remove it only by running the xref:procedures.adoc#procedure_dbms_unquarantineDatabase[`dbms.unquarantineDatabase()`] procedure.
255225
256226
The one exception to this rule is for the built-in `system` database.
257227
Any quarantine for that database is removed automatically after instance restart.

modules/ROOT/pages/procedures.adoc

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-ver
10561056
| *Mode* 3+| WRITE
10571057
|===
10581058

1059-
[role=label--enterprise-edition label--admin-only]
1059+
[role=label--enterprise-edition label--admin-only label--deprecated-2025.01]
10601060
[[procedure_dbms_quarantineDatabase]]
10611061
=== dbms.quarantineDatabase()
10621062

@@ -1076,6 +1076,43 @@ For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-ver
10761076
| *Mode* 3+| DBMS
10771077
|===
10781078

1079+
[NOTE]
1080+
====
1081+
It is recommended to use <<procedure_dbms_unquarantineDatabase,`dbms.unquarantineDatabase()`>> over `dbms.quarantineDatabase()` due to its improvements and new features (see the `operation` option ).
1082+
// The deprecated `dbms.quarantineDatabase()` procedure is available in Cypher 5, but not in Cypher 25.
1083+
====
1084+
1085+
[role=label--enterprise-edition label--admin-only label--new-2025.01]
1086+
[[procedure_dbms_unquarantineDatabase]]
1087+
=== dbms.unquarantineDatabase()
1088+
1089+
1090+
.Details
1091+
|===
1092+
| *Syntax* 3+m| dbms.unquarantineDatabase(server, databaseName, operation) :: ()
1093+
| *Description* 3+a| Lift quarantine from a database on a given server.
1094+
.4+| *Input arguments* | *Name* | *Type* | *Description*
1095+
| `server` | `STRING` | The identifier of the server where the quarantine for database will be lifted.
1096+
| `database` | `STRING` | The name of the database for the quarantine will be lifted.
1097+
| `operation` | `STRING` | Optional operation to apply while lifting the quarantine.
1098+
| *Mode* 3+| DBMS
1099+
|===
1100+
1101+
[NOTE]
1102+
====
1103+
The possible values for the optional operation are:
1104+
1105+
* `keepStateKeepStore` -- do nothing; leave store and cluster state as they are.
1106+
* `replaceStateKeepStore` -- join as a new member, clearing the current cluster state but keeping the store.
1107+
* `replaceStateReplaceStore` -- join as a new member, clearing both the current cluster state and the store.
1108+
1109+
If you choose to clear the current cluster state, the server will try to join as a new member,
1110+
but this joining can succeed if and only if there is a majority of old members "letting" the new members in.
1111+
Let's assume our cluster has a topology with three primaries.
1112+
If there is only one server in `QUARANTINED` mode, then it is safe to choose `replaceStateKeepStore` or `replaceStateReplaceStore`.
1113+
If there are two servers in `QUARANTINED` mode, then you should not use concurrently `replaceStateKeepStore` or `replaceStateReplaceStore` for both servers because there would be no majority to let them in.
1114+
====
1115+
10791116
[role=label--admin-only label--deprecated-5.9]
10801117
[[procedure_dbms_upgrade]]
10811118
=== dbms.upgrade()
@@ -1925,6 +1962,13 @@ Replaced by: xref:procedures.adoc#procedure_dbms_routing_getroutingtable[`dbms.r
19251962
Before Neo4j 5.23, the procedure can be run only with the `Admin` privileges. +
19261963
Replaced by xref:clustering/server-syntax.adoc#server-management-syntax[`ENABLE SERVER`].
19271964
1965+
// New in v6
1966+
| xref:procedures.adoc#procedure_dbms_quarantineDatabase[`dbms.quarantineDatabase()`]
1967+
| label:no[]
1968+
| label:yes[]
1969+
| label:admin-only[] label:deprecated[Deprecated in 2025.01] +
1970+
Replaced by xref:procedures.adoc#procedure_dbms_unquarantineDatabase[`dbms.unquarantineDatabase()`]
1971+
19281972
| xref:procedures.adoc#procedure_dbms_setDatabaseAllocator[`dbms.setDatabaseAllocator()`]
19291973
| label:no[]
19301974
| label:yes[]

0 commit comments

Comments
 (0)