fix dump
This commit is contained in:
@ -813,13 +813,18 @@ static void PutTranslotInfoToTuple(int zoneId, uint32 offset, TransactionSlot *s
|
||||
}
|
||||
|
||||
static void GetTranslotFromOneSegFile(int fd, int zoneId, Tuplestorestate *tupstore,
|
||||
TupleDesc tupDesc, TransactionId xid, MiniSlot *returnSlot)
|
||||
TupleDesc tupDesc, TransactionId xid, int segno, MiniSlot *returnSlot)
|
||||
{
|
||||
TransactionSlot *slot = NULL;
|
||||
errno_t rc = EOK;
|
||||
off_t seekpos;
|
||||
uint32 ret = 0;
|
||||
char buffer[BLCKSZ] = {'\0'};
|
||||
UndoSlotPtr usp = INVALID_UNDO_SLOT_PTR;
|
||||
UndoZone *uzone = UndoZoneGroup::GetUndoZone(zoneId, false);
|
||||
if (uzone == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32 loop = 0; loop < UNDO_META_SEG_SIZE; loop++) {
|
||||
seekpos = (off_t)BLCKSZ * loop;
|
||||
@ -835,6 +840,10 @@ static void GetTranslotFromOneSegFile(int fd, int zoneId, Tuplestorestate *tupst
|
||||
|
||||
for (uint32 offset = UNDO_LOG_BLOCK_HEADER_SIZE; offset < BLCKSZ - MAXALIGN(sizeof(TransactionSlot));
|
||||
offset += MAXALIGN(sizeof(TransactionSlot))) {
|
||||
usp = MAKE_UNDO_PTR(zoneId, segno * UNDO_META_SEGMENT_SIZE + loop * BLCKSZ + offset);
|
||||
if (usp < uzone->GetRecycleTSlotPtr() || usp > uzone->GetAllocateTSlotPtr()) {
|
||||
continue;
|
||||
}
|
||||
slot = (TransactionSlot *)(buffer + offset);
|
||||
if (TransactionIdIsValid(xid) && slot->XactId() < xid) {
|
||||
continue;
|
||||
@ -867,7 +876,7 @@ static void GetTranslotFromSegFiles(int zoneId, int segnobegin, int segnoend, Tu
|
||||
securec_check_ss(rc, "\0", "\0");
|
||||
int fd = open(fileName, O_RDONLY | PG_BINARY, S_IRUSR | S_IWUSR);
|
||||
Checkfd(fd, fileName);
|
||||
GetTranslotFromOneSegFile(fd, zoneId, tupstore, tupDesc, xid, returnSlot);
|
||||
GetTranslotFromOneSegFile(fd, zoneId, tupstore, tupDesc, xid, segcurrent, returnSlot);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
@ -549,13 +549,36 @@ void UnlinkUndoFile(const RelFileNodeBackend& rnode, ForkNumber forkNum, bool is
|
||||
{
|
||||
Assert(blockNum != InvalidBlockNumber);
|
||||
|
||||
char path[UNDO_FILE_PATH_LEN];
|
||||
char path[UNDO_FILE_PATH_LEN] = { 0 };
|
||||
char prev_path[UNDO_FILE_PATH_LEN] ={ 0 };
|
||||
uint32 undoFileBlocks = UNDO_FILE_BLOCK(rnode.node.dbNode);
|
||||
int ret;
|
||||
int zid = rnode.node.relNode;
|
||||
int segno = blockNum / undoFileBlocks;
|
||||
GetUndoFilePath(zid, rnode.node.dbNode, segno, path, UNDO_FILE_PATH_LEN);
|
||||
|
||||
if (segno > 0) {
|
||||
undo::UndoZone *uzone = undo::UndoZoneGroup::GetUndoZone(zid, false);
|
||||
Assert(uzone != NULL);
|
||||
GetUndoFilePath(zid, rnode.node.dbNode, segno - 1, prev_path, UNDO_FILE_PATH_LEN);
|
||||
if (access(prev_path, F_OK) == 0) {
|
||||
ereport(WARNING, (errmodule(MOD_UNDO),
|
||||
errmsg(UNDOFORMAT("Undo unlink file discontunue: path %s, prevPath %s."
|
||||
"spaceInfo: head %lu, tail %lu, lsn %lu."
|
||||
"slotSpaceInfo: head %lu, tail %lu, lsn %lu."
|
||||
"zoneInfo: insertURecPtr %lu, forceDiscardURecPtr %lu, discardURecPtr %lu, allcateTSlotPtr %lu,"
|
||||
"recycleTSlotPtr %lu, recycleXid %lu, frozenXid %lu, lsn %lu."
|
||||
),
|
||||
path, prev_path,
|
||||
uzone->GetUndoSpace()->Head(), uzone->GetUndoSpace()->Tail(), uzone->GetUndoSpace()->LSN(),
|
||||
uzone->GetSlotSpace()->Head(), uzone->GetSlotSpace()->Tail(), uzone->GetSlotSpace()->LSN(),
|
||||
uzone->GetInsertURecPtr(), uzone->GetForceDiscardURecPtr(),
|
||||
uzone->GetDiscardURecPtr(), uzone->GetAllocateTSlotPtr(),
|
||||
uzone->GetRecycleTSlotPtr(), uzone->GetRecycleXid(), uzone->GetFrozenXid(), uzone->GetLSN()
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
if (isRedo || u_sess->attr.attr_common.IsInplaceUpgrade || forkNum != MAIN_FORKNUM ||
|
||||
RelFileNodeBackendIsTemp(rnode) || rnode.node.bucketNode != InvalidBktId) {
|
||||
if (!RelFileNodeBackendIsTemp(rnode)) {
|
||||
|
Reference in New Issue
Block a user