~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to storage/innobase/include/trx0undo.h

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
Transaction undo log
 
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
 
6
Created 3/26/1996 Heikki Tuuri
 
7
*******************************************************/
 
8
 
 
9
#ifndef trx0undo_h
 
10
#define trx0undo_h
 
11
 
 
12
#include "univ.i"
 
13
#include "trx0types.h"
 
14
#include "mtr0mtr.h"
 
15
#include "trx0sys.h"
 
16
#include "page0types.h"
 
17
#include "trx0xa.h"
 
18
 
 
19
/***************************************************************************
 
20
Builds a roll pointer dulint. */
 
21
UNIV_INLINE
 
22
dulint
 
23
trx_undo_build_roll_ptr(
 
24
/*====================*/
 
25
                                /* out: roll pointer */
 
26
        ibool   is_insert,      /* in: TRUE if insert undo log */
 
27
        ulint   rseg_id,        /* in: rollback segment id */
 
28
        ulint   page_no,        /* in: page number */
 
29
        ulint   offset);        /* in: offset of the undo entry within page */
 
30
/***************************************************************************
 
31
Decodes a roll pointer dulint. */
 
32
UNIV_INLINE
 
33
void
 
34
trx_undo_decode_roll_ptr(
 
35
/*=====================*/
 
36
        dulint  roll_ptr,       /* in: roll pointer */
 
37
        ibool*  is_insert,      /* out: TRUE if insert undo log */
 
38
        ulint*  rseg_id,        /* out: rollback segment id */
 
39
        ulint*  page_no,        /* out: page number */
 
40
        ulint*  offset);        /* out: offset of the undo entry within page */
 
41
/***************************************************************************
 
42
Returns TRUE if the roll pointer is of the insert type. */
 
43
UNIV_INLINE
 
44
ibool
 
45
trx_undo_roll_ptr_is_insert(
 
46
/*========================*/
 
47
                                /* out: TRUE if insert undo log */
 
48
        dulint  roll_ptr);      /* in: roll pointer */
 
49
/*********************************************************************
 
50
Writes a roll ptr to an index page. In case that the size changes in
 
51
some future version, this function should be used instead of
 
52
mach_write_... */
 
53
UNIV_INLINE
 
54
void
 
55
trx_write_roll_ptr(
 
56
/*===============*/
 
57
        byte*   ptr,            /* in: pointer to memory where written */
 
58
        dulint  roll_ptr);      /* in: roll ptr */
 
59
/*********************************************************************
 
60
Reads a roll ptr from an index page. In case that the roll ptr size
 
61
changes in some future version, this function should be used instead of
 
62
mach_read_... */
 
63
UNIV_INLINE
 
64
dulint
 
65
trx_read_roll_ptr(
 
66
/*==============*/
 
67
                        /* out: roll ptr */
 
68
        byte*   ptr);   /* in: pointer to memory from where to read */
 
69
/**********************************************************************
 
70
Gets an undo log page and x-latches it. */
 
71
UNIV_INLINE
 
72
page_t*
 
73
trx_undo_page_get(
 
74
/*==============*/
 
75
                                /* out: pointer to page x-latched */
 
76
        ulint   space,          /* in: space where placed */
 
77
        ulint   page_no,        /* in: page number */
 
78
        mtr_t*  mtr);           /* in: mtr */
 
79
/**********************************************************************
 
80
Gets an undo log page and s-latches it. */
 
81
UNIV_INLINE
 
82
page_t*
 
83
trx_undo_page_get_s_latched(
 
84
/*========================*/
 
85
                                /* out: pointer to page s-latched */
 
86
        ulint   space,          /* in: space where placed */
 
87
        ulint   page_no,        /* in: page number */
 
88
        mtr_t*  mtr);           /* in: mtr */
 
89
/**********************************************************************
 
90
Returns the previous undo record on the page in the specified log, or
 
91
NULL if none exists. */
 
92
UNIV_INLINE
 
93
trx_undo_rec_t*
 
94
trx_undo_page_get_prev_rec(
 
95
/*=======================*/
 
96
                                /* out: pointer to record, NULL if none */
 
97
        trx_undo_rec_t* rec,    /* in: undo log record */
 
98
        ulint           page_no,/* in: undo log header page number */
 
99
        ulint           offset);/* in: undo log header offset on page */
 
