提交 05821d35 authored 作者: Noel Grandin's avatar Noel Grandin

Fix for issue #143, deadlock between two sessions hitting the same

sequence on a column
上级 137a50dc
......@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Fix for issue #143, deadlock between two sessions hitting the same sequence on a column
</li>
<li>Pull request #137: SourceCompiler should not throw a syntax error on javac warning.
</li>
<li>MVStore: out of memory while storing could corrupt the store
......
......@@ -266,13 +266,16 @@ public class Column {
* @return the new or converted value
*/
public Value validateConvertUpdateSequence(Session session, Value value) {
// take a local copy of defaultExpression to avoid holding the lock while calling getValue
final Expression localDefaultExpression;
synchronized (this) {
localDefaultExpression = defaultExpression;
}
if (value == null) {
if (defaultExpression == null) {
if (localDefaultExpression == null) {
value = ValueNull.INSTANCE;
} else {
synchronized (this) {
value = defaultExpression.getValue(session).convertTo(type);
}
value = localDefaultExpression.getValue(session).convertTo(type);
if (primaryKey) {
session.setLastIdentity(value);
}
......@@ -281,9 +284,7 @@ public class Column {
Mode mode = session.getDatabase().getMode();
if (value == ValueNull.INSTANCE) {
if (convertNullToDefault) {
synchronized (this) {
value = defaultExpression.getValue(session).convertTo(type);
}
value = localDefaultExpression.getValue(session).convertTo(type);
}
if (value == ValueNull.INSTANCE && !nullable) {
if (mode.convertInsertNullToZero) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论