提交 ab5883c5 authored 作者: andrei's avatar andrei

code review 3

上级 55b07c4c
...@@ -941,7 +941,7 @@ public final class DataUtils { ...@@ -941,7 +941,7 @@ public final class DataUtils {
* @return the parsed value * @return the parsed value
* @throws IllegalStateException if parsing fails * @throws IllegalStateException if parsing fails
*/ */
public static long readHexLong(Map<String,?> map, String key, long defaultValue) { public static long readHexLong(Map<String, ?> map, String key, long defaultValue) {
Object v = map.get(key); Object v = map.get(key);
if (v == null) { if (v == null) {
return defaultValue; return defaultValue;
...@@ -1005,7 +1005,7 @@ public final class DataUtils { ...@@ -1005,7 +1005,7 @@ public final class DataUtils {
* @return the parsed value * @return the parsed value
* @throws IllegalStateException if parsing fails * @throws IllegalStateException if parsing fails
*/ */
public static int readHexInt(Map<String,?> map, String key, int defaultValue) { public static int readHexInt(Map<String, ?> map, String key, int defaultValue) {
Object v = map.get(key); Object v = map.get(key);
if (v == null) { if (v == null) {
return defaultValue; return defaultValue;
......
...@@ -172,7 +172,7 @@ public class FreeSpaceBitSet { ...@@ -172,7 +172,7 @@ public class FreeSpaceBitSet {
if (cardinality == 0) { if (cardinality == 0) {
return 0; return 0;
} }
return (int)(100L * cardinality / set.length()); return Math.max(1, (int)(100L * cardinality / set.length()));
} }
/** /**
......
...@@ -72,7 +72,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -72,7 +72,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
} }
// constructor for cloneIt() // constructor for cloneIt()
protected MVMap(MVMap<K,V> source) { protected MVMap(MVMap<K, V> source) {
this(source.store, source.keyType, source.valueType, source.id, source.createVersion, this(source.store, source.keyType, source.valueType, source.id, source.createVersion,
new AtomicReference<>(source.root.get())); new AtomicReference<>(source.root.get()));
} }
...@@ -93,7 +93,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -93,7 +93,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
this.root = root; this.root = root;
} }
protected MVMap<K,V> cloneIt() { protected MVMap<K, V> cloneIt() {
return new MVMap<>(this); return new MVMap<>(this);
} }
...@@ -1356,7 +1356,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -1356,7 +1356,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
} }
@Override @Override
public Builder<K,V> valueType(DataType dataType) { public Builder<K, V> valueType(DataType dataType) {
setValueType(dataType); setValueType(dataType);
return this; return this;
} }
......
...@@ -197,7 +197,7 @@ public final class MVStore { ...@@ -197,7 +197,7 @@ public final class MVStore {
* The map of temporarily freed storage space caused by freed pages. * The map of temporarily freed storage space caused by freed pages.
* It contains the number of freed entries per chunk. * It contains the number of freed entries per chunk.
*/ */
private final Map<Integer,Chunk> freedPageSpace = new HashMap<>(); private final Map<Integer, Chunk> freedPageSpace = new HashMap<>();
/** /**
* The metadata map. Write access to this map needs to be synchronized on * The metadata map. Write access to this map needs to be synchronized on
...@@ -524,10 +524,10 @@ public final class MVStore { ...@@ -524,10 +524,10 @@ public final class MVStore {
return map; return map;
} }
public <K,V> MVMap<K,V> getMap(int id) { public <K, V> MVMap<K,V> getMap(int id) {
checkOpen(); checkOpen();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
MVMap<K,V> map = (MVMap<K, V>) maps.get(id); MVMap<K, V> map = (MVMap<K, V>) maps.get(id);
return map; return map;
} }
......
...@@ -736,7 +736,7 @@ public class TestMVTableEngine extends TestBase { ...@@ -736,7 +736,7 @@ public class TestMVTableEngine extends TestBase {
conn.close(); conn.close();
long sizeNew = FileUtils.size(getBaseDir() + "/" + getTestName() long sizeNew = FileUtils.size(getBaseDir() + "/" + getTestName()
+ Constants.SUFFIX_MV_FILE); + Constants.SUFFIX_MV_FILE);
System.out.println("new: " + sizeNew + " old: " + sizeOld); println("new: " + sizeNew + " old: " + sizeOld);
// assertTrue("new: " + sizeNew + " old: " + sizeOld, sizeNew < sizeOld); // assertTrue("new: " + sizeNew + " old: " + sizeOld, sizeNew < sizeOld);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论