100
/**********************************************************************
 
101
Returns the next undo log record on the page in the specified log, or
 
102
NULL if none exists. */
 
103
UNIV_INLINE
 
104
trx_undo_rec_t*
 
105
trx_undo_page_get_next_rec(
 
106
/*=======================*/
 
107
                                /* out: pointer to record, NULL if none */
 
108
        trx_undo_rec_t* rec,    /* in: undo log record */
 
109
        ulint           page_no,/* in: undo log header page number */
 
110
        ulint           offset);/* in: undo log header offset on page */
 
111
/**********************************************************************
 
112
Returns the last undo record on the page in the specified undo log, or
 
113
NULL if none exists. */
 
114
UNIV_INLINE
 
115
trx_undo_rec_t*
 
116
trx_undo_page_get_last_rec(
 
117
/*=======================*/
 
118
                        /* out: pointer to record, NULL if none */
 
119
        page_t* undo_page,/* in: undo log page */
 
120
        ulint   page_no,/* in: undo log header page number */
 
121
        ulint   offset);        /* in: undo log header offset on page */
 
122
/**********************************************************************
 
123
Returns the first undo record on the page in the specified undo log, or
 
124
NULL if none exists. */
 
125
UNIV_INLINE
 
126
trx_undo_rec_t*
 
127
trx_undo_page_get_first_rec(
 
128
/*========================*/
 
129
                        /* out: pointer to record, NULL if none */
 
130
        page_t* undo_page,/* in: undo log page */
 
131
        ulint   page_no,/* in: undo log header page number */
 
132
        ulint   offset);/* in: undo log header offset on page */
 
133
/***************************************************************************
 
134
Gets the previous record in an undo log. */
 
135
 
 
136
trx_undo_rec_t*
 
137
trx_undo_get_prev_rec(
 
138
/*==================*/
 
139
                                /* out: undo log record, the page s-latched,
 
140
                                NULL if none */
 
141
        trx_undo_rec_t* rec,    /* in: undo record */
 
142
        ulint           page_no,/* in: undo log header page number */
 
143
        ulint           offset, /* in: undo log header offset on page */
 
144
        mtr_t*          mtr);   /* in: mtr */
 
145
/***************************************************************************
 
146
Gets the next record in an undo log. */
 
147
 
 
148
trx_undo_rec_t*
 
149
trx_undo_get_next_rec(
 
150
/*==================*/
 
151
                                /* out: undo log record, the page s-latched,
 
152
                                NULL if none */
 
153
        trx_undo_rec_t* rec,    /* in: undo record */
 
154
        ulint           page_no,/* in: undo log header page number */
 
155
        ulint           offset, /* in: undo log header offset on page */
 
156
        mtr_t*          mtr);   /* in: mtr */
 
157
/***************************************************************************
 
158
Gets the first record in an undo log. */
 
159
 
 
160
trx_undo_rec_t*
 
161
trx_undo_get_first_rec(
 
162
/*===================*/
 
163
                        /* out: undo log record, the page latched, NULL if
 
164
                        none */
 
165
        ulint   space,  /* in: undo log header space */
 
166
        ulint   page_no,/* in: undo log header page number */
 
167
        ulint   offset, /* in: undo log header offset on page */
 
168
        ulint   mode,   /* in: latching mode: RW_S_LATCH or RW_X_LATCH */
 
169
        mtr_t*  mtr);   /* in: mtr */
 
170
/************************************************************************
 
171
Tries to add a page to the undo log segment where the undo log is placed. */
 
172
 
 
173
ulint
 
174
trx_undo_add_page(
 
175
/*==============*/
 
176
                                /* out: page number if success, else
 
177
                                FIL_NULL */
 
178
        trx_t*          trx,    /* in: transaction */
 
179
        trx_undo_t*     undo,   /* in: undo log memory object */
 
180
        mtr_t*          mtr);   /* in: mtr which does not have a latch to any
 
181
                                undo log page; the caller must have reserved
 
182
                                the rollback segment mutex */
 
183
/***************************************************************************
 
184
Truncates an undo log from the end. This function is used during a rollback
 
185
to free space from an undo log. */
 
186
 
 
187
void
 
188
trx_undo_truncate_end(
 
189
/*==================*/
 
190
        trx_t*          trx,    /* in: transaction whose undo log it is */
 
191
        trx_undo_t*     undo,   /* in: undo log */
 
192
        dulint          limit); /* in: all undo records with undo number
 
193
                                >= this value should be truncated */
 
194
/***************************************************************************
 
195
Truncates an undo log from the start. This function is used during a purge
 
196
operation. */
 
197
 
 
198
void
 
199
trx_undo_truncate_start(
 
200
/*====================*/
 
201
        trx_rseg_t* rseg,       /* in: rollback segment */
 
202
        ulint   space,          /* in: space id of the log */
 
203
        ulint   hdr_page_no,    /* in: header page number */
 
204
        ulint   hdr_offset,     /* in: header offset on the page */
 
205
        dulint  limit);         /* in: all undo pages with undo numbers <
 
206
                                this value should be truncated; NOTE that
 
207
                                the function only frees whole pages; the
 
208
                                header page is not freed, but emptied, if
 
209
                                all the records there are < limit */
 
210
/************************************************************************
 
211
Initializes the undo log lists for a rollback segment memory copy.
 
212
This function is only called when the database is started or a new
 
213
rollback segment created. */
 
214
 
 
215
ulint
 
216
trx_undo_lists_init(
 
217
/*================*/
 
218
                                /* out: the combined size of undo log segments
 
219
                                in pages */
 
220
        trx_rseg_t*     rseg);  /* in: rollback segment memory object */
 
221
/**************************************************************************
 
222
Assigns an undo log for a transaction. A new undo log is created or a cached
 
223
undo log reused. */
 
224
 
 
225
ulint
 
226
trx_undo_assign_undo(
 
227
/*=================*/
 
228
                                /* out: DB_SUCCESS if undo log assign
 
229
                                 * successful, possible error codes are:
 
230
                                 * ER_TOO_MANY_CONCURRENT_TRXS
 
231
                                 * DB_OUT_OF_FILE_SPAC
 
232
                                 * DB_OUT_OF_MEMORY */
 
233
        trx_t*          trx,    /* in: transaction */
 
234
        ulint           type);  /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
 
235
/**********************************************************************
 
236
Sets the state of the undo log segment at a transaction finish. */
 
237
 
 
238
page_t*
 
239
trx_undo_set_state_at_finish(
 
240
/*=========================*/
 
241
                                /* out: undo log segment header page,
 
242
                                x-latched */
 
243
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
244
        trx_t*          trx,    /* in: transaction */
 
245
        trx_undo_t*     undo,   /* in: undo log memory copy */
 
246
        mtr_t*          mtr);   /* in: mtr */
 
247
/**********************************************************************
 
248
Sets the state of the undo log segment at a transaction prepare. */
 
249
 
 
250
page_t*
 
251
trx_undo_set_state_at_prepare(
 
252
/*==========================*/
 
253
                                /* out: undo log segment header page,
 
254
                                x-latched */
 
255
        trx_t*          trx,    /* in: transaction */
 
256
        trx_undo_t*     undo,   /* in: undo log memory copy */
 
257
        mtr_t*          mtr);   /* in: mtr */
 
258
 
 
259
/**************************************************************************
 
260
Adds the update undo log header as the first in the history list, and
 
261
frees the memory object, or puts it to the list of cached update undo log
 
262
segments. */
 
263
 
 
264
void
 
265
trx_undo_update_cleanup(
 
266
/*====================*/
 
267
        trx_t*  trx,            /* in: trx owning the update undo log */
 
268
        page_t* undo_page,      /* in: update undo log header page,
 
269
                                x-latched */
 
270
        mtr_t*  mtr);           /* in: mtr */
 
271
/**********************************************************************
 
272
Frees or caches an insert undo log after a transaction commit or rollback.
 
273
Knowledge of inserts is not needed after a commit or rollback, therefore
 
274
the data can be discarded. */
 
275
 
 
276
void
 
277
trx_undo_insert_cleanup(
 
278
/*====================*/
 
279
        trx_t*  trx);   /* in: transaction handle */
 
280
/***************************************************************
 
281
Parses the redo log entry of an undo log page initialization. */
 
282
 
 
283
byte*
 
284
trx_undo_parse_page_init(
 
285
/*=====================*/
 
286
                        /* out: end of log record or NULL */
 
287
        byte*   ptr,    /* in: buffer */
 
288
        byte*   end_ptr,/* in: buffer end */
 
289
        page_t* page,   /* in: page or NULL */
 
290
        mtr_t*  mtr);   /* in: mtr or NULL */
 
291
/***************************************************************
 
292
Parses the redo log entry of an undo log page header create or reuse. */
 
293
 
 
294
byte*
 
295
trx_undo_parse_page_header(
 
296
/*=======================*/
 
297
                        /* out: end of log record or NULL */
 
298
        ulint   type,   /* in: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE */
 
299
        byte*   ptr,    /* in: buffer */
 
300
        byte*   end_ptr,/* in: buffer end */
 
301
        page_t* page,   /* in: page or NULL */
 
302
        mtr_t*  mtr);   /* in: mtr or NULL */
 
303
/***************************************************************
 
304
Parses the redo log entry of an undo log page header discard. */
 
305
 
 
306
byte*
 
307
trx_undo_parse_discard_latest(
 
308
/*==========================*/
 
309
                        /* out: end of log record or NULL */
 
310
        byte*   ptr,    /* in: buffer */
 
311
        byte*   end_ptr,/* in: buffer end */
 
312
        page_t* page,   /* in: page or NULL */
 
313
        mtr_t*  mtr);   /* in: mtr or NULL */
 
314
 
 
315
/* Types of an undo log segment */
 
316
#define TRX_UNDO_INSERT         1       /* contains undo entries for inserts */
 
317
#define TRX_UNDO_UPDATE         2       /* contains undo entries for updates
 
318
                                        and delete markings: in short,
 
319
                                        modifys (the name 'UPDATE' is a
 
320
                                        historical relic) */
 
321
/* States of an undo log segment */
 
322
#define TRX_UNDO_ACTIVE         1       /* contains an undo log of an active
 
323
                                        transaction */
 
324
#define TRX_UNDO_CACHED         2       /* cached for quick reuse */
 
325
#define TRX_UNDO_TO_FREE        3       /* insert undo segment can be freed */
 
326
#define TRX_UNDO_TO_PURGE       4       /* update undo segment will not be
 
327
                                        reused: it can be freed in purge when
 
328
                                        all undo data in it is removed */
 
329
#define TRX_UNDO_PREPARED       5       /* contains an undo log of an
 
330
                                        prepared transaction */
 
331
 
 
332
/* Transaction undo log memory object; this is protected by the undo_mutex
 
333
in the corresponding transaction object */
 
