Skip to content

Commit

Permalink
Repository writes in SegmentStoreMigrator blocked when migrating to A…
Browse files Browse the repository at this point in the history
…zure segment store (#1308)

* OAK-10652 obrain lock in target SegmentNodeStorePersistence

* OAK-10652 remove unused import

---------

Co-authored-by: Miroslav Smiljanic <[email protected]>
  • Loading branch information
smiroslav and Miroslav Smiljanic authored Feb 16, 2024
1 parent 32462bd commit d2fdd67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.jackrabbit.oak.segment.spi.persistence.GCJournalFile;
import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFileReader;
import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFileWriter;
import org.apache.jackrabbit.oak.segment.spi.persistence.RepositoryLock;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveEntry;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveReader;
Expand Down Expand Up @@ -88,10 +89,14 @@ private SegmentStoreMigrator(Builder builder) {
}

public void migrate() throws IOException, ExecutionException, InterruptedException {
RepositoryLock repositoryLock = target.lockRepository();

RETRIER.execute(this::migrateJournal);
RETRIER.execute(this::migrateGCJournal);
RETRIER.execute(this::migrateManifest);
migrateArchives();

repositoryLock.unlock();
}

private void migrateJournal() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveReader;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentNodeStorePersistence;
import org.apache.jackrabbit.oak.segment.spi.persistence.RepositoryLock;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
Expand Down Expand Up @@ -102,8 +101,6 @@ public void testSegmentCopy() throws Exception {
SegmentNodeStorePersistence srcPersistence = getSrcPersistence();
SegmentNodeStorePersistence destPersistence = getDestPersistence();

RepositoryLock destRepositoryLock = destPersistence.lockRepository();

String srcPathOrUri = getSrcPathOrUri();
String destPathOrUri = getDestPathOrUri();

Expand All @@ -123,8 +120,6 @@ public void testSegmentCopy() throws Exception {
checkJournal(srcPersistence, destPersistence);
checkGCJournal(srcPersistence, destPersistence);
checkManifest(srcPersistence, destPersistence);

destRepositoryLock.unlock();
}

private int runSegmentCopy(SegmentNodeStorePersistence srcPersistence, SegmentNodeStorePersistence destPersistence,
Expand Down

0 comments on commit d2fdd67

Please sign in to comment.