HAWQ-1722. Fix core dump due to lock is not released before reporting errors when exceeding MaxAORelSegFileStatus
diff --git a/src/backend/access/appendonly/appendonlywriter.c b/src/backend/access/appendonly/appendonlywriter.c
index 63b6bc2..addd33e 100644
--- a/src/backend/access/appendonly/appendonlywriter.c
+++ b/src/backend/access/appendonly/appendonlywriter.c
@@ -423,6 +423,8 @@
{
pfree(allfsinfoParquet);
+ LWLockRelease(AOSegFileLock);
+
ereport(ERROR, (errmsg("cannot open more than %d "
"append-only table segment "
"files cocurrently",
@@ -458,6 +460,8 @@
{
pfree(allfsinfo);
+ LWLockRelease(AOSegFileLock);
+
ereport(ERROR, (errmsg("cannot open more than %d "
"append-only table segment "
"files cocurrently",
@@ -1147,6 +1151,7 @@
if (new_status == NEXT_END_OF_LIST)
{
LWLockRelease(AOSegFileLock);
+
ereport(ERROR, (errmsg("cannot open more than %d append-only table segment files concurrently",
MaxAORelSegFileStatus)));
}