summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs_column_types.h
blob: 146c9c8054e4b919a0342334874ba4776d58cc64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2.0,
  as published by the Free Software Foundation.

  This program is also distributed with certain software (including
  but not limited to OpenSSL) that is licensed under separate terms,
  as designated in a particular file or component or in included license
  documentation.  The authors of MySQL hereby grant you an additional
  permission to link the program and your derivative works with the
  separately licensed software that they have included with MySQL.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License, version 2.0, for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */

#ifndef PFS_COLUMN_TYPES_H
#define PFS_COLUMN_TYPES_H

/**
  @file storage/perfschema/pfs_column_types.h
  Data types for columns used in the performance schema tables (declarations)
*/

/** Size of the OBJECT_SCHEMA columns. */
#define COL_OBJECT_SCHEMA_SIZE 64

/**
  Size of the extended OBJECT_NAME columns.
  'Extended' columns are used when the object name also represents
  the name of a non SQL object, such as a file name.
  Size in bytes of:
  - performance_schema.events_waits_current (OBJECT_NAME)
  - performance_schema.events_waits_history (OBJECT_NAME)
  - performance_schema.events_waits_history_long (OBJECT_NAME)
*/
#define COL_OBJECT_NAME_EXTENDED_SIZE 512

/** Size of the OBJECT_NAME columns. */
#define COL_OBJECT_NAME_SIZE 64

/** Size of the INDEX_NAME columns. */
#define COL_INDEX_NAME_SIZE 64

/**
  Size of INFO columns.
  Size in bytes of:
  - performance_schema.events_statement_current (INFO)
  - performance_schema.events_statement_history (INFO)
  - performance_schema.events_statement_history_long (INFO)
*/
#define COL_INFO_SIZE 1024

/** Size of the SOURCE columns. */
#define COL_SOURCE_SIZE 64

/** Size of the DIGEST columns. */
#define COL_DIGEST_SIZE 64

/**
  Enum values for the TIMER_NAME columns.
  This enum is found in the following tables:
  - performance_schema.setup_timer (TIMER_NAME)
  - performance_schema.performance_timer (TIMER_NAME)
*/
enum enum_timer_name
{
  TIMER_NAME_CYCLE= 1,
  TIMER_NAME_NANOSEC= 2,
  TIMER_NAME_MICROSEC= 3,
  TIMER_NAME_MILLISEC= 4,
  TIMER_NAME_TICK= 5
};

/** Integer, first value of @sa enum_timer_name. */
#define FIRST_TIMER_NAME (static_cast<int> (TIMER_NAME_CYCLE))
/** Integer, last value of @sa enum_timer_name. */
#define LAST_TIMER_NAME (static_cast<int> (TIMER_NAME_TICK))
/** Integer, number of values of @sa enum_timer_name. */
#define COUNT_TIMER_NAME (LAST_TIMER_NAME - FIRST_TIMER_NAME + 1)

/**
  Enum values for the various YES/NO columns.
  This enum is found in the following tables:
  - performance_schema.setup_instruments (ENABLED)
  - performance_schema.setup_instruments (TIMED)
  - performance_schema.setup_consumers (ENABLED)
*/
enum enum_yes_no
{
  ENUM_YES= 1,
  ENUM_NO= 2
};

/**
  Enum values for the various OPERATION columns.
  This enum is found in the following tables:
  - performance_schema.events_waits_current (OPERATION)
  - performance_schema.events_waits_history (OPERATION)
  - performance_schema.events_waits_history_long (OPERATION)
*/
enum enum_operation_type
{
  /* Mutex operations */
  OPERATION_TYPE_LOCK= 1,
  OPERATION_TYPE_TRYLOCK= 2,

  /* Rwlock operations (RW-lock) */
  OPERATION_TYPE_READLOCK= 3,
  OPERATION_TYPE_WRITELOCK= 4,
  OPERATION_TYPE_TRYREADLOCK= 5,
  OPERATION_TYPE_TRYWRITELOCK= 6,

  /* Rwlock operations (SX-lock) */
  OPERATION_TYPE_SHAREDLOCK= 7,
  OPERATION_TYPE_SHAREDEXCLUSIVELOCK= 8,
  OPERATION_TYPE_EXCLUSIVELOCK= 9,
  OPERATION_TYPE_TRYSHAREDLOCK= 10,
  OPERATION_TYPE_TRYSHAREDEXCLUSIVELOCK= 11,
  OPERATION_TYPE_TRYEXCLUSIVELOCK= 12,

  /* Cond operations */
  OPERATION_TYPE_WAIT= 13,
  OPERATION_TYPE_TIMEDWAIT= 14,

