-
Notifications
You must be signed in to change notification settings - Fork 427
Open
Description
// Version.java
public LookupResult get(LookupKey key)
{
LookupResult lookupResult = level0.get(key, readStats);
if (lookupResult == null) {
for (Level level : levels) {
lookupResult = level.get(key, readStats);
...
}
}
...
return lookupResult;
}
// Level0.java
public LookupResult get(LookupKey key, ReadStats readStats)
{
...
List<FileMetaData> fileMetaDataList = new ArrayList<>(files.size());
for (FileMetaData fileMetaData : files) {
if (...) {
fileMetaDataList.add(fileMetaData);
}
}
Collections.sort(fileMetaDataList, NEWEST_FIRST);
...
}
// Level.java
public LookupResult get(LookupKey key, ReadStats readStats)
{
...
List<FileMetaData> fileMetaDataList = new ArrayList<>(files.size());
if (levelNumber == 0) { // Do we really need to judge this condition ?
for (FileMetaData fileMetaData : files) {
if (...) {
fileMetaDataList.add(fileMetaData);
}
}
}
else {
// Binary search to find earliest index whose largest key >= ikey.
}
...
}In the above function, level0.get() and level.get() are called respectively. However, In the implementation of the former, calls the sort function Collections.sort(fileMetaDataList, NEWEST_FIRST); to make the newer files in front of the list while the other call doesn't. So do we need this sort function call or not? And why get function in Level.java should consider the situation of level0?
Metadata
Metadata
Assignees
Labels
No labels