Skip to content

Commit 03dc159

Browse files
committed
WIP on updating cluster_locks and cluster_locks_tenant
1 parent 8682c14 commit 03dc159

File tree

2 files changed

+85
-65
lines changed

2 files changed

+85
-65
lines changed

pkg/ccl/logictestccl/testdata/logic_test/cluster_locks_tenant

+27-27
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ user testuser
5555
query TT async,rowsort readReq
5656
SELECT * FROM t
5757
----
58-
a val1
59-
b _updated
60-
c _updated
61-
l _updated
62-
m _updated
63-
p _updated
64-
s _updated
65-
t _updated
66-
z val9
58+
a val1
59+
b val2
60+
c val3
61+
l val4
62+
m val5
63+
p val6
64+
s val7
65+
t val8
66+
z val9
6767

6868
user root
6969

@@ -78,21 +78,21 @@ query TTTTTTTBB colnames,rowsort,retry
7878
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended
7979
FROM crdb_internal.cluster_locks WHERE table_name='t' AND txn_id='$txn1'
8080
----
81-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
82-
test public t /Table/106/1/"b"/0 Intent Replicated SERIALIZABLE true true
83-
test public t /Table/106/1/"c"/0 Intent Replicated SERIALIZABLE true false
84-
test public t /Table/106/1/"l"/0 Intent Replicated SERIALIZABLE true false
85-
test public t /Table/106/1/"m"/0 Intent Replicated SERIALIZABLE true false
86-
test public t /Table/106/1/"p"/0 Intent Replicated SERIALIZABLE true false
87-
test public t /Table/106/1/"s"/0 Intent Replicated SERIALIZABLE true false
88-
test public t /Table/106/1/"t"/0 Intent Replicated SERIALIZABLE true false
81+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
82+
test public t /Table/106/1/"b"/0 Exclusive Unreplicated SERIALIZABLE true true
83+
test public t /Table/106/1/"c"/0 Exclusive Unreplicated SERIALIZABLE true false
84+
test public t /Table/106/1/"l"/0 Exclusive Unreplicated SERIALIZABLE true false
85+
test public t /Table/106/1/"m"/0 Exclusive Unreplicated SERIALIZABLE true false
86+
test public t /Table/106/1/"p"/0 Exclusive Unreplicated SERIALIZABLE true false
87+
test public t /Table/106/1/"s"/0 Exclusive Unreplicated SERIALIZABLE true false
88+
test public t /Table/106/1/"t"/0 Exclusive Unreplicated SERIALIZABLE true false
8989

9090
query TTTTTTTBB colnames
9191
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended
9292
FROM crdb_internal.cluster_locks WHERE table_name='t' AND txn_id='$txn2'
9393
----
94-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
95-
test public t /Table/106/1/"b"/0 None Replicated SERIALIZABLE false true
94+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
95+
test public t /Table/106/1/"b"/0 None Unreplicated SERIALIZABLE false true
9696

9797
# check that we can't see keys, potentially revealing PII, with VIEWACTIVITYREDACTED
9898
user testuser2
@@ -101,14 +101,14 @@ query TTTTTTTBB colnames,rowsort
101101
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended
102102
FROM crdb_internal.cluster_locks WHERE table_name='t' AND txn_id='$txn1'
103103
----
104-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
105-
test public t · Intent Replicated SERIALIZABLE true true
106-
test public t · Intent Replicated SERIALIZABLE true false
107-
test public t · Intent Replicated SERIALIZABLE true false
108-
test public t · Intent Replicated SERIALIZABLE true false
109-
test public t · Intent Replicated SERIALIZABLE true false
110-
test public t · Intent Replicated SERIALIZABLE true false
111-
test public t · Intent Replicated SERIALIZABLE true false
104+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
105+
test public t · Exclusive Unreplicated SERIALIZABLE true true
106+
test public t · Exclusive Unreplicated SERIALIZABLE true false
107+
test public t · Exclusive Unreplicated SERIALIZABLE true false
108+
test public t · Exclusive Unreplicated SERIALIZABLE true false
109+
test public t · Exclusive Unreplicated SERIALIZABLE true false
110+
test public t · Exclusive Unreplicated SERIALIZABLE true false
111+
test public t · Exclusive Unreplicated SERIALIZABLE true false
112112

113113
user root
114114

pkg/sql/logictest/testdata/logic_test/cluster_locks

+58-38
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ user testuser
8888
query TT async,rowsort readReq
8989
SELECT * FROM t
9090
----
91-
a val1
92-
b _updated
93-
c _updated
94-
l _updated
95-
m _updated
96-
p _updated
97-
s _updated
98-
t _updated
99-
z val9
91+
a val1
92+
b val2
93+
c val3
94+
l val4
95+
m val5
96+
p val6
97+
s val7
98+
t val8
99+
z val9
100100

101101
user root
102102

@@ -110,34 +110,39 @@ testuser SELECT * FROM t executing
110110
query TTTTTTTBB colnames,retry,rowsort
111111
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r1 AND txn_id='$txn1'
112112
----
113-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
114-
test public t /Table/106/1/"b"/0 Intent Replicated SERIALIZABLE true true
115-
test public t /Table/106/1/"c"/0 Intent Replicated SERIALIZABLE true false
113+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
114+
test public t /Table/106/1/"b"/0 Exclusive Unreplicated SERIALIZABLE true true
115+
test public t /Table/106/1/"c"/0 Exclusive Unreplicated SERIALIZABLE true false
116116

117117
query TTTTTTTBB colnames
118118
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r1 AND txn_id='$txn2'
119119
----
120-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
121-
test public t /Table/106/1/"b"/0 None Replicated SERIALIZABLE false true
120+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
121+
test public t /Table/106/1/"b"/0 None Unreplicated SERIALIZABLE false true
122122

123123
# since SQL incorporates limits which disables parallel batches, the select from txn2 will not reach subsequent ranges.
124124

125-
query TTTTTTTBB colnames
125+
query TTTTTTTBB colnames,rowsort
126126
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r2 AND txn_id='$txn1'
127127
----
128-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
128+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
129+
test public t /Table/106/1/"l"/0 Exclusive Unreplicated SERIALIZABLE true false
130+
test public t /Table/106/1/"m"/0 Exclusive Unreplicated SERIALIZABLE true false
131+
test public t /Table/106/1/"p"/0 Exclusive Unreplicated SERIALIZABLE true false
129132

130-
query TTTTTTTBB colnames
133+
query TTTTTTTBB colnames,rowsort
131134
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r2 AND txn_id='$txn2'
132135
----
133136
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
134137

135-
query TTTTTTTBB colnames
138+
query TTTTTTTBB colnames,rowsort
136139
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r3 AND txn_id='$txn1'
137140
----
138-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
141+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
142+
test public t /Table/106/1/"s"/0 Exclusive Unreplicated SERIALIZABLE true false
143+
test public t /Table/106/1/"t"/0 Exclusive Unreplicated SERIALIZABLE true false
139144

140-
query TTTTTTTBB colnames
145+
query TTTTTTTBB colnames,rowsort
141146
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r3 AND txn_id='$txn2'
142147
----
143148
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
@@ -148,45 +153,60 @@ user testuser2
148153
query TTTTTTTBB colnames,rowsort
149154
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE range_id=$r1 AND txn_id='$txn1'
150155
----
151-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
152-
test public t · Intent Replicated SERIALIZABLE true true
153-
test public t · Intent Replicated SERIALIZABLE true false
156+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
157+
test public t · Exclusive Unreplicated SERIALIZABLE true true
158+
test public t · Exclusive Unreplicated SERIALIZABLE true false
154159

155160
user root
156161

157162
query TTTTTTTBB colnames,retry,rowsort
158163
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE database_name='test'
159164
----
160-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
161-
test public t /Table/106/1/"b"/0 Intent Replicated SERIALIZABLE true true
162-
test public t /Table/106/1/"b"/0 None Replicated SERIALIZABLE false true
163-
test public t /Table/106/1/"c"/0 Intent Replicated SERIALIZABLE true false
165+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
166+
test public t /Table/106/1/"b"/0 Exclusive Unreplicated SERIALIZABLE true true
167+
test public t /Table/106/1/"b"/0 None Unreplicated SERIALIZABLE false true
168+
test public t /Table/106/1/"c"/0 Exclusive Unreplicated SERIALIZABLE true false
169+
test public t /Table/106/1/"l"/0 Exclusive Unreplicated SERIALIZABLE true false
170+
test public t /Table/106/1/"m"/0 Exclusive Unreplicated SERIALIZABLE true false
171+
test public t /Table/106/1/"p"/0 Exclusive Unreplicated SERIALIZABLE true false
172+
test public t /Table/106/1/"s"/0 Exclusive Unreplicated SERIALIZABLE true false
173+
test public t /Table/106/1/"t"/0 Exclusive Unreplicated SERIALIZABLE true false
164174

165175
query TTTTTTTBB colnames,retry,rowsort
166176
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE table_id='t'::regclass::oid::int
167177
----
168-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
169-
test public t /Table/106/1/"b"/0 Intent Replicated SERIALIZABLE true true
170-
test public t /Table/106/1/"b"/0 None Replicated SERIALIZABLE false true
171-
test public t /Table/106/1/"c"/0 Intent Replicated SERIALIZABLE true false
178+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
179+
test public t /Table/106/1/"b"/0 Exclusive Unreplicated SERIALIZABLE true true
180+
test public t /Table/106/1/"b"/0 None Unreplicated SERIALIZABLE false true
181+
test public t /Table/106/1/"c"/0 Exclusive Unreplicated SERIALIZABLE true false
182+
test public t /Table/106/1/"l"/0 Exclusive Unreplicated SERIALIZABLE true false
183+
test public t /Table/106/1/"m"/0 Exclusive Unreplicated SERIALIZABLE true false
184+
test public t /Table/106/1/"p"/0 Exclusive Unreplicated SERIALIZABLE true false
185+
test public t /Table/106/1/"s"/0 Exclusive Unreplicated SERIALIZABLE true false
186+
test public t /Table/106/1/"t"/0 Exclusive Unreplicated SERIALIZABLE true false
172187

173188
query TTTTTTTBB colnames,retry,rowsort
174189
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE contended=true AND lock_key_pretty LIKE '/Table/106%'
175190
----
176-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
177-
test public t /Table/106/1/"b"/0 Intent Replicated SERIALIZABLE true true
178-
test public t /Table/106/1/"b"/0 None Replicated SERIALIZABLE false true
191+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
192+
test public t /Table/106/1/"b"/0 Exclusive Unreplicated SERIALIZABLE true true
193+
test public t /Table/106/1/"b"/0 None Unreplicated SERIALIZABLE false true
179194

180-
query TTTTTTTBB colnames,retry
195+
query TTTTTTTBB colnames,retry,rowsort
181196
SELECT database_name, schema_name, table_name, lock_key_pretty, lock_strength, durability, isolation_level, granted, contended FROM crdb_internal.cluster_locks WHERE contended=false AND lock_key_pretty LIKE '/Table/106%'
182197
----
183-
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
184-
test public t /Table/106/1/"c"/0 Intent Replicated SERIALIZABLE true false
198+
database_name schema_name table_name lock_key_pretty lock_strength durability isolation_level granted contended
199+
test public t /Table/106/1/"c"/0 Exclusive Unreplicated SERIALIZABLE true false
200+
test public t /Table/106/1/"l"/0 Exclusive Unreplicated SERIALIZABLE true false
201+
test public t /Table/106/1/"m"/0 Exclusive Unreplicated SERIALIZABLE true false
202+
test public t /Table/106/1/"p"/0 Exclusive Unreplicated SERIALIZABLE true false
203+
test public t /Table/106/1/"s"/0 Exclusive Unreplicated SERIALIZABLE true false
204+
test public t /Table/106/1/"t"/0 Exclusive Unreplicated SERIALIZABLE true false
185205

186206
query I
187207
SELECT count(*) FROM crdb_internal.cluster_locks WHERE table_name = 't'
188208
----
189-
3
209+
8
190210

191211
statement ok
192212
COMMIT

0 commit comments

Comments
 (0)