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

Commit91e71d2

Browse files
committed
Optimize snapshot size
1 parent1db67dc commit91e71d2

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,25 +196,19 @@ static void gen_snapshot(Snapshot *s) {
196196
intn=0;
197197
s->times_sent=0;
198198
for (t= (Transaction*)active_transactions.prev;t!= (Transaction*)&active_transactions;t= (Transaction*)t->elem.prev) {
199-
/*
200-
if (t->xid < s->xmin) {
201-
s->xmin = t->xid;
202-
}
203-
if (t->xid >= s->xmax) {
204-
s->xmax = t->xid + 1;
205-
}
206-
*/
207199
s->active[n++]=t->xid;
208200
}
209-
s->nactive=n;
201+
while (n>1&&s->active[n-2]+1==s->active[n-1]) {
202+
n-=1;
203+
}
210204
if (n>0) {
211205
s->xmin=s->active[0];
212-
s->xmax=s->active[n-1];
206+
s->xmax=s->active[--n];
213207
assert(s->xmin <=s->xmax);
214-
// snapshot_sort(s);
215208
}else {
216209
s->xmin=s->xmax=0;
217210
}
211+
s->nactive=n;
218212
}
219213

220214
staticvoidonreserve(client_tclient,intargc,xid_t*argv) {

‎contrib/multimaster/tests/postgresql.conf.mm‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@
547547
# These settings are initialized by initdb, but they can be changed.
548548
lc_messages ='en_US.UTF-8'# localefor system error message
549549
# strings
550-
lc_monetary ='ru_RU.UTF-8'# localefor monetary formatting
551-
lc_numeric ='ru_RU.UTF-8'# localefor number formatting
552-
lc_time ='ru_RU.UTF-8'# localefor time formatting
550+
lc_monetary ='en_US.UTF-8'# localefor monetary formatting
551+
lc_numeric ='en_US.UTF-8'# localefor number formatting
552+
lc_time ='en_US.UTF-8'# localefor time formatting
553553

554554
#default configurationfor text search
555555
default_text_search_config ='pg_catalog.english'
@@ -624,5 +624,5 @@
624624

625625
# Add settingsfor extensions here
626626

627-
multimaster.queue_size =1073741824
628-
#multimaster.workers =16
627+
multimaster.workers=8
628+
multimaster.queue_size=1073741824
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
n_nodes=3
2-
export PATH=/home/knizhnik/postgrespro/cluster_install/bin/:$PATH
2+
export PATH=/home/knizhnik/postgres_cluster/dist/bin/:$PATH
33
ulimit -c unlimited
44
pkill -9 postgres
55
pkill -9 dtmd
6-
sleep 2
7-
rm -fr node?*.logdtm/*
6+
rm -fr node?*.log dtm
7+
mkdirdtm
88
conn_str=""
99
sep=""
1010
for((i=1;i<=n_nodes;i++))
1111
do
1212
port=$((5431+i))
13-
conn_str="$conn_str${sep}replication=databasedbname=postgres host=127.0.0.1 user=knizhnik port=$port sslmode=disable"
13+
conn_str="$conn_str${sep}dbname=postgres host=127.0.0.1 user=knizhnik port=$port sslmode=disable"
1414
sep=","
1515
initdb node$i
1616
done
1717

1818
echo Start DTM
19-
~/postgrespro/contrib/multimaster/dtmd/bin/dtmd -d dtm2> dtm.log&
19+
~/postgres_cluster/contrib/multimaster/dtmd/bin/dtmd -d dtm2> dtm.log&
2020
sleep 2
2121

2222
echo Start nodes
@@ -32,10 +32,6 @@ done
3232

3333
sleep 5
3434
echo Initialize database schema
35-
for((i=1;i<=n_nodes;i++))
36-
do
37-
port=$((5431+i))
38-
psql -p$port postgres -U knizhnik -f init.sql
39-
done
35+
psql postgres -U knizhnik -f init.sql
4036

4137
echo Done

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp