mutex control parallel replay

Code Source From: Self Code
Description:  【Optional】
Jira:  #【Optional】
市场项目编号(名称):【Optional】
This commit is contained in:
shenzhengntu 2023-06-27 14:22:06 +08:00
parent b7b55615eb
commit ca0862b157

View File

@ -490,6 +490,7 @@ void pushSlaveReplayQueue(int pageNum) {
SpinLockRelease(&PageHashQueueShmem->mutex);
WakeupFlushWork();
}
while(pageNum > CompletedTaskNum()) {
pg_usleep(1000L);
}
@ -662,12 +663,14 @@ void SortPageQueue(void) {
BufferTag* QueuePushPage(void) {
uint32_t gpushpos;
bool hasData = false;
SpinLockAcquire(&PageHashQueueShmem->mutex);
if (PageHashQueueShmem->ready == true && PageHashQueueShmem->gpushpos < PageHashQueueShmem->gpos) {
hasData = true;
gpushpos = PageHashQueueShmem->gpushpos++;
if (PageHashQueueShmem->ready == true) {
SpinLockAcquire(&PageHashQueueShmem->mutex);
if (PageHashQueueShmem->ready == true && PageHashQueueShmem->gpushpos < PageHashQueueShmem->gpos) {
hasData = true;
gpushpos = PageHashQueueShmem->gpushpos++;
}
SpinLockRelease(&PageHashQueueShmem->mutex);
}
SpinLockRelease(&PageHashQueueShmem->mutex);
if (hasData == false) {
return NULL;
} else {