mirror of https://github.com/apache/lucene.git
LUCENE-4190: revert. lucene isn't a file manager
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1357532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e91e59af95
commit
80c5475725
|
@ -15,11 +15,6 @@ New features
|
|||
create automata from a fixed collection of UTF-8 encoded BytesRef
|
||||
(Dawid Weiss, Robert Muir)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-4190: Don't delete files in the index directory unless they
|
||||
begin with an underscore. (Mike McCandless, Robert Muir)
|
||||
|
||||
API Changes
|
||||
|
||||
* LUCENE-4138: update of morfologik (Polish morphological analyzer) to 1.5.3.
|
||||
|
|
|
@ -149,8 +149,7 @@ final class IndexFileDeleter {
|
|||
|
||||
for (String fileName : files) {
|
||||
|
||||
if (!fileName.endsWith("write.lock") && !fileName.equals(IndexFileNames.SEGMENTS_GEN)
|
||||
&& (fileName.startsWith("_") || fileName.startsWith(IndexFileNames.SEGMENTS))) {
|
||||
if (!fileName.endsWith("write.lock") && !fileName.equals(IndexFileNames.SEGMENTS_GEN)) {
|
||||
|
||||
// Add this file to refCounts with initial count 0:
|
||||
getRefCount(fileName);
|
||||
|
|
|
@ -244,27 +244,14 @@ public final class SegmentInfo {
|
|||
public void setFiles(Set<String> files) {
|
||||
setFiles = files;
|
||||
sizeInBytes = -1;
|
||||
assert assertSaneFileNames();
|
||||
}
|
||||
|
||||
public void addFiles(Collection<String> files) {
|
||||
setFiles.addAll(files);
|
||||
sizeInBytes = -1;
|
||||
assert assertSaneFileNames();
|
||||
}
|
||||
|
||||
public void addFile(String file) {
|
||||
setFiles.add(file);
|
||||
sizeInBytes = -1;
|
||||
assert assertSaneFileNames();
|
||||
}
|
||||
|
||||
// used only by assert
|
||||
private boolean assertSaneFileNames() {
|
||||
for (String file : setFiles) {
|
||||
assert file.startsWith("_") : "invalid codec filename: " + file ;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,13 +125,13 @@ public class TestDoc extends LuceneTestCase {
|
|||
printSegment(out, si2);
|
||||
writer.close();
|
||||
|
||||
SegmentInfoPerCommit siMerge = merge(directory, si1, si2, "_merge", false);
|
||||
SegmentInfoPerCommit siMerge = merge(directory, si1, si2, "merge", false);
|
||||
printSegment(out, siMerge);
|
||||
|
||||
SegmentInfoPerCommit siMerge2 = merge(directory, si1, si2, "_merge2", false);
|
||||
SegmentInfoPerCommit siMerge2 = merge(directory, si1, si2, "merge2", false);
|
||||
printSegment(out, siMerge2);
|
||||
|
||||
SegmentInfoPerCommit siMerge3 = merge(directory, siMerge, siMerge2, "_merge3", false);
|
||||
SegmentInfoPerCommit siMerge3 = merge(directory, siMerge, siMerge2, "merge3", false);
|
||||
printSegment(out, siMerge3);
|
||||
|
||||
directory.close();
|
||||
|
@ -160,13 +160,13 @@ public class TestDoc extends LuceneTestCase {
|
|||
printSegment(out, si2);
|
||||
writer.close();
|
||||
|
||||
siMerge = merge(directory, si1, si2, "_merge", true);
|
||||
siMerge = merge(directory, si1, si2, "merge", true);
|
||||
printSegment(out, siMerge);
|
||||
|
||||
siMerge2 = merge(directory, si1, si2, "_merge2", true);
|
||||
siMerge2 = merge(directory, si1, si2, "merge2", true);
|
||||
printSegment(out, siMerge2);
|
||||
|
||||
siMerge3 = merge(directory, siMerge, siMerge2, "_merge3", true);
|
||||
siMerge3 = merge(directory, siMerge, siMerge2, "merge3", true);
|
||||
printSegment(out, siMerge3);
|
||||
|
||||
directory.close();
|
||||
|
|
|
@ -45,7 +45,6 @@ import org.apache.lucene.search.ScoreDoc;
|
|||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.store.AlreadyClosedException;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
import org.apache.lucene.store.Lock;
|
||||
import org.apache.lucene.store.LockFactory;
|
||||
import org.apache.lucene.store.LockObtainFailedException;
|
||||
|
@ -1800,23 +1799,4 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
r.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
//LUCENE-1468 -- make sure opening an IndexWriter with
|
||||
// create=true does not remove non-index files
|
||||
|
||||
public void testOtherFiles() throws Throwable {
|
||||
Directory dir = newDirectory();
|
||||
try {
|
||||
// Create my own random file:
|
||||
IndexOutput out = dir.createOutput("myrandomfile", newIOContext(random()));
|
||||
out.writeByte((byte) 42);
|
||||
out.close();
|
||||
|
||||
new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random()))).close();
|
||||
|
||||
assertTrue(dir.fileExists("myrandomfile"));
|
||||
} finally {
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue