guojialiang92 commented on PR #14417: URL: https://github.com/apache/lucene/pull/14417#issuecomment-2766116736
Thanks, @vigyasharma I also looked at Lucene's native segment replication, just sharing my personal opinion. > Also, IIUC `IndexWriter#advanceSegmentInfosVersion()` was added to handle similar scenarios for NRT replication (Lucene's native segment replication implementation). I'm curious why we didn't run into the need to advance `SegmentInfos#counter` at that time. Do you remember, @mikemccand (I know it's been a while! (: )? In the code comments of Lucene's native segment replication, the risk of file conflicts is also mentioned, but no additional processing is done. From a robustness perspective, perhaps control should also be carried out. The relevant code is as follows: ReplicaNode#fileIsIdentical (**Segment name was reused! This is rare but possible and otherwise devastating**) ``` private boolean fileIsIdentical(String fileName, FileMetaData srcMetaData) throws IOException { FileMetaData destMetaData = readLocalFileMetaData(fileName); if (destMetaData == null) { // Something went wrong in reading the file (it's corrupt, truncated, does not exist, etc.): return false; } if (Arrays.equals(destMetaData.header(), srcMetaData.header()) == false || Arrays.equals(destMetaData.footer(), srcMetaData.footer()) == false) { // Segment name was reused! This is rare but possible and otherwise devastating: if (isVerboseFiles()) { message("file " + fileName + ": will copy [header/footer is different]"); } return false; } else { return true; } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org