  /* File operations */
  OPERATION_TYPE_FILECREATE= 15,
  OPERATION_TYPE_FILECREATETMP= 16,
  OPERATION_TYPE_FILEOPEN= 17,
  OPERATION_TYPE_FILESTREAMOPEN= 18,
  OPERATION_TYPE_FILECLOSE= 19,
  OPERATION_TYPE_FILESTREAMCLOSE= 20,
  OPERATION_TYPE_FILEREAD= 21,
  OPERATION_TYPE_FILEWRITE= 22,
  OPERATION_TYPE_FILESEEK= 23,
  OPERATION_TYPE_FILETELL= 24,
  OPERATION_TYPE_FILEFLUSH= 25,
  OPERATION_TYPE_FILESTAT= 26,
  OPERATION_TYPE_FILEFSTAT= 27,
  OPERATION_TYPE_FILECHSIZE= 28,
  OPERATION_TYPE_FILEDELETE= 29,
  OPERATION_TYPE_FILERENAME= 30,
  OPERATION_TYPE_FILESYNC= 31,

  /* Table io operations */
  OPERATION_TYPE_TABLE_FETCH= 32,
  OPERATION_TYPE_TABLE_WRITE_ROW= 33,
  OPERATION_TYPE_TABLE_UPDATE_ROW= 34,
  OPERATION_TYPE_TABLE_DELETE_ROW= 35,

  /* Table lock operations */
  OPERATION_TYPE_TL_READ_NORMAL= 36,
  OPERATION_TYPE_TL_READ_WITH_SHARED_LOCKS= 37,
  OPERATION_TYPE_TL_READ_HIGH_PRIORITY= 38,
  OPERATION_TYPE_TL_READ_NO_INSERTS= 39,
  OPERATION_TYPE_TL_WRITE_ALLOW_WRITE= 40,
  OPERATION_TYPE_TL_WRITE_CONCURRENT_INSERT= 41,
  OPERATION_TYPE_TL_WRITE_DELAYED= 42,
  OPERATION_TYPE_TL_WRITE_LOW_PRIORITY= 43,
  OPERATION_TYPE_TL_WRITE_NORMAL= 44,
  OPERATION_TYPE_TL_READ_EXTERNAL= 45,
  OPERATION_TYPE_TL_WRITE_EXTERNAL= 46,

  /* Socket operations */
  OPERATION_TYPE_SOCKETCREATE = 47,
  OPERATION_TYPE_SOCKETCONNECT = 48,
  OPERATION_TYPE_SOCKETBIND = 49,
  OPERATION_TYPE_SOCKETCLOSE = 50,
  OPERATION_TYPE_SOCKETSEND = 51,
  OPERATION_TYPE_SOCKETRECV = 52,
  OPERATION_TYPE_SOCKETSENDTO = 53,
  OPERATION_TYPE_SOCKETRECVFROM = 54,
  OPERATION_TYPE_SOCKETSENDMSG = 55,
  OPERATION_TYPE_SOCKETRECVMSG = 56,
  OPERATION_TYPE_SOCKETSEEK = 57,
  OPERATION_TYPE_SOCKETOPT = 58,
  OPERATION_TYPE_SOCKETSTAT = 59,
  OPERATION_TYPE_SOCKETSHUTDOWN = 60,
  OPERATION_TYPE_SOCKETSELECT = 61,

  /* Idle operation */
  OPERATION_TYPE_IDLE= 62,

  /* Metadata lock operation */
  OPERATION_TYPE_METADATA= 63
};
/** Integer, first value of @sa enum_operation_type. */
#define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK))
/** Integer, last value of @sa enum_operation_type. */
#define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_METADATA))
/** Integer, number of values of @sa enum_operation_type. */
#define COUNT_OPERATION_TYPE (LAST_OPERATION_TYPE - FIRST_OPERATION_TYPE + 1)

/**
  Enum values for the various OBJECT_TYPE columns.
*/
enum enum_object_type
{
  NO_OBJECT_TYPE= 0,

  /* Advertised in SQL ENUM (see table_setup_object.cc) */

  OBJECT_TYPE_EVENT= 1,
  OBJECT_TYPE_FUNCTION= 2,
  OBJECT_TYPE_PROCEDURE= 3,
  OBJECT_TYPE_TABLE= 4,
  OBJECT_TYPE_TRIGGER= 5,

  /* Not advertised in SQL ENUM, only displayed as VARCHAR */

  OBJECT_TYPE_TEMPORARY_TABLE= 6,
  OBJECT_TYPE_BACKUP= 7,
  OBJECT_TYPE_SCHEMA= 8,
  OBJECT_TYPE_PACKAGE= 9,
  OBJECT_TYPE_PACKAGE_BODY= 10,
  OBJECT_TYPE_USER_LEVEL_LOCK= 11,
};
/** Integer, first value of @sa enum_object_type. */
#define FIRST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_EVENT))
/** Integer, last value of @sa enum_object_type. */
#define LAST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_USER_LEVEL_LOCK))
/** Integer, number of values of @sa enum_object_type. */
#define COUNT_OBJECT_TYPE (LAST_OBJECT_TYPE - FIRST_OBJECT_TYPE + 1)

