mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-11-29 18:58:35 +08:00
secondbuffer process maybe clean latest version page
Signed-off-by: shipixian <shipixian_yewu@cmss.chinamobile.com>
This commit is contained in:
parent
5fc75be472
commit
09e0548903
@ -324,17 +324,17 @@ static bool
|
||||
CleanUpSecondBuffer(const SdPageKey *pk)
|
||||
{
|
||||
|
||||
LWLock *partitionLock;
|
||||
uint32 newHash;
|
||||
newHash = SecondBufferHashCode(pk);
|
||||
partitionLock = SecondBufferMappingPartitionLock(newHash);
|
||||
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
|
||||
// LWLock *partitionLock;
|
||||
// uint32 newHash;
|
||||
// newHash = SecondBufferHashCode(pk);
|
||||
// partitionLock = SecondBufferMappingPartitionLock(newHash);
|
||||
// LWLockAcquire(partitionLock, LW_EXCLUSIVE);
|
||||
bool found;
|
||||
hash_search(SecondBufferHash,
|
||||
(void *)pk,
|
||||
HASH_REMOVE,
|
||||
&found);
|
||||
LWLockRelease(partitionLock);
|
||||
// LWLockRelease(partitionLock);
|
||||
return found;
|
||||
}
|
||||
|
||||
@ -381,6 +381,7 @@ ReceivePageFromDataBuffer(PageKey *pk, uint8_t *buffer)
|
||||
LWLockRelease(partitionLock);
|
||||
continue;
|
||||
}
|
||||
sdPageValue->canDelete = false;
|
||||
memcpy(sdPageValue->pagecontent, buffer,8192);
|
||||
LWLockRelease(partitionLock);
|
||||
}
|
||||
@ -1054,7 +1055,12 @@ RemovePageOrWalFromCurrentNode()
|
||||
mdb_cursor_del(tmpcursor,0);
|
||||
if (PageOrWal == (int)PAGE)
|
||||
{
|
||||
// CleanUpSecondBuffer(&((SdPageValue *)data.mv_data)->pk);
|
||||
newHash = SecondBufferHashCode(&((SdPageValue *)data.mv_data)->pk);
|
||||
partitionLock = SecondBufferMappingPartitionLock(newHash);
|
||||
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
|
||||
CleanUpSecondBuffer(&((SdPageValue *)data.mv_data)->pk);
|
||||
LWLockRelease(partitionLock);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1063,7 +1069,12 @@ RemovePageOrWalFromCurrentNode()
|
||||
//TRUNCATE
|
||||
if (DPArray->dpk[DPArray->walIndex].operation == (int)TRUNCATE)
|
||||
{
|
||||
// CleanUpSecondBuffer(&((SdPageValue *)data.mv_data)->pk);
|
||||
newHash = SecondBufferHashCode(&((SdPageValue *)data.mv_data)->pk);
|
||||
partitionLock = SecondBufferMappingPartitionLock(newHash);
|
||||
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
|
||||
CleanUpSecondBuffer(&((SdPageValue *)data.mv_data)->pk);
|
||||
LWLockRelease(partitionLock);
|
||||
}
|
||||
else if (NULL == FindSecondBufferInTable(&lpk->sk)) //EVICT
|
||||
{
|
||||
@ -1229,6 +1240,7 @@ MovePageFromSecondBufferToLocalBuffer()
|
||||
data.mv_data = spv->pagecontent;
|
||||
|
||||
mp = mdb_put(tmptxn,pageDbi,&key,&data, 0);
|
||||
spv->canDelete = true;
|
||||
LWLockRelease(partitionLock);
|
||||
if (mp != 0)
|
||||
{
|
||||
@ -1264,7 +1276,12 @@ MovePageFromSecondBufferToLocalBuffer()
|
||||
spv = FindSecondBufferInTable(&s->spk);
|
||||
if (spv != NULL)
|
||||
{
|
||||
CleanUpSecondBuffer(&s->spk);
|
||||
newHash = SecondBufferHashCode(&s->spk);
|
||||
partitionLock = SecondBufferMappingPartitionLock(newHash);
|
||||
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
|
||||
if (spv->canDelete)
|
||||
CleanUpSecondBuffer(&s->spk);
|
||||
LWLockRelease(partitionLock);
|
||||
}
|
||||
}
|
||||
if (spkl.head->next != NULL)
|
||||
|
@ -354,6 +354,7 @@ extern void UpdateControlFile(void);
|
||||
extern void PushUpdateControlFile(void);
|
||||
extern void PushCheckPointGuts(XLogRecPtr checkPointRedo, int flags);
|
||||
extern XLogRecPtr GetXLogPushToDisk(void);
|
||||
extern void SetXLogPushToDisk(XLogRecPtr pushToDiskLsn);
|
||||
|
||||
extern uint64 GetSystemIdentifier(void);
|
||||
extern char *GetMockAuthenticationNonce(void);
|
||||
|
@ -70,7 +70,8 @@ typedef struct OriginDPageKey
|
||||
|
||||
typedef struct SdPageValue
|
||||
{
|
||||
SdPageKey pk;
|
||||
SdPageKey pk;
|
||||
bool canDelete;
|
||||
uint8 pagecontent[BLKSZ];
|
||||
} SdPageValue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user