LUCENE-485. Don't hold commit lock while removing obsolete index files. Contributed by Luc Vanlerberghe.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@409690 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2006-05-26 16:14:12 +00:00
parent d2b63d328b
commit 777ab03972
2 changed files with 14 additions and 6 deletions

View File

@ -81,6 +81,10 @@ Bug fixes
15. LUCENE-546: Removed 2GB file size limitations for RAMDirectory.
(Peter Royal, Michael Chan, Yonik Seeley)
16. LUCENE-485: Don't hold commit lock while removing obsolete index
files. (Luc Vanlerberghe via cutting)
1.9.1
Bug fixes

View File

@ -614,12 +614,13 @@ public class IndexWriter {
new Lock.With(directory.makeLock(COMMIT_LOCK_NAME), commitLockTimeout) {
public Object doBody() throws IOException {
segmentInfos.write(directory); // commit changes
deleteSegments(segmentsToDelete); // delete now-unused segments
return null;
}
}.run();
}
deleteSegments(segmentsToDelete); // delete now-unused segments
if (useCompoundFile) {
final Vector filesToDelete = merger.createCompoundFile(mergedName + ".tmp");
synchronized (directory) { // in- & inter-process sync
@ -627,12 +628,13 @@ public class IndexWriter {
public Object doBody() throws IOException {
// make compound file visible for SegmentReaders
directory.renameFile(mergedName + ".tmp", mergedName + ".cfs");
// delete now unused files of segment
deleteFiles(filesToDelete);
return null;
}
}.run();
}
// delete now unused files of segment
deleteFiles(filesToDelete);
}
}
@ -722,12 +724,13 @@ public class IndexWriter {
new Lock.With(directory.makeLock(COMMIT_LOCK_NAME), commitLockTimeout) {
public Object doBody() throws IOException {
segmentInfos.write(directory); // commit before deleting
deleteSegments(segmentsToDelete); // delete now-unused segments
return null;
}
}.run();
}
deleteSegments(segmentsToDelete); // delete now-unused segments
if (useCompoundFile) {
final Vector filesToDelete = merger.createCompoundFile(mergedName + ".tmp");
synchronized (directory) { // in- & inter-process sync
@ -735,12 +738,13 @@ public class IndexWriter {
public Object doBody() throws IOException {
// make compound file visible for SegmentReaders
directory.renameFile(mergedName + ".tmp", mergedName + ".cfs");
// delete now unused files of segment
deleteFiles(filesToDelete);
return null;
}
}.run();
}
// delete now unused files of segment
deleteFiles(filesToDelete);
}
}