Skip to content

Commit 51fec9e

Browse files
mnd999nick-giles-neoakarasavovrenetapopova
authored
Updates to CREATE DATABASE for Cypher 25 (#2132)
* Explain how existing store files work, this has never really been well documented * Add a different set of options for Cypher 25 * WAIT is different in Cypher 25. --------- Co-authored-by: Nick Giles <[email protected]> Co-authored-by: akarasavov <[email protected]> Co-authored-by: Reneta Popova <[email protected]> Co-authored-by: Nick Giles <[email protected]>
1 parent 65ecdd8 commit 51fec9e

File tree

1 file changed

+103
-2
lines changed

1 file changed

+103
-2
lines changed

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

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ For more information, see link:{neo4j-docs-base-uri}/upgrade-migration-guide/upg
1919
== Create databases
2020

2121
You can create a database using the Cypher command `CREATE DATABASE`.
22+
The initial contents of the database depend on the state of the server and the options provided to the command.
23+
When no additional options are provided, `CREATE DATABASE` will attempt to mount any pre-existing store files in place (e.g., as the result of restoring a backup).
24+
If no pre-existing store files are available, it will create an empty database.
2225

2326
[NOTE]
2427
====
@@ -64,6 +67,11 @@ CREATE OR REPLACE DATABASE name
6467
[[manage-databases-create-database-options]]
6568
=== Options
6669

70+
[.tabbed-example]
71+
=====
72+
[.include-with-cypher-5]
73+
======
74+
6775
The `CREATE DATABASE` command can have a map of options, e.g. `OPTIONS {key: 'value'}`.
6876

6977
[options="header"]
@@ -90,7 +98,7 @@ Replaced by `existingDataSeedServer`.
9098
| `seedURI`
9199
| URI to a backup or a dump from an existing database.
92100
|
93-
Defines an identical seed from an external source which will be used to seed all servers.
101+
Defines a seed from an external source, which will be used to seed all servers.
94102

95103
| `seedConfig`
96104
| Comma-separated list of configuration values.
@@ -128,7 +136,70 @@ Starting from Neo4j 2025.01, you can use `existingData`, `seedURI`, `seedConfig`
128136
The `existingDataSeedInstance` and `existingDataSeedServer` are still not supported with the `CREATE OR REPLACE DATABASE` command.
129137
More details about seeding options can be found in xref::clustering/databases.adoc#cluster-seed[Seed a cluster].
130138
====
139+
======
140+
[.include-with-cypher-25]
141+
======
142+
The `CREATE DATABASE [OR REPLACE]` command can have a map of options, e.g., `OPTIONS {key: 'value'}`.
143+
144+
[options="header"]
145+
|===
146+
147+
| Key | Value | Description
148+
149+
|`existingDataSeedServer`
150+
| ID of the cluster server
151+
|
152+
Defines which server is used for seeding the data of the created database.
153+
The server ID can be found in the `serverId` column after running `SHOW SERVERS`.
154+
155+
| `seedURI`
156+
| URI to a backup, a folder that contains backup artifacts or a dump from an existing database.
157+
|
158+
Defines a seed from an external source, which will be used to seed all servers.
159+
160+
| `seedConfig`
161+
| Comma-separated list of configuration values.
162+
|
163+
For more information see xref::clustering/databases.adoc#cluster-seed-uri[Seed from URI].
164+
165+
| `txLogEnrichment`
166+
| `FULL` \| `DIFF` \| `OFF`
167+
|
168+
Defines the level of enrichment applied to transaction logs for Change Data Capture (CDC) purposes.
169+
170+
For details about enrichment mode, see link:{neo4j-docs-base-uri}/cdc/current/get-started/self-managed/#set-enrichment-mode/[Change Data Capture Manual -> Enable CDC on self-managed instances -> Set the enrichment mode].
131171

172+
| `storeFormat`
173+
| `aligned` \| `standard` \| `high_limit` \| `block`
174+
|
175+
Defines the store format if the database created is new.
176+
`high_limit` and `standard` formats are deprecated from 5.23.
177+
For more information on store formats, see xref::database-internals/store-formats.adoc[Store formats].
178+
179+
If the store is seeded with `seedURI` or `existingDataSeedServer`, or if the command is used to mount pre-existing store files already present on the disk, they will retain their current store format without any modifications.
180+
181+
| `seedRestoreUntil`
182+
| Datetime or transaction id. E.g. `datetime("2025-01-01T12:15:00.000+0100")` or `123456`
183+
|
184+
If you are passing a `seedURI` that leads to a backup chain, including differential backups, you can choose to not apply all the transactions in the differential backups.
185+
To seed up to a specific date, specify a `datetime`.
186+
This will seed the database with transactions committed before the provided timestamp.
187+
To seed up to a specific transaction ID, specify a transaction ID.
188+
This will seed the database with transactions up to, but not including the specified transaction.
189+
190+
| `seedSourceDatabase`
191+
| A source database name
192+
|
193+
If the `seedURI` points to a folder containing backups for multiple databases, you can specify the database name to filter the artifacts.
194+
195+
| `existingData` label:deprecated[Deprecated]
196+
| `use`
197+
|
198+
Included for backward compatibility only, has no effect and will be removed in a future version.
199+
200+
|===
201+
======
202+
=====
132203

133204
=== Examples
134205

@@ -164,7 +235,11 @@ SHOW DATABASES YIELD name
164235

165236
==== Create a database with xref:database-administration/standard-databases/wait-options.adoc[`WAIT`]
166237

167-
Sub-clause `WAIT` allows you to specify a time limit in which the command must complete and return.
238+
[.tabbed-example]
239+
=====
240+
[.include-with-cypher-5]
241+
======
242+
Sub-clause `WAIT` allows you to specify a time limit for the command to complete and return.
168243

169244
[source, cypher]
170245
----
@@ -183,7 +258,33 @@ CREATE DATABASE slow WAIT 5 SECONDS
183258

184259
The `success` column provides an aggregate status of whether or not the command is considered successful.
185260
Thus, every row has the same value, determined on a successful completion without a timeout.
261+
======
262+
[.include-with-cypher-25]
263+
======
264+
Sub-clause `WAIT` allows you to specify a time limit for the command to complete and return.
265+
266+
[source, cypher]
267+
----
268+
CREATE DATABASE slow WAIT 5 SECONDS
269+
----
270+
271+
.Result
272+
[role="queryresult"]
273+
----
274+
info: Server `ServerId{b55c6551}` at address `server1:7687` has caught up.
275+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
276+
277+
info: Server `ServerId{a9e7e8f1}` at address `server2:7687` has caught up.
278+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
279+
280+
info: Server `ServerId{0f7cb48e}` at address `server3:7687` has caught up.
281+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
282+
----
186283

284+
The command returns a notification for each server in the cluster to indicate the status of that command on that server.
285+
In this example, all three cluster members have returned `Neo.ClientNotification.Cluster.ServerCaughtUp`, which indicates that the server has applied the command successfully and is up to date.
286+
======
287+
=====
187288

188289
==== Create databases with `IF NOT EXISTS` or `OR REPLACE`
189290

0 commit comments

Comments
 (0)