334
 
 
335
struct trx_undo_struct{
 
336
        /*-----------------------------*/
 
337
        ulint           id;             /* undo log slot number within the
 
338
                                        rollback segment */
 
339
        ulint           type;           /* TRX_UNDO_INSERT or
 
340
                                        TRX_UNDO_UPDATE */
 
341
        ulint           state;          /* state of the corresponding undo log
 
342
                                        segment */
 
343
        ibool           del_marks;      /* relevant only in an update undo log:
 
344
                                        this is TRUE if the transaction may
 
345
                                        have delete marked records, because of
 
346
                                        a delete of a row or an update of an
 
347
                                        indexed field; purge is then
 
348
                                        necessary; also TRUE if the transaction
 
349
                                        has updated an externally stored
 
350
                                        field */
 
351
        dulint          trx_id;         /* id of the trx assigned to the undo
 
352
                                        log */
 
353
        XID             xid;            /* X/Open XA transaction
 
354
                                        identification */
 
355
        ibool           dict_operation; /* TRUE if a dict operation trx */
 
356
        dulint          table_id;       /* if a dict operation, then the table
 
357
                                        id */
 
358
        trx_rseg_t*     rseg;           /* rseg where the undo log belongs */
 
359
        /*-----------------------------*/
 
360
        ulint           space;          /* space id where the undo log
 
361
                                        placed */
 
362
        ulint           hdr_page_no;    /* page number of the header page in
 
363
                                        the undo log */
 
364
        ulint           hdr_offset;     /* header offset of the undo log on the
 
365
                                        page */
 
366
        ulint           last_page_no;   /* page number of the last page in the
 
367
                                        undo log; this may differ from
 
368
                                        top_page_no during a rollback */
 
369
        ulint           size;           /* current size in pages */
 
370
        /*-----------------------------*/
 
371
        ulint           empty;          /* TRUE if the stack of undo log
 
372
                                        records is currently empty */
 
373
        ulint           top_page_no;    /* page number where the latest undo
 
374
                                        log record was catenated; during
 
375
                                        rollback the page from which the latest
 
376
                                        undo record was chosen */
 
377
        ulint           top_offset;     /* offset of the latest undo record,
 
378
                                        i.e., the topmost element in the undo
 
379
                                        log if we think of it as a stack */
 
380
        dulint          top_undo_no;    /* undo number of the latest record */
 
381
        page_t*         guess_page;     /* guess for the buffer frame where
 
382
                                        the top page might reside */
 
383
        /*-----------------------------*/
 
384
        UT_LIST_NODE_T(trx_undo_t) undo_list;
 
385
                                        /* undo log objects in the rollback
 
386
                                        segment are chained into lists */
 
387
};
 
388
 
 
389
/* The offset of the undo log page header on pages of the undo log */
 
390
#define TRX_UNDO_PAGE_HDR       FSEG_PAGE_DATA
 
391
/*-------------------------------------------------------------*/
 
392
/* Transaction undo log page header offsets */
 
393
#define TRX_UNDO_PAGE_TYPE      0       /* TRX_UNDO_INSERT or
 
394
                                        TRX_UNDO_UPDATE */
 
395
#define TRX_UNDO_PAGE_START     2       /* Byte offset where the undo log
 
396
                                        records for the LATEST transaction
 
397
                                        start on this page (remember that
 
398
                                        in an update undo log, the first page
 
399
                                        can contain several undo logs) */
 
400
#define TRX_UNDO_PAGE_FREE      4       /* On each page of the undo log this
 
401
                                        field contains the byte offset of the
 
402
                                        first free byte on the page */
 
403
#define TRX_UNDO_PAGE_NODE      6       /* The file list node in the chain
 
404
                                        of undo log pages */
 
405
/*-------------------------------------------------------------*/
 
406
#define TRX_UNDO_PAGE_HDR_SIZE  (6 + FLST_NODE_SIZE)
 
407
 
 
408
/* An update undo segment with just one page can be reused if it has
 
409
< this number bytes used; we must leave space at least for one new undo
 
410
log header on the page */
 
411
 
 
412
#define TRX_UNDO_PAGE_REUSE_LIMIT       (3 * UNIV_PAGE_SIZE / 4)
 
413
 
 
414
/* An update undo log segment may contain several undo logs on its first page
 
415
if the undo logs took so little space that the segment could be cached and
 
416
reused. All the undo log headers are then on the first page, and the last one
 
417
owns the undo log records on subsequent pages if the segment is bigger than
 
418
one page. If an undo log is stored in a segment, then on the first page it is
 
419
allowed to have zero undo records, but if the segment extends to several
 
420
pages, then all the rest of the pages must contain at least one undo log
 
421
record. */
 
422
 
 
423
/* The offset of the undo log segment header on the first page of the undo
 
424
log segment */
 
425
 
 
426
#define TRX_UNDO_SEG_HDR        (TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE)
 
427
/*-------------------------------------------------------------*/
 
428
#define TRX_UNDO_STATE          0       /* TRX_UNDO_ACTIVE, ... */
 
429
#define TRX_UNDO_LAST_LOG       2       /* Offset of the last undo log header
 
430
                                        on the segment header page, 0 if
 
431
                                        none */
 
432
#define TRX_UNDO_FSEG_HEADER    4       /* Header for the file segment which
 
433
                                        the undo log segment occupies */
 
434
#define TRX_UNDO_PAGE_LIST      (4 + FSEG_HEADER_SIZE)
 
435
                                        /* Base node for the list of pages in
 
436
                                        the undo log segment; defined only on
 
437
                                        the undo log segment's first page */
 
438
/*-------------------------------------------------------------*/
 
439
/* Size of the undo log segment header */
 
440
#define TRX_UNDO_SEG_HDR_SIZE   (4 + FSEG_HEADER_SIZE + FLST_BASE_NODE_SIZE)
 
441
 
 
442
 
 
443
/* The undo log header. There can be several undo log headers on the first
 
444
page of an update undo log segment. */
 
445
/*-------------------------------------------------------------*/
 
446
#define TRX_UNDO_TRX_ID         0       /* Transaction id */
 
447
#define TRX_UNDO_TRX_NO         8       /* Transaction number of the
 
448
                                        transaction; defined only if the log
 
449
                                        is in a history list */
 
450
#define TRX_UNDO_DEL_MARKS      16      /* Defined only in an update undo
 
451
                                        log: TRUE if the transaction may have
 
452
                                        done delete markings of records, and
 
453
                                        thus purge is necessary */
 
454
#define TRX_UNDO_LOG_START      18      /* Offset of the first undo log record
 
455
                                        of this log on the header page; purge
 
456
                                        may remove undo log record from the
 
457
                                        log start, and therefore this is not
 
458
                                        necessarily the same as this log
 
459
                                        header end offset */
 
460
#define TRX_UNDO_XID_EXISTS     20      /* TRUE if undo log header includes
 
461
                                        X/Open XA transaction identification
 
462
                                        XID */
 
463
#define TRX_UNDO_DICT_TRANS     21      /* TRUE if the transaction is a table
 
464
                                        create, index create, or drop
 
465
                                        transaction: in recovery
 
466
                                        the transaction cannot be rolled back
 
467
                                        in the usual way: a 'rollback' rather
 
468
                                        means dropping the created or dropped
 
469
                                        table, if it still exists */
 
470
#define TRX_UNDO_TABLE_ID       22      /* Id of the table if the preceding
 
471
                                        field is TRUE */
 
472
#define TRX_UNDO_NEXT_LOG       30      /* Offset of the next undo log header
 
473
                                        on this page, 0 if none */
 
474
#define TRX_UNDO_PREV_LOG       32      /* Offset of the previous undo log
 
475
                                        header on this page, 0 if none */
 
476
#define TRX_UNDO_HISTORY_NODE   34      /* If the log is put to the history
 
477
                                        list, the file list node is here */
 
478
/*-------------------------------------------------------------*/
 
479
#define TRX_UNDO_LOG_OLD_HDR_SIZE (34 + FLST_NODE_SIZE)
 
480
 
 
481
/* Note: the writing of the undo log old header is coded by a log record
 
482
MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE. The appending of an XID to the
 
483
header is logged separately. In this sense, the XID is not really a member
 
484
of the undo log header. TODO: do not append the XID to the log header if XA
 
485
is not needed by the user. The XID wastes about 150 bytes of space in every
 
486
undo log. In the history list we may have millions of undo logs, which means
 
487
quite a large overhead. */
 
488
 
 
489
/* X/Open XA Transaction Identification (XID) */
 
490
 
 
491
#define TRX_UNDO_XA_FORMAT      (TRX_UNDO_LOG_OLD_HDR_SIZE)
 
492
#define TRX_UNDO_XA_TRID_LEN    (TRX_UNDO_XA_FORMAT + 4)
 
493
#define TRX_UNDO_XA_BQUAL_LEN   (TRX_UNDO_XA_TRID_LEN + 4)
 
494
#define TRX_UNDO_XA_XID         (TRX_UNDO_XA_BQUAL_LEN + 4)
 
495
/*--------------------------------------------------------------*/
 
496
#define TRX_UNDO_LOG_XA_HDR_SIZE (TRX_UNDO_XA_XID + XIDDATASIZE)
 
497
                                /* Total size of the header with the XA XID */
 
498
 
 
499
#ifndef UNIV_NONINL
 
500
#include "trx0undo.ic"
 
501
#endif
 
502
 
 
503
#endif