mirror of
https://github.com/sandronator/finetuning_aufgabe4.git
synced 2026-09-04 08:36:09 +02:00
Label output with Aufgabe + strategy + index config, fix lock hangs
Two related improvements to make the test runs both usable and
diagnosable:
1. Avoid lock waits / "deadlock" hangs during CLUSTER
The Manager connection ran EXPLAIN ANALYZE without committing, so
psycopg2's default autocommit=False left an open transaction
holding AccessShareLock on publ and auth. The next setup_db then
blocked on DROP INDEX / CLUSTER (both need AccessExclusiveLock),
visible as a hang -- typically at the CLUSTER step. Setting
conn_postsql.autocommit = True releases the locks immediately after
each SELECT, which is safe here because all Manager queries are
read-only.
2. Make the run output identify which test is running
The "Running: ..." line previously printed only the query key
(query_1/query_2), shadowing 'strategy' with the dict key and never
surfacing which join strategy or index config was active. Output
now reads e.g. "[Aufgabe 3b | SortMergeStrategy | idx=nc-both]" by:
- using self.__class__.__name__ so subclasses surface correctly
- passing the current index_config from Manager into the strategy
- threading an optional 'aufgabe' label through Manager.execute()
and into each strategy's run() (including the Nested/SortMerge/
Hash wrappers that override run()).
main.py now tags each execute() call with its assignment number.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
d8a906e2d4
commit
da2453da32
@@ -5,14 +5,14 @@ class SortMergeStrategy(BaseStrategy):
|
||||
def __init__(self, conn, db_name, all_queries):
|
||||
super().__init__(conn, db_name, all_queries)
|
||||
|
||||
def run(self):
|
||||
def run(self, aufgabe: str | None = None):
|
||||
if self.db_name not in resolve:
|
||||
raise Exception("Sort-Merge Join not supported for " + self.db_name)
|
||||
|
||||
for disable in resolve[self.db_name]["disable"]:
|
||||
self.cursor.execute(disable)
|
||||
|
||||
super().run()
|
||||
super().run(aufgabe=aufgabe)
|
||||
|
||||
for reset in resolve[self.db_name]["reset"]:
|
||||
self.cursor.execute(reset)
|
||||
Reference in New Issue
Block a user