Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/3.3' into 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Jun 25, 2018
2 parents f14b1ff + 65d8836 commit 8844085
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions enterprise/backup/src/test/java/org/neo4j/backup/BackupIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,29 +444,35 @@ public void backupMultipleSchemaIndexes() throws InterruptedException
AtomicBoolean end = new AtomicBoolean();
int backupPort = PortAuthority.allocatePort();
GraphDatabaseService db = getEmbeddedTestDataBaseService( backupPort );
int numberOfIndexedLabels = 100;
List<Label> indexedLabels = createIndexes( db, numberOfIndexedLabels );

// start thread that continuously writes to indexes
executorService.submit( () ->
try
{
while ( !end.get() )
int numberOfIndexedLabels = 10;
List<Label> indexedLabels = createIndexes( db, numberOfIndexedLabels );

// start thread that continuously writes to indexes
executorService.submit( () ->
{
try ( Transaction tx = db.beginTx() )
while ( !end.get() )
{
db.createNode( indexedLabels.get( random.nextInt( numberOfIndexedLabels ) ) ).setProperty( "prop", random.propertyValue() );
tx.success();
try ( Transaction tx = db.beginTx() )
{
db.createNode( indexedLabels.get( random.nextInt( numberOfIndexedLabels ) ) ).setProperty( "prop", random.propertyValue() );
tx.success();
}
}
}
} );
executorService.shutdown();
} );
executorService.shutdown();

// create backup
OnlineBackup backup = OnlineBackup.from( "127.0.0.1", backupPort ).full( backupPath.getPath() );
assertTrue( "Should be consistent", backup.isConsistent() );
end.set( true );
executorService.awaitTermination( 1, TimeUnit.MINUTES );
db.shutdown();
// create backup
OnlineBackup backup = OnlineBackup.from( "127.0.0.1", backupPort ).full( backupPath.getPath() );
assertTrue( "Should be consistent", backup.isConsistent() );
end.set( true );
executorService.awaitTermination( 1, TimeUnit.MINUTES );
}
finally
{
db.shutdown();
}
}

private List<Label> createIndexes( GraphDatabaseService db, int indexCount )
Expand Down

0 comments on commit 8844085

Please sign in to comment.