Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f4694669
提交
f4694669
authored
11月 26, 2017
作者:
Owner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed meta locking bug in shadow table
上级
76547b6c
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
36 行增加
和
34 行删除
+36
-34
Parser.java
h2/src/main/org/h2/command/Parser.java
+1
-0
DropTable.java
h2/src/main/org/h2/command/ddl/DropTable.java
+1
-1
DropView.java
h2/src/main/org/h2/command/ddl/DropView.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+33
-32
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
f4694669
...
@@ -5309,6 +5309,7 @@ public class Parser {
...
@@ -5309,6 +5309,7 @@ public class Parser {
}
else
{
}
else
{
targetSession
.
removeLocalTempTable
(
recursiveTable
);
targetSession
.
removeLocalTempTable
(
recursiveTable
);
}
}
targetSession
.
getDatabase
().
unlockMeta
(
targetSession
);
}
}
}
}
...
...
h2/src/main/org/h2/command/ddl/DropTable.java
浏览文件 @
f4694669
...
@@ -100,7 +100,7 @@ public class DropTable extends SchemaCommand {
...
@@ -100,7 +100,7 @@ public class DropTable extends SchemaCommand {
Database
db
=
session
.
getDatabase
();
Database
db
=
session
.
getDatabase
();
db
.
lockMeta
(
session
);
db
.
lockMeta
(
session
);
db
.
removeSchemaObject
(
session
,
table
);
db
.
removeSchemaObject
(
session
,
table
);
session
.
getDatabase
().
flushDeferredRemoveSchemaObject
();
//
session.getDatabase().flushDeferredRemoveSchemaObject();
}
}
if
(
next
!=
null
)
{
if
(
next
!=
null
)
{
next
.
executeDrop
();
next
.
executeDrop
();
...
...
h2/src/main/org/h2/command/ddl/DropView.java
浏览文件 @
f4694669
...
@@ -78,7 +78,7 @@ public class DropView extends SchemaCommand {
...
@@ -78,7 +78,7 @@ public class DropView extends SchemaCommand {
view
.
lock
(
session
,
true
,
true
);
view
.
lock
(
session
,
true
,
true
);
session
.
getDatabase
().
removeSchemaObject
(
session
,
view
);
session
.
getDatabase
().
removeSchemaObject
(
session
,
view
);
session
.
getDatabase
().
unlockMeta
(
session
);
session
.
getDatabase
().
unlockMeta
(
session
);
session
.
getDatabase
().
flushDeferredRemoveSchemaObject
();
//
session.getDatabase().flushDeferredRemoveSchemaObject();
// remove dependent table expressions
// remove dependent table expressions
for
(
Table
childTable:
copyOfDependencies
){
for
(
Table
childTable:
copyOfDependencies
){
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
f4694669
...
@@ -11,8 +11,8 @@ import java.util.ArrayList;
...
@@ -11,8 +11,8 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Iterator
;
//
import java.util.Iterator;
import
java.util.Map.Entry
;
//
import java.util.Map.Entry;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
...
@@ -204,7 +204,7 @@ public class Database implements DataHandler {
...
@@ -204,7 +204,7 @@ public class Database implements DataHandler {
private
int
queryStatisticsMaxEntries
=
Constants
.
QUERY_STATISTICS_MAX_ENTRIES
;
private
int
queryStatisticsMaxEntries
=
Constants
.
QUERY_STATISTICS_MAX_ENTRIES
;
private
QueryStatisticsData
queryStatisticsData
;
private
QueryStatisticsData
queryStatisticsData
;
private
RowFactory
rowFactory
=
RowFactory
.
DEFAULT
;
private
RowFactory
rowFactory
=
RowFactory
.
DEFAULT
;
private
ConcurrentHashMap
<
SchemaObject
,
Session
>
removeSchemaObjectQueue
=
new
ConcurrentHashMap
<>();
//
private ConcurrentHashMap<SchemaObject, Session> removeSchemaObjectQueue = new ConcurrentHashMap<>();
public
Database
(
ConnectionInfo
ci
,
String
cipher
)
{
public
Database
(
ConnectionInfo
ci
,
String
cipher
)
{
String
name
=
ci
.
getName
();
String
name
=
ci
.
getName
();
...
@@ -925,7 +925,8 @@ public class Database implements DataHandler {
...
@@ -925,7 +925,8 @@ public class Database implements DataHandler {
final
Session
prev
=
metaLockDebugging
.
get
();
final
Session
prev
=
metaLockDebugging
.
get
();
if
(
prev
==
null
)
{
if
(
prev
==
null
)
{
metaLockDebugging
.
set
(
session
);
metaLockDebugging
.
set
(
session
);
metaLockDebuggingStack
.
set
(
new
Throwable
());
metaLockDebuggingStack
.
set
(
new
Throwable
(
"Last meta lock granted in this stack trace, "
+
"this is debug information for following IllegalStateException"
));
}
else
if
(
prev
!=
session
)
{
}
else
if
(
prev
!=
session
)
{
metaLockDebuggingStack
.
get
().
printStackTrace
();
metaLockDebuggingStack
.
get
().
printStackTrace
();
throw
new
IllegalStateException
(
"meta currently locked by "
throw
new
IllegalStateException
(
"meta currently locked by "
...
@@ -1932,12 +1933,12 @@ public class Database implements DataHandler {
...
@@ -1932,12 +1933,12 @@ public class Database implements DataHandler {
}
}
}
}
checkWritingAllowed
();
checkWritingAllowed
();
Boolean
wasLocked
=
lockMetaNoWait
(
session
);
// was
/*Boolean wasLocked = */
lockMeta
(
session
);
// was lockMetaNoWait
if
(
wasLocked
==
null
){
//
if(wasLocked==null){
removeSchemaObjectQueue
.
put
(
obj
,
session
);
//
removeSchemaObjectQueue.put(obj,session);
System
.
out
.
println
(
"deferred removal scheduled="
+
obj
.
getName
()+
",wasLocked="
+
wasLocked
);
//
System.out.println("deferred removal scheduled="+obj.getName()+",wasLocked="+wasLocked);
return
false
;
//
return false;
}
//
}
synchronized
(
this
)
{
synchronized
(
this
)
{
//String savedName = obj.getName();
//String savedName = obj.getName();
Comment
comment
=
findComment
(
obj
);
Comment
comment
=
findComment
(
obj
);
...
@@ -1963,33 +1964,33 @@ public class Database implements DataHandler {
...
@@ -1963,33 +1964,33 @@ public class Database implements DataHandler {
removeMeta
(
session
,
id
);
removeMeta
(
session
,
id
);
flushDeferredRemoveSchemaObject
();
//
flushDeferredRemoveSchemaObject();
return
true
;
return
true
;
}
}
}
}
public
void
flushDeferredRemoveSchemaObject
()
{
//
public void flushDeferredRemoveSchemaObject() {
boolean
progress
=
true
;
//
boolean progress = true;
while
(
progress
){
//
while(progress){
progress
=
false
;
//
progress = false;
Iterator
<
Entry
<
SchemaObject
,
Session
>>
i
=
removeSchemaObjectQueue
.
entrySet
().
iterator
();
//
Iterator<Entry<SchemaObject, Session>> i = removeSchemaObjectQueue.entrySet().iterator();
while
(
i
.
hasNext
()){
//
while(i.hasNext()){
Entry
<
SchemaObject
,
Session
>
pair
=
i
.
next
();
//
Entry<SchemaObject, Session> pair = i.next();
i
.
remove
();
//
i.remove();
//System.out.println("re-attempting deferred removal="+pair.getKey().getName()+",size="+removeSchemaObjectQueue.size());
//
//System.out.println("re-attempting deferred removal="+pair.getKey().getName()+",size="+removeSchemaObjectQueue.size());
progress
=
removeSchemaObject
(
pair
.
getValue
(),
pair
.
getKey
());
//
progress = removeSchemaObject(pair.getValue(),pair.getKey());
if
(
progress
){
//
if(progress){
//System.out.println("completed deferred removal="+pair.getKey().getName()+",size="+removeSchemaObjectQueue.size());
//
//System.out.println("completed deferred removal="+pair.getKey().getName()+",size="+removeSchemaObjectQueue.size());
unlockMeta
(
pair
.
getValue
());
//
unlockMeta(pair.getValue());
}
//
}
}
//
}
}
//
}
//System.out.println("flushDeferredRemoveSchemaObject.remove_q_size="+removeSchemaObjectQueue.size());
//
//System.out.println("flushDeferredRemoveSchemaObject.remove_q_size="+removeSchemaObjectQueue.size());
if
(
removeSchemaObjectQueue
.
size
()!=
0
){
//
if(removeSchemaObjectQueue.size()!=0){
traceLock
();
//
traceLock();
}
//
}
}
//
}
/**
/**
* Check if this database is disk-based.
* Check if this database is disk-based.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论