- Notifications
You must be signed in to change notification settings - Fork26
Add TPC-DS stress tests#17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
24 commits Select commitHold shift + click to select a range
957d83f
Transfer tests to python3
ololobusbbc89f5
Try TPC-DS test
ololobus459a060
Use committed TPC-DS queries for now
ololobus37bedbe
Prepare TPC-DS data
ololobus166ead3
New tests refactoring
ololobus91d7754
Add comment
ololobus5bc7769
Set stress_in_progress as global
ololobus8c1a8d7
Some formatting and new queries
ololobus7118ea2
Remove committed TCP-DS queries
ololobus7bb3c33
README.md updated to reflect recent changes
ololobus087b0c8
Support only Python 3+ for running tests
ololobus4d4734a
Use copy_from from psycopg2 for TPC-DS data load
ololobus80a5e1a
Segregate stress test based on TPC-DS from common ones
maksm90302350c
Fix tests runner script
maksm9018f5a38
Try to fix usage of USE_TPCDS variable in test script
ololobus02049e1
Pass USE_TPCDS env variable to Docker container
ololobusa4a2ec3
Create pg_query_state extension in the case of TPC-DS test
ololobusba34af1
Do not run TPC-DS on 9.6
ololobusb2f8e82
Split common tests and tpc-ds stress test on different modules
772062a
Segregate setup and running of stress test
maksm902ac1f8a
Make periodic pg_query_state calls to backend running TPC-DS bench
maksm9061cf837
Refactor the main cycle of tpc-ds stress test
maksm90c1776bc
Make light refactoring after review from ololobus
maksm908545705
Light refactoring regarding constants in run_tpcds function
maksm90File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -9,3 +9,5 @@ pg_query_state--*.sql | ||
cscope.out | ||
tags | ||
Dockerfile | ||
tmp_stress | ||
6 changes: 3 additions & 3 deletions.travis.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletionsDockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionMakefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
39 changes: 27 additions & 12 deletionsREADME.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletionsmk_dockerfile.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletionsrun_tests.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletionstests/common.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
''' | ||
common.py | ||
Copyright (c) 2016-2020, Postgres Professional | ||
''' | ||
import psycopg2 | ||
import psycopg2.extensions | ||
import select | ||
import time | ||
BACKEND_IS_IDLE_INFO = 'INFO: state of backend is idle\n' | ||
BACKEND_IS_ACTIVE_INFO = 'INFO: state of backend is active\n' | ||
def wait(conn): | ||
"""wait for some event on connection to postgres""" | ||
while 1: | ||
state = conn.poll() | ||
if state == psycopg2.extensions.POLL_OK: | ||
break | ||
elif state == psycopg2.extensions.POLL_WRITE: | ||
select.select([], [conn.fileno()], []) | ||
elif state == psycopg2.extensions.POLL_READ: | ||
select.select([conn.fileno()], [], []) | ||
else: | ||
raise psycopg2.OperationalError("poll() returned %s" % state) | ||
def n_async_connect(config, n=1): | ||
"""establish n asynchronious connections to the postgres with specified config""" | ||
aconfig = config.copy() | ||
aconfig['async'] = True | ||
result = [] | ||
for _ in range(n): | ||
conn = psycopg2.connect(**aconfig) | ||
wait(conn) | ||
result.append(conn) | ||
return result | ||
def n_close(conns): | ||
"""close connections to postgres""" | ||
for conn in conns: | ||
conn.close() | ||
def pg_query_state(config, pid, verbose=False, costs=False, timing=False, \ | ||
buffers=False, triggers=False, format='text'): | ||
""" | ||
Get query state from backend with specified pid and optional parameters. | ||
Save any warning, info, notice and log data in global variable 'notices' | ||
""" | ||
conn = psycopg2.connect(**config) | ||
curs = conn.cursor() | ||
curs.callproc('pg_query_state', (pid, verbose, costs, timing, buffers, triggers, format)) | ||
result = curs.fetchall() | ||
notices = conn.notices[:] | ||
conn.close() | ||
return result, notices | ||
def onetime_query_state(config, async_conn, query, args={}, num_workers=0): | ||
""" | ||
Get intermediate state of 'query' on connection 'async_conn' after number of 'steps' | ||
of node executions from start of query | ||
""" | ||
acurs = async_conn.cursor() | ||
set_guc(async_conn, 'enable_mergejoin', 'off') | ||
set_guc(async_conn, 'max_parallel_workers_per_gather', num_workers) | ||
acurs.execute(query) | ||
# extract current state of query progress | ||
MAX_PG_QS_RETRIES = 10 | ||
DELAY_BETWEEN_RETRIES = 0.1 | ||
pg_qs_args = { | ||
'config': config, | ||
'pid': async_conn.get_backend_pid() | ||
} | ||
for k, v in args.items(): | ||
pg_qs_args[k] = v | ||
n_retries = 0 | ||
while True: | ||
result, notices = pg_query_state(**pg_qs_args) | ||
n_retries += 1 | ||
if len(result) > 0: | ||
break | ||
if n_retries >= MAX_PG_QS_RETRIES: | ||
# pg_query_state callings don't return any result, more likely run | ||
# query has completed | ||
break | ||
time.sleep(DELAY_BETWEEN_RETRIES) | ||
wait(async_conn) | ||
set_guc(async_conn, 'enable_mergejoin', 'on') | ||
return result, notices | ||
def set_guc(async_conn, param, value): | ||
acurs = async_conn.cursor() | ||
acurs.execute('set %s to %s' % (param, value)) | ||
wait(async_conn) |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.