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

Commit0bb319a

Browse files
committed
2 parents0b46b4c +c0d6021 commit0bb319a

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

‎contrib/multimaster/dtmd/include/limits.h‎renamed to ‎contrib/multimaster/dtmd/include/dtmdlimits.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndefLIMITS_H
2-
#defineLIMITS_H
1+
#ifndefDTMD_LIMITS_H
2+
#defineDTMD_LIMITS_H
33

44
#defineMAX_TRANSACTIONS 4096
55

‎contrib/multimaster/dtmd/include/snapshot.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#defineSNAPSHOT_H
33

44
#include"int.h"
5-
#include"limits.h"
5+
#include"dtmdlimits.h"
66

77
typedefstructSnapshot {
88
xid_txmin;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include"int.h"
66
#include"clog.h"
77
#include"snapshot.h"
8-
#include"limits.h"
8+
#include"dtmdlimits.h"
99

1010
#defineMAX_SNAPSHOTS_PER_TRANS 8
1111

‎contrib/multimaster/dtmd/src/server.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#endif
2222

2323
#include"server.h"
24-
#include"limits.h"
24+
#include"dtmdlimits.h"
2525
#include"util.h"
2626
#include"sockhub.h"
2727

‎contrib/pg_dtm/dtmd/include/limits.h‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎contrib/pg_shard/src/prune_shard_list.c‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ PruneShardList(Oid relationId, List *whereClauseList, List *shardIntervalList)
127127
List*restrictInfoList=NIL;
128128
Node*baseConstraint=NULL;
129129
intshardHashCode=-1;
130+
intshardCount=shardIntervalList->length;
131+
uint32hashTokenIncrement= (uint32)(HASH_TOKEN_COUNT /shardCount);
130132
Var*partitionColumn=PartitionColumn(relationId);
131133
charpartitionMethod=PartitionType(relationId);
132134

@@ -168,8 +170,6 @@ PruneShardList(Oid relationId, List *whereClauseList, List *shardIntervalList)
168170
if (OidIsValid(hashFunction->fn_oid))
169171
{
170172
inthashedValue=DatumGetInt32(FunctionCall1(hashFunction,constant->constvalue));
171-
intshardCount=shardIntervalList->length;
172-
uint32hashTokenIncrement= (uint32)(HASH_TOKEN_COUNT /shardCount);
173173
shardHashCode= (int)((uint32)(hashedValue-INT32_MIN) /hashTokenIncrement);
174174
remainingShardList=LookupShardPlacementCache(relationId,shardHashCode);
175175
if (remainingShardList!=NULL)
@@ -229,7 +229,19 @@ PruneShardList(Oid relationId, List *whereClauseList, List *shardIntervalList)
229229
}
230230
if (shardHashCode >=0)
231231
{
232-
AddToShardPlacementCache(relationId,shardHashCode,shardIntervalList->length,remainingShardList);
232+
ShardInterval*shardInterval= (ShardInterval*)linitial(remainingShardList);
233+
int64shardId=shardInterval->id;
234+
int32shardMinHashToken=INT32_MIN+ (shardId*hashTokenIncrement);
235+
int32shardMaxHashToken=shardMinHashToken+ (hashTokenIncrement-1);
236+
if (shardId== (shardCount-1))
237+
{
238+
shardMaxHashToken=INT32_MAX;
239+
}
240+
if (DatumGetInt32(shardInterval->minValue)==shardMinHashToken&&
241+
DatumGetInt32(shardInterval->maxValue)==shardMaxHashToken)
242+
{
243+
AddToShardPlacementCache(relationId,shardHashCode,shardIntervalList->length,remainingShardList);
244+
}
233245
}
234246
returnremainingShardList;
235247
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp