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

Commit61cf837

Browse files
committed
Refactor the main cycle of tpc-ds stress test
1 parent2ac1f8a commit61cf837

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

‎tests/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
importselect
99
importtime
1010

11+
BACKEND_IS_IDLE_INFO='INFO: state of backend is idle\n'
12+
BACKEND_IS_ACTIVE_INFO='INFO: state of backend is active\n'
13+
1114
defwait(conn):
1215
"""wait for some event on connection to postgres"""
1316
while1:

‎tests/tpcds.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,28 @@ def run_tpcds(config):
7878

7979
# periodically run pg_query_state on running backend trying to get
8080
# crash of PostgreSQL
81-
MAX_PG_QS_RETRIES=10
82-
PG_QS_DELAY,BEFORE_GOT_QS_DELAY=0.1,0.1
83-
BEFORE_GOT_QS,GOT_QS=range(2)
84-
state,n_retries=BEFORE_GOT_QS,0
81+
MAX_FIRST_GETTING_QS_RETRIES=10
82+
PG_QS_DELAY,BEFORE_GETTING_QS_DELAY=0.1,0.1
83+
BEFORE_GETTING_QS,GETTING_QS=range(2)
84+
state,n_first_getting_qs_retries=BEFORE_GETTING_QS,0
8585
whileTrue:
86-
result,_=common.pg_query_state(config,pid)
87-
ifstate==BEFORE_GOT_QS:
88-
iflen(result)>0:
89-
state=GOT_QS
86+
result,notices=common.pg_query_state(config,pid)
87+
# run state machine to determine the first getting query state
88+
# and query finishing
89+
ifstate==BEFORE_GETTING_QS:
90+
iflen(result)>0orcommon.BACKEND_IS_ACTIVE_INFOinnotices:
91+
state=GETTING_QS
9092
continue
91-
n_retries+=1
92-
ifn_retries>=MAX_PG_QS_RETRIES:
93+
n_first_getting_qs_retries+=1
94+
ifn_first_getting_qs_retries>=MAX_FIRST_GETTING_QS_RETRIES:
9395
# pg_query_state callings don't return any result, more likely run
9496
# query has completed
9597
break
96-
time.sleep(BEFORE_GOT_QS_DELAY)
97-
ifstate==GOT_QS:
98-
iflen(result)==0:
98+
time.sleep(BEFORE_GETTING_QS_DELAY)
99+
elifstate==GETTING_QS:
100+
ifcommon.BACKEND_IS_IDLE_INFOinnotices:
99101
break
100-
time.sleep(PG_QS_DELAY)
102+
time.sleep(PG_QS_DELAY)
101103

102104
# wait for real query completion
103105
common.wait(acon)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp