LUCENE-3728: tidy up copySegmentAsIs/sharedDocStore logic

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3661@1237637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-01-30 13:10:47 +00:00
parent d9a73590a8
commit 7487fb30f3
2 changed files with 9 additions and 20 deletions

View File

@ -2545,23 +2545,21 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
// only relevant for segments that share doc store with others,
// because the DS might have been copied already, in which case we
// just want to update the DS name of this SegmentInfo.
// NOTE: pre-3x segments include a null DSName if they don't share doc
// store. The following code ensures we don't accidentally insert
// 'null' to the map.
String dsName = info.getDocStoreSegment();
assert dsName != null;
final String newDsName;
if (dsName != null) {
if (dsNames.containsKey(dsName)) {
newDsName = dsNames.get(dsName);
} else {
dsNames.put(dsName, segName);
newDsName = segName;
}
if (dsNames.containsKey(dsName)) {
newDsName = dsNames.get(dsName);
} else {
dsNames.put(dsName, segName);
newDsName = segName;
}
Set<String> codecDocStoreFiles = info.codecDocStoreFiles();
// nocommit: remove this
Set<String> codecDocStoreFiles = new HashSet<String>();
codec.storedFieldsFormat().files(info, codecDocStoreFiles);
codec.termVectorsFormat().files(info, codecDocStoreFiles);
// Copy the segment files
for (String file: info.files()) {
final String newFileName;

View File

@ -218,15 +218,6 @@ public final class SegmentInfo implements Cloneable {
sizeInBytes = sum;
return sizeInBytes;
}
// nocommit: wrong to call this if (compoundFile)
// wrong to call this at all... nuke it
Set<String> codecDocStoreFiles() throws IOException {
Set<String> docStoreFiles = new HashSet<String>();
codec.storedFieldsFormat().files(this, docStoreFiles);
codec.termVectorsFormat().files(this, docStoreFiles);
return docStoreFiles;
}
public boolean getHasVectors() throws IOException {
return hasVectors == CHECK_FIELDINFO ? getFieldInfos().hasVectors() : hasVectors == YES;