diff --git a/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFiles.java b/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFiles.java index 0c38950abfe2b..cc4f46405d9d1 100644 --- a/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFiles.java +++ b/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFiles.java @@ -25,14 +25,13 @@ import java.util.function.Predicate; import java.util.stream.Stream; +import org.neo4j.collection.primitive.Primitive; import org.neo4j.collection.primitive.PrimitiveLongSet; import org.neo4j.graphdb.ResourceIterator; import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.io.pagecache.PageCache; import org.neo4j.kernel.NeoStoreDataSource; import org.neo4j.kernel.impl.store.StoreType; -import org.neo4j.kernel.impl.transaction.state.NeoStoreFileIndexListing; -import org.neo4j.kernel.impl.transaction.state.NeoStoreFileListing; import org.neo4j.storageengine.api.StoreFileMetadata; import static org.neo4j.io.fs.FileUtils.relativePath; @@ -51,21 +50,26 @@ public class PrepareStoreCopyFiles implements AutoCloseable this.fileSystemAbstraction = fileSystemAbstraction; } - PrimitiveLongSet getIndexIds() + PrimitiveLongSet getNonAtomicIndexIds() { - NeoStoreFileListing neoStoreFileListing = neoStoreDataSource.getNeoStoreFileListing(); - NeoStoreFileIndexListing indexListing = neoStoreFileListing.getNeoStoreFileIndexListing(); - return indexListing.getIndexIds(); + return Primitive.longSet(); } StoreResource[] getAtomicFilesSnapshot() throws IOException { ResourceIterator neoStoreFilesIterator = closeablesListener.add( neoStoreDataSource.getNeoStoreFileListing().builder().excludeAll().includeNeoStoreFiles().build() ); - ResourceIterator explicitIndexIterator = closeablesListener.add( - neoStoreDataSource.getNeoStoreFileListing().builder().excludeAll().includeExplicitIndexStoreStoreFiles().includeAdditionalProviders().build() ); + ResourceIterator indexIterator = closeablesListener.add( neoStoreDataSource + .getNeoStoreFileListing() + .builder() + .excludeAll() + .includeExplicitIndexStoreStoreFiles() + .includeAdditionalProviders() + .includeLabelScanStoreFiles() + .includeSchemaIndexStoreFiles() + .build() ); - return Stream.concat( neoStoreFilesIterator.stream().filter( isCountFile() ), explicitIndexIterator.stream() ).map( mapToStoreResource() ).toArray( + return Stream.concat( neoStoreFilesIterator.stream().filter( isCountFile() ), indexIterator.stream() ).map( mapToStoreResource() ).toArray( StoreResource[]::new ); } diff --git a/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandler.java b/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandler.java index e7ac04b71261f..b3f38bc643828 100644 --- a/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandler.java +++ b/enterprise/causal-clustering/src/main/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandler.java @@ -95,7 +95,7 @@ protected void channelRead0( ChannelHandlerContext channelHandlerContext, Prepar private PrepareStoreCopyResponse createSuccessfulResponse( CheckPointer checkPointer, PrepareStoreCopyFiles prepareStoreCopyFiles ) throws IOException { - PrimitiveLongSet indexIds = prepareStoreCopyFiles.getIndexIds(); + PrimitiveLongSet indexIds = prepareStoreCopyFiles.getNonAtomicIndexIds(); File[] files = prepareStoreCopyFiles.listReplayableFiles(); long lastCommittedTxId = checkPointer.lastCheckPointedTransactionId(); return PrepareStoreCopyResponse.success( files, indexIds, lastCommittedTxId ); diff --git a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/CatchupServerIT.java b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/CatchupServerIT.java index 2439f18ba98d9..6f0ed69cfd0f7 100644 --- a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/CatchupServerIT.java +++ b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/CatchupServerIT.java @@ -58,11 +58,11 @@ import static java.util.stream.Collectors.toList; import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.neo4j.graphdb.Label.label; import static org.neo4j.io.fs.FileUtils.relativePath; @@ -148,7 +148,7 @@ public void shouldListExpectedFilesCorrectly() throws Exception assertTransactionIdMatches( prepareStoreCopyResponse.lastTransactionId() ); //and - assertIndexIdsMatch( prepareStoreCopyResponse.getIndexIds(), neoStoreDataSource ); + assertIndexIdsAreEmpty( prepareStoreCopyResponse.getIndexIds() ); } @Test @@ -277,10 +277,9 @@ private void listOfDownloadedFilesMatchesServer( NeoStoreDataSource neoStoreData assertThat( givenFile, containsInAnyOrder( expectedStoreFiles.toArray( new String[givenFile.size()] ) ) ); } - private void assertIndexIdsMatch( PrimitiveLongSet indexIds, NeoStoreDataSource neoStoreDataSource ) + private void assertIndexIdsAreEmpty( PrimitiveLongSet indexIds ) { - PrimitiveLongSet expectedIndexIds = getExpectedIndexIds( neoStoreDataSource ); - assertThat( expectedIndexIds, equalTo( indexIds ) ); + assertTrue( indexIds.isEmpty() ); } private PrimitiveLongSet getExpectedIndexIds( NeoStoreDataSource neoStoreDataSource ) diff --git a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFilesTest.java b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFilesTest.java index 477ef1a784734..a2b47c3ec32a2 100644 --- a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFilesTest.java +++ b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyFilesTest.java @@ -42,6 +42,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.CALLS_REAL_METHODS; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @@ -122,21 +123,21 @@ public void shouldReturnExpectedListOfFileNamesForEachType() throws Exception @Test public void shouldHandleEmptyDescriptors() { - PrimitiveLongSet indexIds = prepareStoreCopyFiles.getIndexIds(); + PrimitiveLongSet indexIds = prepareStoreCopyFiles.getNonAtomicIndexIds(); assertEquals( 0, indexIds.size() ); } @Test - public void shouldReturnExpectedDescriptors() + public void shouldReturnEmptySetOfIds() { PrimitiveLongSet expectedIndexIds = Primitive.longSet(); expectedIndexIds.add( 42 ); when( indexListingMock.getIndexIds() ).thenReturn( expectedIndexIds ); - PrimitiveLongSet actualIndexIndexIds = prepareStoreCopyFiles.getIndexIds(); + PrimitiveLongSet actualIndexIndexIds = prepareStoreCopyFiles.getNonAtomicIndexIds(); - assertEquals( expectedIndexIds, actualIndexIndexIds ); + assertTrue( actualIndexIndexIds.isEmpty() ); } private String getRelativePath( StoreFileMetadata f ) diff --git a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandlerTest.java b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandlerTest.java index e1af3aaa3921c..c682ccb5ad4cd 100644 --- a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandlerTest.java +++ b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/catchup/storecopy/PrepareStoreCopyRequestHandlerTest.java @@ -155,7 +155,7 @@ private void configureProvidedStoreCopyFiles( StoreResource[] atomicFiles, File[ throws IOException { when( prepareStoreCopyFiles.getAtomicFilesSnapshot() ).thenReturn( atomicFiles ); - when( prepareStoreCopyFiles.getIndexIds() ).thenReturn( indexIds ); + when( prepareStoreCopyFiles.getNonAtomicIndexIds() ).thenReturn( indexIds ); when( prepareStoreCopyFiles.listReplayableFiles() ).thenReturn( files ); when( checkPointer.lastCheckPointedTransactionId() ).thenReturn( lastCommitedTx ); }