@@ -138,27 +138,13 @@ typedef uint16 LOCKMETHODID;
138
138
typedef enum LockTagType
139
139
{
140
140
LOCKTAG_RELATION , /* whole relation */
141
- /* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */
142
141
LOCKTAG_RELATION_EXTEND , /* the right to extend a relation */
143
- /* same ID info as RELATION */
144
142
LOCKTAG_PAGE , /* one page of a relation */
145
- /* ID info for a page is RELATION info + BlockNumber */
146
143
LOCKTAG_TUPLE , /* one physical tuple */
147
- /* ID info for a tuple is PAGE info + OffsetNumber */
148
144
LOCKTAG_TRANSACTION , /* transaction (for waiting for xact done) */
149
- /* ID info for a transaction is its TransactionId */
150
145
LOCKTAG_VIRTUALTRANSACTION , /* virtual transaction (ditto) */
151
- /* ID info for a virtual transaction is its VirtualTransactionId */
152
146
LOCKTAG_SPECULATIVE_TOKEN , /* speculative insertion Xid and token */
153
- /* ID info for a transaction is its TransactionId */
154
147
LOCKTAG_OBJECT , /* non-relation database object */
155
- /* ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID */
156
-
157
- /*
158
- * Note: object ID has same representation as in pg_depend and
159
- * pg_description, but notice that we are constraining SUBID to 16 bits.
160
- * Also, we use DB OID = 0 for shared objects such as tablespaces.
161
- */
162
148
LOCKTAG_USERLOCK , /* reserved for old contrib/userlock code */
163
149
LOCKTAG_ADVISORY /* advisory user locks */
164
150
} LockTagType ;
@@ -190,6 +176,8 @@ typedef struct LOCKTAG
190
176
* the physical fields of LOCKTAG. Use these to set up LOCKTAG values,
191
177
* rather than accessing the fields directly. Note multiple eval of target!
192
178
*/
179
+
180
+ /* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */
193
181
#define SET_LOCKTAG_RELATION (locktag ,dboid ,reloid ) \
194
182
((locktag).locktag_field1 = (dboid), \
195
183
(locktag).locktag_field2 = (reloid), \
@@ -198,6 +186,7 @@ typedef struct LOCKTAG
198
186
(locktag).locktag_type = LOCKTAG_RELATION, \
199
187
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
200
188
189
+ /* same ID info as RELATION */
201
190
#define SET_LOCKTAG_RELATION_EXTEND (locktag ,dboid ,reloid ) \
202
191
((locktag).locktag_field1 = (dboid), \
203
192
(locktag).locktag_field2 = (reloid), \
@@ -206,6 +195,7 @@ typedef struct LOCKTAG
206
195
(locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \
207
196
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
208
197
198
+ /* ID info for a page is RELATION info + BlockNumber */
209
199
#define SET_LOCKTAG_PAGE (locktag ,dboid ,reloid ,blocknum ) \
210
200
((locktag).locktag_field1 = (dboid), \
211
201
(locktag).locktag_field2 = (reloid), \
@@ -214,6 +204,7 @@ typedef struct LOCKTAG
214
204
(locktag).locktag_type = LOCKTAG_PAGE, \
215
205
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
216
206
207
+ /* ID info for a tuple is PAGE info + OffsetNumber */
217
208
#define SET_LOCKTAG_TUPLE (locktag ,dboid ,reloid ,blocknum ,offnum ) \
218
209
((locktag).locktag_field1 = (dboid), \
219
210
(locktag).locktag_field2 = (reloid), \
@@ -222,6 +213,7 @@ typedef struct LOCKTAG
222
213
(locktag).locktag_type = LOCKTAG_TUPLE, \
223
214
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
224
215
216
+ /* ID info for a transaction is its TransactionId */
225
217
#define SET_LOCKTAG_TRANSACTION (locktag ,xid ) \
226
218
((locktag).locktag_field1 = (xid), \
227
219
(locktag).locktag_field2 = 0, \
@@ -230,6 +222,7 @@ typedef struct LOCKTAG
230
222
(locktag).locktag_type = LOCKTAG_TRANSACTION, \
231
223
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
232
224
225
+ /* ID info for a virtual transaction is its VirtualTransactionId */
233
226
#define SET_LOCKTAG_VIRTUALTRANSACTION (locktag ,vxid ) \
234
227
((locktag).locktag_field1 = (vxid).backendId, \
235
228
(locktag).locktag_field2 = (vxid).localTransactionId, \
@@ -238,6 +231,10 @@ typedef struct LOCKTAG
238
231
(locktag).locktag_type = LOCKTAG_VIRTUALTRANSACTION, \
239
232
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
240
233
234
+ /*
235
+ * ID info for a speculative insert is TRANSACTION info +
236
+ * its speculative insert counter.
237
+ */
241
238
#define SET_LOCKTAG_SPECULATIVE_INSERTION (locktag ,xid ,token ) \
242
239
((locktag).locktag_field1 = (xid), \
243
240
(locktag).locktag_field2 = (token), \
@@ -246,6 +243,13 @@ typedef struct LOCKTAG
246
243
(locktag).locktag_type = LOCKTAG_SPECULATIVE_TOKEN, \
247
244
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
248
245
246
+ /*
247
+ * ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID
248
+ *
249
+ * Note: object ID has same representation as in pg_depend and
250
+ * pg_description, but notice that we are constraining SUBID to 16 bits.
251
+ * Also, we use DB OID = 0 for shared objects such as tablespaces.
252
+ */
249
253
#define SET_LOCKTAG_OBJECT (locktag ,dboid ,classoid ,objoid ,objsubid ) \
250
254
((locktag).locktag_field1 = (dboid), \
251
255
(locktag).locktag_field2 = (classoid), \
0 commit comments