Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
0e1b9a05
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0e1b9a05
编写于
3月 20, 2018
作者:
A
Ashwin Agrawal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup some FTS functions.
上级
d5fb628f
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
26 addition
and
63 deletion
+26
-63
src/backend/cdb/cdbcopy.c
src/backend/cdb/cdbcopy.c
+7
-2
src/backend/cdb/cdbfts.c
src/backend/cdb/cdbfts.c
+4
-47
src/backend/cdb/dispatcher/cdbdisp_async.c
src/backend/cdb/dispatcher/cdbdisp_async.c
+8
-7
src/backend/cdb/dispatcher/cdbdisp_thread.c
src/backend/cdb/dispatcher/cdbdisp_thread.c
+1
-1
src/backend/cdb/dispatcher/cdbgang.c
src/backend/cdb/dispatcher/cdbgang.c
+3
-3
src/backend/cdb/dispatcher/cdbgang_async.c
src/backend/cdb/dispatcher/cdbgang_async.c
+1
-0
src/backend/cdb/dispatcher/cdbgang_thread.c
src/backend/cdb/dispatcher/cdbgang_thread.c
+1
-0
src/include/cdb/cdbfts.h
src/include/cdb/cdbfts.h
+1
-3
未找到文件。
src/backend/cdb/cdbcopy.c
浏览文件 @
0e1b9a05
...
...
@@ -28,6 +28,7 @@
#include "cdb/cdbtm.h"
#include "cdb/cdbvars.h"
#include "commands/copy.h"
#include "storage/pmsignal.h"
#include "tcop/tcopprot.h"
#include "utils/faultinjector.h"
#include "utils/memutils.h"
...
...
@@ -755,8 +756,12 @@ cdbCopyEndAndFetchRejectNum(CdbCopy *c, int *total_rows_completed)
if
(
failed_count
>
0
)
{
elog
(
LOG
,
"%s"
,
c
->
err_msg
.
data
);
elog
(
LOG
,
"COPY passes failed segment(s) information to FTS"
);
FtsHandleNetFailure
(
failedSegDBs
,
failed_count
);
elog
(
LOG
,
"COPY signals FTS to probe segments"
);
SendPostmasterSignal
(
PMSIGNAL_WAKEN_FTS
);
DisconnectAndDestroyAllGangs
(
true
);
ereport
(
ERROR
,
(
errmsg_internal
(
"MPP detected %d segment failures, system is reconnected"
,
failed_count
),
errSendAlert
(
true
)));
}
pfree
(
results
);
...
...
src/backend/cdb/cdbfts.c
浏览文件 @
0e1b9a05
...
...
@@ -133,16 +133,11 @@ FtsNotifyProber(void)
* dispatcher: ONLY CALL THREADSAFE FUNCTIONS -- elog() is NOT threadsafe.
*/
bool
Fts
TestConnection
(
CdbComponentDatabaseInfo
*
failedDBInfo
,
bool
fullScan
)
Fts
IsSegmentUp
(
CdbComponentDatabaseInfo
*
dBInfo
)
{
/* master is always reported as alive */
if
(
failedDBInfo
->
segindex
==
MASTER_SEGMENT_ID
)
{
if
(
dBInfo
->
segindex
==
MASTER_SEGMENT_ID
)
return
true
;
}
if
(
fullScan
)
FtsNotifyProber
();
/*
* If fullscan is not requested, caller is just trying to optimize on the
...
...
@@ -153,43 +148,10 @@ FtsTestConnection(CdbComponentDatabaseInfo *failedDBInfo, bool fullScan)
* checking against uninitialzed variable.
*/
return
ftsProbeInfo
->
fts_statusVersion
?
FTS_STATUS_IS_UP
(
ftsProbeInfo
->
fts_status
[
failedD
BInfo
->
dbid
])
:
FTS_STATUS_IS_UP
(
ftsProbeInfo
->
fts_status
[
d
BInfo
->
dbid
])
:
true
;
}
/*
* Re-Configure the system: if someone has noticed that the status
* version has been updated, they call this to verify that they've got
* the right configuration.
*
* NOTE: This *always* destroys gangs. And also attempts to inform the
* fault-prober to do a full scan.
*/
void
FtsReConfigureMPP
(
bool
create_new_gangs
)
{
/* need to scan to pick up the latest view */
FtsNotifyProber
();
ereport
(
LOG
,
(
errmsg_internal
(
"FTS: reconfiguration is in progress"
),
errSendAlert
(
true
)));
DisconnectAndDestroyAllGangs
(
true
);
/* Caller should throw an error. */
return
;
}
void
FtsHandleNetFailure
(
SegmentDatabaseDescriptor
**
segDB
,
int
numOfFailed
)
{
elog
(
LOG
,
"FtsHandleNetFailure: numOfFailed %d"
,
numOfFailed
);
FtsReConfigureMPP
(
true
);
ereport
(
ERROR
,
(
errmsg_internal
(
"MPP detected %d segment failures, system is reconnected"
,
numOfFailed
),
errSendAlert
(
true
)));
}
/*
* Check if any segment DB is down.
*
...
...
@@ -199,7 +161,6 @@ bool
FtsTestSegmentDBIsDown
(
SegmentDatabaseDescriptor
*
segdbDesc
,
int
size
)
{
int
i
=
0
;
bool
forceRescan
=
true
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
...
...
@@ -207,21 +168,17 @@ FtsTestSegmentDBIsDown(SegmentDatabaseDescriptor *segdbDesc, int size)
elog
(
DEBUG2
,
"FtsTestSegmentDBIsDown: looking for real fault on segment dbid %d"
,
segInfo
->
dbid
);
if
(
!
Fts
TestConnection
(
segInfo
,
forceRescan
))
if
(
!
Fts
IsSegmentUp
(
segInfo
))
{
ereport
(
LOG
,
(
errmsg_internal
(
"FTS: found fault with segment dbid %d. "
"Reconfiguration is in progress"
,
segInfo
->
dbid
)));
return
true
;
}
/* only force the rescan on the first call. */
forceRescan
=
false
;
}
return
false
;
}
void
FtsCondSetTxnReadOnly
(
bool
*
XactFlag
)
{
...
...
src/backend/cdb/dispatcher/cdbdisp_async.c
浏览文件 @
0e1b9a05
...
...
@@ -766,8 +766,6 @@ signalQEs(CdbDispatchCmdAsync *pParms)
/*
* Check if any segment DB down is detected by FTS.
*
* Issue a FTS probe every 1 minute.
*/
static
void
checkSegmentAlive
(
CdbDispatchCmdAsync
*
pParms
)
...
...
@@ -776,8 +774,7 @@ checkSegmentAlive(CdbDispatchCmdAsync *pParms)
bool
forceScan
=
true
;
/*
* check the connection still valid, set 1 min time interval this may
* affect performance, should turn it off if required.
* check the connection still valid
*/
for
(
i
=
0
;
i
<
pParms
->
dispatchCount
;
i
++
)
{
...
...
@@ -799,7 +796,13 @@ checkSegmentAlive(CdbDispatchCmdAsync *pParms)
ELOG_DISPATCHER_DEBUG
(
"FTS testing connection %d of %d (%s)"
,
i
+
1
,
pParms
->
dispatchCount
,
segdbDesc
->
whoami
);
if
(
!
FtsTestConnection
(
segdbDesc
->
segment_database_info
,
forceScan
))
if
(
forceScan
)
{
FtsNotifyProber
();
forceScan
=
false
;
}
if
(
!
FtsIsSegmentUp
(
segdbDesc
->
segment_database_info
))
{
char
*
msg
=
PQerrorMessage
(
segdbDesc
->
conn
);
...
...
@@ -815,8 +818,6 @@ checkSegmentAlive(CdbDispatchCmdAsync *pParms)
PQfinish
(
segdbDesc
->
conn
);
segdbDesc
->
conn
=
NULL
;
}
forceScan
=
false
;
}
}
...
...
src/backend/cdb/dispatcher/cdbdisp_thread.c
浏览文件 @
0e1b9a05
...
...
@@ -936,7 +936,7 @@ cdbdisp_checkSegmentDBAlive(DispatchCommandParms *pParms)
WRITE_LOG_DISPATCHER_DEBUG
(
"testing connection %d of %d %s stillRunning %d"
,
i
+
1
,
pParms
->
db_count
,
segdbDesc
->
whoami
,
dispatchResult
->
stillRunning
);
if
(
!
Fts
TestConnection
(
segdbDesc
->
segment_database_info
,
false
))
if
(
!
Fts
IsSegmentUp
(
segdbDesc
->
segment_database_info
))
{
cdbdisp_appendMessage
(
dispatchResult
,
LOG
,
"Lost connection to %s. FTS detected segment failures."
,
...
...
src/backend/cdb/dispatcher/cdbgang.c
浏览文件 @
0e1b9a05
...
...
@@ -537,7 +537,7 @@ buildGangDefinition(GangType type, int gang_id, int size, int content)
if
(
size
!=
segCount
)
{
FtsReConfigureMPP
(
fals
e
);
DisconnectAndDestroyAllGangs
(
tru
e
);
elog
(
ERROR
,
"Not all primary segment instances are active and connected"
);
}
break
;
...
...
@@ -1317,7 +1317,7 @@ cleanupGang(Gang *gp)
return
false
;
/* if segment is down, the gang can not be reused */
if
(
!
Fts
TestConnection
(
segdbDesc
->
segment_database_info
,
false
))
if
(
!
Fts
IsSegmentUp
(
segdbDesc
->
segment_database_info
))
return
false
;
/* Note, we cancel all "still running" queries */
...
...
@@ -1827,7 +1827,7 @@ GangOK(Gang *gp)
if
(
cdbconn_isBadConnection
(
segdbDesc
))
return
false
;
if
(
!
Fts
TestConnection
(
segdbDesc
->
segment_database_info
,
false
))
if
(
!
Fts
IsSegmentUp
(
segdbDesc
->
segment_database_info
))
return
false
;
}
...
...
src/backend/cdb/dispatcher/cdbgang_async.c
浏览文件 @
0e1b9a05
...
...
@@ -297,6 +297,7 @@ create_gang_retry:
{
MemoryContextSwitchTo
(
GangContext
);
FtsNotifyProber
();
/* FTS shows some segment DBs are down */
if
(
FtsTestSegmentDBIsDown
(
newGangDefinition
->
db_descriptors
,
size
))
{
...
...
src/backend/cdb/dispatcher/cdbgang_thread.c
浏览文件 @
0e1b9a05
...
...
@@ -223,6 +223,7 @@ create_gang_retry:
/* there'er failed connections */
FtsNotifyProber
();
/* FTS shows some segment DBs are down, destroy all gangs. */
if
(
FtsTestSegmentDBIsDown
(
newGangDefinition
->
db_descriptors
,
size
))
{
...
...
src/include/cdb/cdbfts.h
浏览文件 @
0e1b9a05
...
...
@@ -55,9 +55,7 @@ extern volatile FtsProbeInfo *ftsProbeInfo;
extern
int
FtsShmemSize
(
void
);
extern
void
FtsShmemInit
(
void
);
extern
bool
FtsTestConnection
(
CdbComponentDatabaseInfo
*
db_to_test
,
bool
full_scan
);
extern
void
FtsReConfigureMPP
(
bool
create_new_gangs
);
extern
void
FtsHandleNetFailure
(
SegmentDatabaseDescriptor
**
,
int
);
extern
bool
FtsIsSegmentUp
(
CdbComponentDatabaseInfo
*
dBInfo
);
extern
bool
FtsTestSegmentDBIsDown
(
SegmentDatabaseDescriptor
*
,
int
);
extern
bool
verifyFtsSyncCount
(
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录