mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
Core: don't listAll twice
In #6636 we switched to a default FileSwitchDirectory that made .listAll run twice on the same underlying file system directory. This fixes listAll to do a single directory listing again. Closes #9666
This commit is contained in:
parent
98aad1bcbd
commit
6867f4a3fa
@ -50,6 +50,13 @@ public class DefaultFsDirectoryService extends FsDirectoryService {
|
||||
|
||||
@Override
|
||||
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
|
||||
return new FileSwitchDirectory(PRIMARY_EXTENSIONS, new MMapDirectory(location, lockFactory), new NIOFSDirectory(location, lockFactory), true);
|
||||
final MMapDirectory mmapDir = new MMapDirectory(location, lockFactory);
|
||||
return new FileSwitchDirectory(PRIMARY_EXTENSIONS, mmapDir, new NIOFSDirectory(location, lockFactory), true) {
|
||||
@Override
|
||||
public String[] listAll() throws IOException {
|
||||
// Avoid doing listAll twice:
|
||||
return mmapDir.listAll();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user