Skip to content

Commit 107a1ae

Browse files
Edit the examples
1 parent 6689dfd commit 107a1ae

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

modules/ROOT/pages/backup-restore/online-backup.adoc

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Note: this is an EXPERIMENTAL option. Consult Neo4j support before use.
161161
|false
162162

163163
|--prefer-diff-as-parent
164-
|label:new[Introduced in 2025.04] When performing a differential backup, prefer the latest non-empty differential backup as the parent instead of the latest full backup.
164+
|label:new[Introduced in 2025.04] When performing a differential backup, prefer the latest non-empty differential backup as the parent instead of the latest backup.
165165
|false
166166

167167
|--temp-path=<path>
@@ -465,27 +465,26 @@ bin/neo4j-admin database backup --to-path=azb://myStorageAccount/myContainer/myD
465465
[[diff-backup-as-parent]]
466466
=== Perform a differential backup using the `--prefer-diff-as-parent` option
467467

468-
When creating a differential backup, the parent is usually the most recent (non-empty) backup in the directory.
469-
In some cases you may prefer to use the latest differential backup as the parent, even if there is a more recent full backup.
470-
You can use the latest differential backup as the parent by setting the option `--prefer-diff-as-parent` to `True`.
468+
When taking a differential backup with the `--type=DIFF` option, the parent, by default, is the *most recent non-empty* backup in the directory.
469+
In some cases, you may prefer to use the *latest differential* backup as the parent, even if there is a more recent full backup.
470+
You can do this by setting the option `--prefer-diff-as-parent` to `True`.
471+
471472
This can be used to ensure you have differential backups for all transactions, which would allow you to restore to any point in time.
472473
Otherwise, the transactions between a full backup and the previous differential backup will not be backed up as individual transactions.
473474

475+
The examples below cover different scenarios for using the `--prefer-diff-as-parent` option.
476+
474477
[.tabbed-example]
475478
=====
476-
Different scenarios for using the `--prefer-diff-as-parent` option
477-
[NOTE]
478-
The general behaviour while taking a differential backup with the `--type=DIFF` option is that the *most recent non-empty* backup is used as the parent.
479-
With the `--prefer-diff-as-parent` option, the *most recent non-empty differential* backup is used as the parent *when possible*:
480-
in case there is no backup that satisfy the condition, then we fall back to the general behaviour.
479+
[role=include-with-Chain-with-full-and-differential-backups]
481480
======
482481

483-
Example 1: *Chain with full and differential backups*
482+
Let's assume that every hour you write 10 transactions to the `neo4j` database, except from 12:30-13:30, when you do not write any transaction.
484483

485-
Let's assume that every hour we write 10 transactions to the `neo4j` database, except from 12:30-13:30, when we don't write any transaction.
486-
There is a backup job that takes a backup every hour and a full backup every 4 hours.
487-
We refer as an _empty_ backup a backup that has no transactions, meaning that both the lower transaction ID and the upper transaction ID are zero)
488-
Let's say that you have this backup chain:
484+
There is a backup job that takes a backup every hour and a full backup every four hours.
485+
We refer as an _empty_ backup a backup that has no transactions, meaning that both the lower transaction ID and the upper transaction ID are zero.
486+
487+
Imagine you have the following backup chain:
489488

490489
[cols="h,e,m,h,h"]
491490
|===
@@ -523,13 +522,14 @@ Let's say that you have this backup chain:
523522

524523
|===
525524

526-
If at 15:30 we execute the backup command:
525+
At 15:30, you execute the following backup command:
526+
527527
[source,shell]
528528
----
529529
neo4j-admin database backup --from=<address:port> --to-path=<targetPath> --type=DIFF neo4j
530530
----
531531

532-
then the result would be:
532+
The result would be:
533533

534534
[cols="h,e,m,h,h"]
535535
|===
@@ -540,16 +540,17 @@ then the result would be:
540540
| 50
541541
|===
542542

543-
because we choose `backup5` as parent since it is the *latest non-empty* backup.
543+
The result means you have chosen `backup5` as the parent for your differential `backup6` since the `backup5` is the *latest non-empty* backup.
544544

545-
Otherwise, if we execute this command:
545+
However, if you execute the following command with the `--prefer-diff-as-parent` option:
546546

547547
[source,shell]
548548
----
549549
neo4j-admin database backup --from=<address:port> --to-path=<targetPath> --type=DIFF --prefer-diff-as-parent neo4j
550550
----
551551

552-
then the result would be:
552+
The result would be:
553+
553554
[cols="h,e,m,h,h"]
554555
|===
555556
| 14:30
@@ -559,15 +560,13 @@ then the result would be:
559560
| 50
560561
|===
561562

562-
because we choose `backup3` as parent since it is the *latest non-empty differential* backup.
563+
In this case, the `backup3` is selected as the parent since it is the *latest non-empty differential* backup.
563564

564565
======
565-
566+
[role=include-with-Chain-with-only-full-backups]
566567
======
567568

568-
Example 2: *Chain with only full backups*
569-
570-
Let's assume that we write 10 transactions to the `neo4j` database every hour, and we trigger am hourly backup.
569+
Let's assume that you write 10 transactions to the `neo4j` database every hour and trigger an hourly full backup.
571570

572571
[cols="h,e,m,h,h"]
573572
|===
@@ -586,7 +585,8 @@ Let's assume that we write 10 transactions to the `neo4j` database every hour, a
586585
| 20
587586
|===
588587

589-
In this case, there is no differential backup, so the `--prefer-diff-as-parent` option has no effect and the behaviour is the same as the default one.
588+
In this case, there is no differential backup.
589+
Therefore, the `--prefer-diff-as-parent` option has no effect and the behaviour is the same as the default one.
590590

591591
[source,shell]
592592
----
@@ -607,11 +607,10 @@ The result would be (with or without the `--prefer-diff-as-parent` option):
607607
|===
608608

609609
======
610-
610+
[role=include-with-Chain-with-only-empty-full-backups]
611611
======
612-
Example 3: *Chain with only empty full backups*
613612

614-
Let's assume that the database is empty and that we don't write anything to it, while still taking hourly backups.
613+
Let's assume that the database is empty and you do not write anything to it, while still taking hourly full backups.
615614

616615
[cols="h,e,m,h,h"]
617616
|===
@@ -630,8 +629,8 @@ Let's assume that the database is empty and that we don't write anything to it,
630629
| 0
631630
|===
632631

633-
In this case with the `--type=DIFF` option we would fail both with the `--prefer-diff-as-parent` and the `default` behaviour,
634-
since we're looking for the *latest non-empty* backup and there are only empty backups.
632+
In this case, you cannot perform a differential backup with the `--type=DIFF` option, and the below command fails anyway, whether you used the `--prefer-diff-as-parent` or not.
633+
This occurs because we are looking for the *latest non-empty* backup, and there are only empty backups.
635634

636635
[source,shell]
637636
----
@@ -641,7 +640,7 @@ neo4j-admin database backup \
641640
neo4j
642641
----
643642

644-
But if we select the `--type=AUTO` option, the command will succeed and the result would be another empty full backup.
643+
But if you select the `--type=AUTO` option, the command will succeed, and the result would be another empty *full* backup.
645644

646645
[source,shell]
647646
----
@@ -651,6 +650,8 @@ neo4j-admin database backup \
651650
neo4j
652651
----
653652

653+
The result would be:
654+
654655
[cols="h,e,m,h,h"]
655656
|===
656657
| 12:30
@@ -661,3 +662,4 @@ neo4j
661662
|===
662663

663664
======
665+
=====

0 commit comments

Comments
 (0)