255 Star 675 Fork 495

GVPopenGauss / openGauss-server

 / 详情

t_thrd.shemem_ptr_cxt.XLogCtl中的一些变量未被info_lck锁包含

Backlog
Bug
Opened this issue  
2021-10-08 15:44

【标题描述】:
在xlog.cpp的以下部分,t_thrd.shemem_ptr_cxt.XLogCtl里的一些变量访问未在t_thrd.shemem_ptr_cxt.XLogCtl->info_lck的保护中,在并发访问的时候会产生问题。

void GetFullPageWriteInfo(XLogFPWInfo *fpwInfo_p)
{
    ...
    fpwInfo_p->forcePageWrites = t_thrd.shemem_ptr_cxt.XLogCtl->FpwBeforeFirstCkpt && !IsInitdb && !ENABLE_INCRE_CKPT;
    ...
}
bool CheckFpwBeforeFirstCkpt(void)
{
    volatile XLogCtlData *xlogctl = t_thrd.shemem_ptr_cxt.XLogCtl;
    return xlogctl->FpwBeforeFirstCkpt;
}
static void KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo, XLogRecPtr curInsert)
{
    ...
    uint64 walSize = (curInsert - xlogctl->lastRemovedSegNo * XLOG_SEG_SIZE) +
                     (uint64)XLOGfileslop * XLOG_SEG_SIZE;
    ...
}
static void XLogWrite(const XLogwrtRqst &WriteRqst, bool flexible)
{
    *t_thrd.xlog_cxt.LogwrtResult = t_thrd.shemem_ptr_cxt.XLogCtl->LogwrtResult;
}

【测试类型:并发】【测试版本:2.0.0】
【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a):
openEuler release 20.03
Linux 4.19.90-2003.4.0.0036.oe1.aarch64

【测试环境】(单机/1主x备x级联备): 单机

【被测功能】:无

【测试类型】:无

【数据库版本】(查询命令: gaussdb –V): 2.0.0

【预置条件】:无

【操作步骤】(请填写详细的操作步骤):无

【预期输出】:无

【实际输出】:无

【原因分析】:现未找到bug出现场景,但分析code发现有问题。

【日志信息】(请附上日志文件、截图、coredump信息):无

【测试代码】:无

Comments (4)

Hey @wangchunling , Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss-bot .
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at https://gitee.com/opengauss/community/blob/master/contributors/command.en.md to find the details.

wangchunling created缺陷
wangchunling set related repository to openGauss/openGauss-server
Expand operation logs

this issue can not be assigned to: @wangchunling .
please try to assign to the repository collaborators.

wangchunling changed description
wangchunling changed description

fpwInfo_p->forcePageWrites如果加锁,GetFullPageWriteInfo()会在XLogInsert的关键路径上,导致tpcc性能下降70~80%。根据code逻辑分析,即使不加锁,唯一误判的情况是把fpwInfo_p->forcePageWritesfalse当成true,仅在极少的情况下出现,也只会在log里多做几次full page write,短暂影响很少性能,故不修改。

zhangxubo added
 
sig/storageengine
label

Sign in to comment

Status
Assignees
Projects
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
Confirm
参与者(2)
5622128 opengauss bot 1581905080
C++
1
https://git.oschina.net/opengauss/openGauss-server.git
git@git.oschina.net:opengauss/openGauss-server.git
opengauss
openGauss-server
openGauss-server

Search