提交 dc31cd5f authored 作者: S.Vladykin's avatar S.Vladykin

Merge branch 'master' of https://github.com/h2database/h2database into row

......@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Server mode: executing "shutdown" left a thread on the server.
</li>
<li>The condition "in(select...)" did not work correctly in some cases if the subquery had an "order by".
</li>
<li>Issue #184: The Platform-independent zip had Windows line endings in Linux scripts.
......
......@@ -177,10 +177,9 @@ When using one of the following features for production, please ensure your use
is well tested (if possible with automated test cases). The areas that are not well tested are:
</p>
<ul>
<li>Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.6 or 1.7
<li>Platforms other than Windows, Linux, Mac OS X, or JVMs other than Oracle 1.6, 1.7, 1.8.
</li><li>The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code>.
</li><li>Cluster mode, 2-phase commit, savepoints.
</li><li>24/7 operation.
</li><li>Fulltext search.
</li><li>Operations on LOBs over 2 GB.
</li><li>The optimizer may not always select the best plan.
......
......@@ -122,7 +122,7 @@ public class SysProperties {
//*/
/**
* System property <code>h2.check2</code> (default: true).<br />
* System property <code>h2.check2</code> (default: false).<br />
* Additional assertions in the database engine.
*/
//## CHECK ##
......
......@@ -12,6 +12,9 @@ import java.nio.ByteBuffer;
*/
public class WriteBuffer {
/**
* The maximum size of the buffer in order to be re-used after a clear operation.
*/
private static final int MAX_REUSE_CAPACITY = 4 * 1024 * 1024;
/**
......@@ -19,9 +22,24 @@ public class WriteBuffer {
*/
private static final int MIN_GROW = 1024 * 1024;
private ByteBuffer reuse = ByteBuffer.allocate(MIN_GROW);
/**
* The buffer that is used after a clear operation.
*/
private ByteBuffer reuse;
/**
* The current buffer (may be replaced if it is too small).
*/
private ByteBuffer buff;
private ByteBuffer buff = reuse;
public WriteBuffer(int initialSize) {
reuse = ByteBuffer.allocate(initialSize);
buff = reuse;
}
public WriteBuffer() {
this(MIN_GROW);
}
/**
* Write a variable size integer.
......
......@@ -347,6 +347,7 @@ public class TcpServerThread implements Runnable {
int status;
if (session.isClosed()) {
status = SessionRemote.STATUS_CLOSED;
stop = true;
} else {
status = getState(old);
}
......
......@@ -332,21 +332,20 @@ public class ToChar {
private static String zeroesAfterDecimalSeparator(BigDecimal number) {
final String numberStr = number.toString();
final int idx = numberStr.indexOf('.');
if (idx >= 0 ) {
int i = idx + 1;
boolean allZeroes = true;
for (; i < numberStr.length(); i++) {
if (numberStr.charAt(i) != '0') {
allZeroes = false;
break;
}
}
final char[] zeroes = new char[allZeroes ? numberStr.length() - idx - 1: i - 1 - idx];
Arrays.fill(zeroes, '0');
return String.valueOf(zeroes);
} else {
if (idx < 0) {
return "";
}
int i = idx + 1;
boolean allZeroes = true;
for (; i < numberStr.length(); i++) {
if (numberStr.charAt(i) != '0') {
allZeroes = false;
break;
}
}
final char[] zeroes = new char[allZeroes ? numberStr.length() - idx - 1: i - 1 - idx];
Arrays.fill(zeroes, '0');
return String.valueOf(zeroes);
}
private static void addSign(StringBuilder output, int signum,
......
......@@ -203,8 +203,8 @@ public class BinaryArithmeticStream {
Node n = tree;
for (int i = bitCount; i >= 0; i--) {
boolean goRight = ((code >> i) & 1) == 1;
int prob = MAX_PROBABILITY *
n.right.frequency / n.frequency;
int prob = (int) ((long) MAX_PROBABILITY *
n.right.frequency / n.frequency);
out.writeBit(goRight, prob);
n = goRight ? n.right : n.left;
}
......@@ -219,8 +219,8 @@ public class BinaryArithmeticStream {
public int read(In in) throws IOException {
Node n = tree;
while (n.left != null) {
int prob = MAX_PROBABILITY *
n.right.frequency / n.frequency;
int prob = (int) ((long) MAX_PROBABILITY *
n.right.frequency / n.frequency);
boolean goRight = in.readBit(prob);
n = goRight ? n.right : n.left;
}
......
......@@ -245,6 +245,17 @@ public class BitStream {
return n.value;
}
/**
* Get the number of bits of the Huffman code for this value.
*
* @param value the value
* @return the number of bits
*/
public int getBitCount(int value) {
int code = codes[value];
return 30 - Integer.numberOfLeadingZeros(code);
}
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论