Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3.4 - Resolved Consistency check errors in backup
Before applying this patch, the neo4j-admin backup tool can fail performing a backup. This is due to the omission of the step to recover a store once it has been copied. The solution is starting a temporary embedded database after every full backup.
- Loading branch information
Showing
16 changed files
with
341 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
enterprise/backup/src/main/java/org/neo4j/backup/BackupRecoveryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2002-2017 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.backup; | ||
|
||
import java.io.File; | ||
import java.util.Map; | ||
|
||
import org.neo4j.io.pagecache.PageCache; | ||
import org.neo4j.kernel.configuration.Config; | ||
import org.neo4j.kernel.internal.GraphDatabaseAPI; | ||
|
||
import static org.neo4j.backup.BackupProtocolService.startTemporaryDb; | ||
|
||
public class BackupRecoveryService | ||
{ | ||
public void recoverWithDatabase( File targetDirectory, PageCache pageCache, Config config ) | ||
{ | ||
Map<String,String> configParams = config.getRaw(); | ||
GraphDatabaseAPI targetDb = startTemporaryDb( targetDirectory, pageCache, configParams ); | ||
targetDb.shutdown(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...rise/backup/src/main/java/org/neo4j/backup/ExistingBackupWithDifferentStoreException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2002-2017 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.backup; | ||
|
||
import java.io.File; | ||
|
||
import org.neo4j.kernel.impl.store.MismatchingStoreIdException; | ||
|
||
class ExistingBackupWithDifferentStoreException extends RuntimeException | ||
{ | ||
static final String DIFFERENT_STORE_MESSAGE = "Target directory contains full backup of a logically different store."; | ||
private static final String BACKUP_LOCATION_MESSAGE = "Directory `%s` contains full backup of a logically different store."; | ||
|
||
ExistingBackupWithDifferentStoreException( MismatchingStoreIdException mismatchingStoreIdException ) | ||
{ | ||
super( DIFFERENT_STORE_MESSAGE, mismatchingStoreIdException ); | ||
} | ||
|
||
ExistingBackupWithDifferentStoreException( ExistingBackupWithDifferentStoreException cause, File backupLocation ) | ||
{ | ||
super( String.format( BACKUP_LOCATION_MESSAGE, backupLocation ), cause ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.