Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1c54dfd

Browse files
committed
cleanup
1 parent84d6f47 commit1c54dfd

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

‎src/backend/access/transam/global_snapshot.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -226,32 +226,27 @@ dtm_xact_callback(XactEvent event, void *arg)
226226
break;
227227

228228
caseXACT_EVENT_ABORT_PREPARED:
229-
// DtmLocalAbortPrepared(&dtm_tx);
230229
finishing_prepared= true;
231230
DtmAdjustOldestXid();
232231
break;
233232

234233
caseXACT_EVENT_COMMIT_PREPARED:
235-
// DtmLocalCommitPrepared(&dtm_tx);
236234
finishing_prepared= true;
237235
DtmAdjustOldestXid();
238236
break;
239237

240238
caseXACT_EVENT_COMMIT:
241239
DtmLocalFinish(true);
242-
DtmLocalEnd(&dtm_tx);
243240
finishing_prepared= false;
244241
break;
245242

246243
caseXACT_EVENT_ABORT:
247244
DtmLocalFinish(false);
248-
DtmLocalEnd(&dtm_tx);
249245
finishing_prepared= false;
250246
break;
251247

252248
caseXACT_EVENT_PRE_PREPARE:
253249
DtmLocalSavePreparedState(&dtm_tx);
254-
DtmLocalEnd(&dtm_tx);
255250
break;
256251

257252
default:
@@ -452,11 +447,9 @@ DtmInitialize()
452447
void
453448
DtmLocalBegin(DtmCurrentTrans*x)
454449
{
455-
SpinLockAcquire(&local->lock);
456-
x->cid=INVALID_CID;
457-
x->snapshot=dtm_get_cid();
458-
SpinLockRelease(&local->lock);
459-
DTM_TRACE((stderr,"DtmLocalBegin: transaction %u uses local snapshot %lu\n",x->xid,x->snapshot));
450+
SpinLockAcquire(&local->lock);// XXX: move to snapshot aquire?
451+
x->snapshot=dtm_get_cid();
452+
SpinLockRelease(&local->lock);
460453
}
461454

462455
/*
@@ -477,7 +470,6 @@ DtmLocalExtend(GlobalTransactionId gtid)
477470
id->xid=GetCurrentTransactionId();
478471
id->nSubxids=0;
479472
id->subxids=0;
480-
x->xid=id->xid;
481473
}
482474
strncpy(x->gtid,gtid,MAX_GTID_SIZE);
483475
SpinLockRelease(&local->lock);
@@ -495,6 +487,8 @@ DtmLocalAccess(DtmCurrentTrans * x, GlobalTransactionId gtid, cid_t global_cid)
495487
{
496488
cid_tlocal_cid;
497489

490+
// Check that snapshot isn't set?
491+
498492
SpinLockAcquire(&local->lock);
499493
{
500494
if (gtid!=NULL)
@@ -504,17 +498,18 @@ DtmLocalAccess(DtmCurrentTrans * x, GlobalTransactionId gtid, cid_t global_cid)
504498
id->xid=GetCurrentTransactionId();
505499
id->nSubxids=0;
506500
id->subxids=0;
507-
x->xid=id->xid;
508501
}
509502
local_cid=dtm_sync(global_cid);
510503
x->snapshot=global_cid;
511504
}
512505
strncpy(x->gtid,gtid,MAX_GTID_SIZE);
513506
SpinLockRelease(&local->lock);
507+
514508
if (global_cid<local_cid-DtmVacuumDelay*USEC)
515509
{
516510
elog(ERROR,"Too old snapshot: requested %ld, current %ld",global_cid,local_cid);
517511
}
512+
518513
DtmInitGlobalXmin(TransactionXmin);
519514
returnglobal_cid;
520515
}
@@ -663,23 +658,10 @@ DtmLocalFinish(bool is_commit)
663658
ts->nSubxids=0;
664659
}
665660
}
666-
x->cid=ts->cid;
667-
DTM_TRACE((stderr,"Local transaction %u is committed at %lu\n",x->xid,x->cid));
668661
}
669662
SpinLockRelease(&local->lock);
670663

671664
// DtmAdjustOldestXid();
672-
// elog(LOG, "DtmLocalCommit %d", x->xid);
673-
}
674-
675-
/*
676-
* Cleanup dtm_tx structure
677-
*/
678-
void
679-
DtmLocalEnd(DtmCurrentTrans*x)
680-
{
681-
x->xid=InvalidTransactionId;
682-
x->cid=INVALID_CID;
683665
}
684666

685667
/*

‎src/include/access/global_snapshot.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ typedef uint64 cid_t;
88

99
typedefstruct
1010
{
11-
TransactionIdxid;
12-
cid_tcid;
1311
cid_tsnapshot;
1412
chargtid[MAX_GTID_SIZE];
1513
}DtmCurrentTrans;
@@ -42,9 +40,6 @@ cid_tDtmLocalPrepare(GlobalTransactionId gtid, cid_t cid);
4240
/* Assign CSN to global transaction */
4341
voidDtmLocalEndPrepare(GlobalTransactionIdgtid,cid_tcid);
4442

45-
/* Invoked at the end of any local or global transaction: free transaction state */
46-
voidDtmLocalEnd(DtmCurrentTrans*x);
47-
4843
/* Save global preapred transactoin state */
4944
voidDtmLocalSavePreparedState(DtmCurrentTrans*x);
5045

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp