Fix bugs in LSMTree readRecords
Fix bugs in LSMTree readRecords
diff --git a/src/library/LSMTree.php b/src/library/LSMTree.php
index 5e38aa08b..e9c93e163 100644
--- a/src/library/LSMTree.php
+++ b/src/library/LSMTree.php
@@ -757,13 +757,13 @@ class Tier
self::$cache[$name_hash] = $tmp; //move to end of array
return $tmp;
}
- self::$cache[$name_hash] =
- explode($delimiter, file_get_contents($filename));
- if (count(self::$cache[$name_hash]) >= LSMTree::RECORD_CACHE_SIZE ||
+ $record = explode($delimiter, file_get_contents($filename));
+ self::$cache[$name_hash] = $record;
+ if (count(self::$cache) >= LSMTree::RECORD_CACHE_SIZE ||
memory_get_usage() >
- C\INDEX_FILE_MEMORY_LIMIT * C\MEMORY_FILL_FACTOR) {
+ metricToInt(C\INDEX_FILE_MEMORY_LIMIT) * C\MEMORY_FILL_FACTOR) {
array_shift(self::$cache);
}
- return self::$cache[$name_hash];
+ return $record;
}
}