/**
  Enum values for the NESTING_EVENT_TYPE columns.
  This enum is found in the following tables:
  - performance_schema.events_waits_current (NESTING_EVENT_TYPE)
  - performance_schema.events_stages_current (NESTING_EVENT_TYPE)
  - performance_schema.events_statements_current (NESTING_EVENT_TYPE)
*/
enum enum_event_type
{
  EVENT_TYPE_TRANSACTION= 1,
  EVENT_TYPE_STATEMENT= 2,
  EVENT_TYPE_STAGE= 3,
  EVENT_TYPE_WAIT= 4
};

/** Integer, first value of @sa enum_event_type. */
#define FIRST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_TRANSACTION))
/** Integer, last value of @sa enum_event_type. */
#define LAST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_WAIT))
/** Integer, number of values of @sa enum_event_type. */
#define COUNT_EVENT_TYPE (LAST_EVENT_TYPE - FIRST_EVENT_TYPE + 1)

/**
  Enum values for transaction state columns.
*/
enum enum_transaction_state
{
  TRANS_STATE_ACTIVE= 1,
  TRANS_STATE_COMMITTED= 2,
  TRANS_STATE_ROLLED_BACK= 3
};

/** Integer, first value of @sa enum_transaction_state. */
#define FIRST_TRANS_STATE (static_cast<int> (TRANS_STATE_ACTIVE))
/** Integer, last value of @sa enum_transaction_state. */
#define LAST_TRANS_STATE (static_cast<int> (TRANS_STATE_ROLLED_BACK))
/** Integer, number of values of @sa enum_transaction_state. */
#define COUNT_TRANS_STATE (LAST_TRANS_STATE - FIRST_TRANS_STATE + 1)

/**
  Enum values for XA transaction state columns. Enums 0-3 match those used by
  the server. See XID_STATE::enum xa_states in xa.h.
*/
enum enum_xa_transaction_state
{
  TRANS_STATE_XA_NOTR=-1,
  TRANS_STATE_XA_ACTIVE=0,
  TRANS_STATE_XA_IDLE,
  TRANS_STATE_XA_PREPARED,
  TRANS_STATE_XA_ROLLBACK_ONLY,
  TRANS_STATE_XA_COMMITTED
};

/** Integer, first value of @sa enum_xa_transaction_state. */
#define FIRST_TRANS_STATE_XA (static_cast<int> (TRANS_STATE_XA_NOTR))
/** Integer, last value of @sa enum_xa_transaction_state. */
#define LAST_TRANS_STATE_XA (static_cast<int> (TRANS_STATE_XA_COMMITTED))
/** Integer, number of values of @sa enum_xa_transaction_state. */
#define COUNT_TRANS_STATE_XA (LAST_TRANS_STATE_XA - FIRST_TRANS_STATE_XA + 1)

/**
  Enum values for transaction isolation level columns.
  See enum_tx_isolation in handler.h.
*/
enum enum_isolation_level
{
  TRANS_LEVEL_READ_UNCOMMITTED,
  TRANS_LEVEL_READ_COMMITTED,
  TRANS_LEVEL_REPEATABLE_READ,
  TRANS_LEVEL_SERIALIZABLE
};

/** Integer, first value of @sa enum_isolation_level. */
#define FIRST_TRANS_LEVEL (static_cast<int> (TRANS_LEVEL_READ_UNCOMMITTED))
/** Integer, last value of @sa enum_isolation_level. */
#define LAST_TRANS_LEVEL (static_cast<int> (TRANS_LEVEL_SERIALIZABLE))
/** Integer, number of values of @sa enum_isolation_level. */
#define COUNT_TRANS_LEVEL (LAST_TRANS_LEVEL - FIRST_TRANS_LEVEL + 1)

/**
  Enum values for transaction acces mode columns.
*/
enum enum_transaction_mode
{
  TRANS_MODE_READ_ONLY= 1,
  TRANS_MODE_READ_WRITE= 2
};

/** Integer, first value of @sa enum_transaction_mode. */
#define FIRST_TRANS_MODE (static_cast<int> (TRANS_MODE_READ_WRITE))
/** Integer, last value of @sa enum_transaction_mode. */
#define LAST_TRANS_MODE (static_cast<int> (TRANS_MODE_READ_ONLY))
/** Integer, number of values of @sa enum_transaction_mode. */
#define COUNT_TRANS_MODE (LAST_TRANS_MODE - FIRST_TRANS_MODE + 1)


#endif