30
30
pytestmark = [pytest .mark .integration , pytest .mark .usefixtures ('dd_environment' )]
31
31
32
32
33
- def _check_analyze_progress (check , pg_instance , table ):
34
- thread = run_vacuum_thread (pg_instance , f'ANALYZE { table } ' )
33
+ def _check_analyze_progress (check , pg_instance , table , application_name ):
34
+ thread = run_vacuum_thread (pg_instance , f'ANALYZE { table } ' , application_name )
35
35
36
36
# Wait for vacuum to be reported
37
37
_wait_for_value (
@@ -44,14 +44,15 @@ def _check_analyze_progress(check, pg_instance, table):
44
44
check .check (pg_instance )
45
45
46
46
# Kill vacuum and cleanup thread
47
- kill_vacuum (pg_instance )
47
+ kill_vacuum (pg_instance , application_name )
48
48
thread .join ()
49
49
50
50
51
51
@requires_over_13
52
52
def test_analyze_progress_inherited (aggregator , integration_check , pg_instance ):
53
+ pg_instance ['application_name' ] = 'test_analyze_progress_inherited'
53
54
check = integration_check (pg_instance )
54
- _check_analyze_progress (check , pg_instance , 'test_part' )
55
+ _check_analyze_progress (check , pg_instance , 'test_part' , pg_instance [ 'application_name' ] )
55
56
expected_tags = _get_expected_tags (check , pg_instance ) + [
56
57
'child_relation:test_part1' ,
57
58
'phase:acquiring inherited sample rows' ,
@@ -64,8 +65,9 @@ def test_analyze_progress_inherited(aggregator, integration_check, pg_instance):
64
65
65
66
@requires_over_13
66
67
def test_analyze_progress (aggregator , integration_check , pg_instance ):
68
+ pg_instance ['application_name' ] = 'test_analyze_progress'
67
69
check = integration_check (pg_instance )
68
- _check_analyze_progress (check , pg_instance , 'test_part1' )
70
+ _check_analyze_progress (check , pg_instance , 'test_part1' , pg_instance [ 'application_name' ] )
69
71
expected_tags = _get_expected_tags (check , pg_instance ) + [
70
72
'phase:acquiring sample rows' ,
71
73
'table:test_part1' ,
@@ -77,10 +79,13 @@ def test_analyze_progress(aggregator, integration_check, pg_instance):
77
79
78
80
@requires_over_17
79
81
def test_vacuum_progress (aggregator , integration_check , pg_instance ):
82
+ pg_instance ['application_name' ] = 'test_vacuum_progress'
80
83
check = integration_check (pg_instance )
81
84
82
85
# Start vacuum
83
- thread = run_vacuum_thread (pg_instance , 'VACUUM (DISABLE_PAGE_SKIPPING) test_part1' )
86
+ thread = run_vacuum_thread (
87
+ pg_instance , 'VACUUM (DISABLE_PAGE_SKIPPING) test_part1' , pg_instance ['application_name' ]
88
+ )
84
89
85
90
# Wait for vacuum to be reported
86
91
_wait_for_value (
@@ -93,7 +98,7 @@ def test_vacuum_progress(aggregator, integration_check, pg_instance):
93
98
check .check (pg_instance )
94
99
95
100
# Kill vacuum and cleanup thread
96
- kill_vacuum (pg_instance )
101
+ kill_vacuum (pg_instance , pg_instance [ 'application_name' ] )
97
102
thread .join ()
98
103
99
104
expected_tags = _get_expected_tags (check , pg_instance ) + [
@@ -108,10 +113,13 @@ def test_vacuum_progress(aggregator, integration_check, pg_instance):
108
113
@requires_over_12
109
114
@requires_under_17
110
115
def test_vacuum_progress_lt_17 (aggregator , integration_check , pg_instance ):
116
+ pg_instance ['application_name' ] = 'test_vacuum_progress_lt_17'
111
117
check = integration_check (pg_instance )
112
118
113
119
# Start vacuum
114
- thread = run_vacuum_thread (pg_instance , 'VACUUM (DISABLE_PAGE_SKIPPING) test_part1' )
120
+ thread = run_vacuum_thread (
121
+ pg_instance , 'VACUUM (DISABLE_PAGE_SKIPPING) test_part1' , pg_instance ['application_name' ]
122
+ )
115
123
116
124
# Wait for vacuum to be reported
117
125
_wait_for_value (
@@ -124,7 +132,7 @@ def test_vacuum_progress_lt_17(aggregator, integration_check, pg_instance):
124
132
check .check (pg_instance )
125
133
126
134
# Kill vacuum and cleanup thread
127
- kill_vacuum (pg_instance )
135
+ kill_vacuum (pg_instance , pg_instance [ 'application_name' ] )
128
136
thread .join ()
129
137
130
138
expected_tags = _get_expected_tags (check , pg_instance ) + [
@@ -138,13 +146,18 @@ def test_vacuum_progress_lt_17(aggregator, integration_check, pg_instance):
138
146
139
147
@requires_over_12
140
148
def test_index_progress (aggregator , integration_check , pg_instance ):
149
+ pg_instance ['application_name' ] = 'test_index_progress'
141
150
check = integration_check (pg_instance )
142
151
143
152
# Keep test_part locked to prevent create index concurrently from finishing
144
153
conn = lock_table (pg_instance , 'test_part1' , 'ROW EXCLUSIVE' )
145
154
146
155
# Start vacuum in a thread
147
- thread = run_query_thread (pg_instance , 'CREATE INDEX CONCURRENTLY test_progress_index ON test_part1 (id);' )
156
+ thread = run_query_thread (
157
+ pg_instance ,
158
+ 'CREATE INDEX CONCURRENTLY test_progress_index ON test_part1 (id);' ,
159
+ pg_instance ['application_name' ],
160
+ )
148
161
149
162
# Wait for blocked created index to appear
150
163
_wait_for_value (
@@ -156,7 +169,7 @@ def test_index_progress(aggregator, integration_check, pg_instance):
156
169
check .check (pg_instance )
157
170
158
171
# Kill the create index
159
- kill_session (pg_instance , 'CREATE INDEX' )
172
+ kill_session (pg_instance , 'CREATE INDEX' , pg_instance [ 'application_name' ] )
160
173
161
174
# Cleanup connection and thread
162
175
conn .close ()
@@ -177,15 +190,21 @@ def test_index_progress(aggregator, integration_check, pg_instance):
177
190
178
191
@requires_over_12
179
192
def test_cluster_vacuum_progress (aggregator , integration_check , pg_instance ):
193
+ pg_instance ['application_name' ] = 'test_cluster_vacuum_progress'
180
194
check = integration_check (pg_instance )
181
195
182
196
# Keep pg_class lock to block vacuum full during initilizing phase
183
- conn = lock_table (pg_instance , 'pg_catalog.pg_class' , 'EXCLUSIVE' )
197
+ conn = lock_table (pg_instance , 'pg_catalog.pg_class' , 'EXCLUSIVE' , pg_instance [ 'application_name' ] )
184
198
185
199
# Start vacuum in a thread
186
- thread = run_vacuum_thread (pg_instance , 'VACUUM FULL personsdup1' )
200
+ thread = run_vacuum_thread (pg_instance , 'VACUUM FULL personsdup1' , pg_instance [ 'application_name' ] )
187
201
188
- _wait_for_value (pg_instance , lower_threshold = 0 , query = "select count(*) FROM pg_stat_progress_cluster;" )
202
+ _wait_for_value (
203
+ pg_instance ,
204
+ lower_threshold = 0 ,
205
+ query = "select count(*) FROM pg_stat_progress_cluster;" ,
206
+ application_name = pg_instance ['application_name' ],
207
+ )
189
208
check .check (pg_instance )
190
209
191
210
# Cleanup connection and thread
0 commit comments