mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-11-29 18:58:35 +08:00
suppoort private deploy
Signed-off-by: shipixian <shipixian_yewu@cmss.chinamobile.com>
This commit is contained in:
parent
2806e90663
commit
7ada515ad4
@ -668,7 +668,7 @@ XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum,
|
||||
}
|
||||
}
|
||||
|
||||
if (!he3mirror && mode == RBM_NORMAL)
|
||||
if (he3share && !he3mirror && mode == RBM_NORMAL)
|
||||
{
|
||||
/* check that page has been initialized */
|
||||
Page page = (Page) BufferGetPage(buffer);
|
||||
|
@ -925,7 +925,7 @@ smgr_redo(XLogReaderState *record)
|
||||
reln = smgropen(xlrec->rnode, InvalidBackendId);
|
||||
|
||||
/* He3DB: propeller instance and He3DB slave instance not create rel file*/
|
||||
if (*isPromoteIsTriggered || !EnableHotStandby || he3mirror)
|
||||
if (*isPromoteIsTriggered || !EnableHotStandby || he3mirror || !he3share)
|
||||
{
|
||||
smgrcreate(reln, xlrec->forkNum, true);
|
||||
}
|
||||
@ -949,7 +949,7 @@ smgr_redo(XLogReaderState *record)
|
||||
* log as best we can until the drop is seen.
|
||||
*/
|
||||
/* He3DB: propeller instance and He3DB slave instance not create rel file*/
|
||||
if (*isPromoteIsTriggered || !EnableHotStandby || he3mirror)
|
||||
if (*isPromoteIsTriggered || !EnableHotStandby || he3mirror || !he3share)
|
||||
{
|
||||
smgrcreate(reln, MAIN_FORKNUM, true);
|
||||
}
|
||||
|
@ -2260,6 +2260,26 @@ dbase_redo(XLogReaderState *record)
|
||||
/* He3DB: propeller instance and He3DB slave instance not create db file*/
|
||||
if (!EnableHotStandby || *isPromoteIsTriggered || he3mirror || !he3share)
|
||||
{
|
||||
// int count = 0;
|
||||
// for (;;)
|
||||
// {
|
||||
// XLogRecPtr pushlsn;
|
||||
// XLogRecPtr lastlsn = record->currRecPtr;
|
||||
// pushlsn = QueryPushChkpointLsn();
|
||||
// if (pushlsn == InvalidXLogRecPtr)
|
||||
// ereport(ERROR,
|
||||
// (errcode(ERRCODE_INTERNAL_ERROR),
|
||||
// errmsg("push standby's latest apply lsn shouldn't be 0")));
|
||||
// if (lastlsn <= pushlsn)
|
||||
// break;
|
||||
// if (count > 100)
|
||||
// ereport(ERROR,
|
||||
// (errcode(ERRCODE_INTERNAL_ERROR),
|
||||
// errmsg("push standby's latest apply lsn(%X/%X) is still behind primary(%X/%X) after try 100 times.",
|
||||
// LSN_FORMAT_ARGS(pushlsn), LSN_FORMAT_ARGS(lastlsn))));
|
||||
// pg_usleep(1000000L);
|
||||
// count++;
|
||||
// }
|
||||
copydir(src_path, dst_path, false);
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ TagNode *GetBufTagByLsnRange(XLogRecPtr start_lsn, XLogRecPtr end_lsn)
|
||||
if(mem_tbl->meta.max_lsn < start_lsn)
|
||||
{
|
||||
continue;
|
||||
}else if(mem_tbl->meta.min_lsn >= end_lsn)
|
||||
}else if(mem_tbl->meta.min_lsn > end_lsn)
|
||||
{
|
||||
// there is no suitability lsn_list after this mem table
|
||||
LWLockRelease(LogIndexMemListLock);
|
||||
@ -628,7 +628,7 @@ TagNode *GetBufTagByLsnRange(XLogRecPtr start_lsn, XLogRecPtr end_lsn)
|
||||
page_min_lsn = LOG_INDEX_COMBINE_LSN(mem_tbl, first_seg->suffix_lsn[0]);
|
||||
uint8 id = Min(LOG_INDEX_MEM_ITEM_SEG_LSN_NUM - 1, last_seg->number - 1);
|
||||
page_max_lsn = LOG_INDEX_COMBINE_LSN(mem_tbl, last_seg->suffix_lsn[id]);
|
||||
if(page_min_lsn >= end_lsn || page_max_lsn < start_lsn)
|
||||
if(page_min_lsn > end_lsn || page_max_lsn < start_lsn)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -646,7 +646,7 @@ TagNode *GetBufTagByLsnRange(XLogRecPtr start_lsn, XLogRecPtr end_lsn)
|
||||
|
||||
LogIndexMemTBL *mem_tbl = &(log_index_mem_list->mem_table[tbl_index]);
|
||||
// current mem table no suitability lsn_list
|
||||
if(!(mem_tbl->meta.max_lsn < start_lsn || mem_tbl->meta.min_lsn >= end_lsn))
|
||||
if(!(mem_tbl->meta.max_lsn < start_lsn || mem_tbl->meta.min_lsn > end_lsn))
|
||||
{
|
||||
end_lsn = Min(end_lsn, mem_tbl->meta.max_lsn);
|
||||
head_node->tag.lsn = end_lsn;
|
||||
@ -665,7 +665,7 @@ TagNode *GetBufTagByLsnRange(XLogRecPtr start_lsn, XLogRecPtr end_lsn)
|
||||
page_min_lsn = LOG_INDEX_COMBINE_LSN(mem_tbl, first_seg->suffix_lsn[0]);
|
||||
uint8 id = Min(LOG_INDEX_MEM_ITEM_SEG_LSN_NUM - 1, last_seg->number - 1);
|
||||
page_max_lsn = LOG_INDEX_COMBINE_LSN(mem_tbl, last_seg->suffix_lsn[id]);
|
||||
if(page_min_lsn >= end_lsn || page_max_lsn < start_lsn)
|
||||
if(page_min_lsn > end_lsn || page_max_lsn < start_lsn)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ((push_standby != true && (EnableHotStandby != true || *isPromoteIsTriggered)) || IsBootstrapProcessingMode() || InitdbSingle || he3mirror) {
|
||||
if (!he3share || (push_standby != true && (EnableHotStandby != true || *isPromoteIsTriggered)) || IsBootstrapProcessingMode() || InitdbSingle || he3mirror) {
|
||||
smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum,
|
||||
buffer, skipFsync);
|
||||
// elog(LOG,"smgrextend reln %d,flk %d,blk %d",reln->smgr_rnode.node.relNode,forknum,blocknum);
|
||||
|
@ -1155,13 +1155,15 @@ XLogRecPtr He3DBQueryMinLsnFromAllStanby()
|
||||
{
|
||||
int i;
|
||||
XLogRecPtr minApplyLsn = 0;
|
||||
int procpid = -1;
|
||||
int *procpids;
|
||||
int maxid = 0;
|
||||
procpids = (int *) malloc(max_wal_senders * sizeof(int));
|
||||
for (i = 0; i < NumBackendStatSlots; i++)
|
||||
{
|
||||
if (strcmp(BackendStatusArray[i].st_appname, "pgmirror") == 0)
|
||||
if (strcmp(BackendStatusArray[i].st_appname, "pgmirror") == 0 || memcmp(BackendStatusArray[i].st_appname, "priv", 4) == 0)
|
||||
{
|
||||
procpid = BackendStatusArray[i].st_procpid;
|
||||
break;
|
||||
procpids[maxid] = BackendStatusArray[i].st_procpid;
|
||||
maxid++;
|
||||
}
|
||||
}
|
||||
Assert(WalSndCtl != NULL);
|
||||
@ -1180,12 +1182,23 @@ XLogRecPtr He3DBQueryMinLsnFromAllStanby()
|
||||
pid = walsnd->pid;
|
||||
apply = walsnd->apply;
|
||||
SpinLockRelease(&walsnd->mutex);
|
||||
if (pid != procpid)
|
||||
int j;
|
||||
bool exist = false;
|
||||
for (j = 0; j < maxid; j++)
|
||||
{
|
||||
if (pid == procpids[j])
|
||||
{
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exist)
|
||||
{
|
||||
if (apply < minApplyLsn || minApplyLsn == 0)
|
||||
minApplyLsn = apply;
|
||||
}
|
||||
}
|
||||
free(procpids);
|
||||
return minApplyLsn;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user