mirror of https://github.com/apache/lucene.git
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:
parent
d9a73590a8
commit
7487fb30f3
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue