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

Commite9335ab

Browse files
committed
Dynamically calculate number of participants
1 parent3796257 commite9335ab

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

‎contrib/pg_xtm/dtmd/include/transaction.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
typedefstructTransaction {
1515
xid_txid;
1616

17-
intsize;
17+
intsize;// number of paritcipants
18+
intmax_size;// maximal number of participants
1819

1920
// for + against ≤ size
2021
intvotes_for;

‎contrib/pg_xtm/dtmd/src/main.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ static char *onbegin(void *stream, void *clientdata, cmd_t *cmd) {
280280

281281
prev_gxid=t->xid=next_gxid++;
282282
t->snapshots_count=0;
283-
t->size=size;
283+
t->max_size=size;
284+
t->size=1;
284285

285286
CLIENT_SNAPSENT(clientdata)=0;
286287
CLIENT_XID(clientdata)=t->xid;
@@ -436,6 +437,12 @@ static char *onsnapshot(void *stream, void *clientdata, cmd_t *cmd) {
436437
if (CLIENT_XID(clientdata)==INVALID_XID) {
437438
CLIENT_SNAPSENT(clientdata)=0;
438439
CLIENT_XID(clientdata)=t->xid;
440+
t->size+=1;
441+
CHECK(
442+
t->size <=t->max_size,
443+
clientdata,
444+
"SNAPSHOT: too many participants"
445+
);
439446
}
440447

441448
CHECK(

‎contrib/pg_xtm/dtmd/src/transaction.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void transaction_clear(Transaction *t) {
2828

2929
t->xid=INVALID_XID;
3030
t->size=0;
31+
t->max_size=0;
3132
t->votes_for=0;
3233
t->votes_against=0;
3334
t->snapshots_count=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp