This is an automated email from the ASF dual-hosted git repository.
huor pushed a commit to branch taoz
in repository https://gitbox.apache.org/repos/asf/hawq.git
The following commit(s) were added to refs/heads/taoz by this push:
new 2a050a1 Fix bug that deadlock cannot be resolved
2a050a1 is described below
commit 2a050a1bd063526935261e228535c5ac568486e3
Author: Ruilong Huo <[email protected]>
AuthorDate: Tue Nov 12 17:27:25 2019 +0800
Fix bug that deadlock cannot be resolved
---
src/backend/storage/lmgr/lock.c | 1 +
src/backend/storage/lmgr/proc.c | 1 +
src/test/feature/lib/sql_util.cpp | 8 +++++---
src/test/feature/lib/sql_util.h | 3 ++-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 85a6cd0..84a84f1 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -1357,6 +1357,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
locallock->lock,
locallock->tag.mode);
LWLockRelease(LockHashPartitionLock(locallock->hashcode));
+ locallock->lock->waitMask &=
LOCKBIT_OFF(locallock->tag.mode);
/*
* Now that we aren't holding the partition lock, we
can give an
* error report including details about the detected
deadlock.
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index afab97a..5bb008f 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -1179,6 +1179,7 @@ CheckDeadLock(void)
* finish.
*/
PGSemaphoreUnlock(&MyProc->sem);
+ MyProc->waitStatus = STATUS_FOUND;
/*
* We're done here. Transaction abort caused by the error that
ProcSleep
diff --git a/src/test/feature/lib/sql_util.cpp
b/src/test/feature/lib/sql_util.cpp
index 07071f4..da54c48 100644
--- a/src/test/feature/lib/sql_util.cpp
+++ b/src/test/feature/lib/sql_util.cpp
@@ -63,9 +63,11 @@ SQLUtility::SQLUtility(SQLUtilityMode mode)
schemaName = HAWQ_DEFAULT_SCHEMA;
databaseName = "db_" + string(test_info->test_case_name()) + "_" +
test_info->name();
std::transform(databaseName.begin(), databaseName.end(),
databaseName.begin(), ::tolower);
- exec("DROP DATABASE IF EXISTS " + databaseName);
- exec("CREATE DATABASE " + databaseName);
- sql_util_mode = MODE_DATABASE;
+ if (mode != MODE_DEFAULT) {
+ exec("DROP DATABASE IF EXISTS " + databaseName);
+ exec("CREATE DATABASE " + databaseName);
+ sql_util_mode = MODE_DATABASE;
+ }
}
}
diff --git a/src/test/feature/lib/sql_util.h b/src/test/feature/lib/sql_util.h
index 3bdce10..da0862b 100644
--- a/src/test/feature/lib/sql_util.h
+++ b/src/test/feature/lib/sql_util.h
@@ -45,7 +45,8 @@ struct FilePath {
enum SQLUtilityMode {
MODE_SCHEMA,
MODE_DATABASE,
- MODE_MAX_NUM
+ MODE_MAX_NUM,
+ MODE_DEFAULT
};
class SQLUtility {