139
141
ulint id); /* in: space id */
140
142
/***********************************************************************
141
143
Returns the latch of a file space. */
144
146
fil_space_get_latch(
145
147
/*================*/
146
148
/* out: latch protecting storage allocation */
147
ulint id); /* in: space id */
149
ulint id, /* in: space id */
150
ulint* zip_size);/* out: compressed page size, or
151
0 for uncompressed tablespaces */
148
152
/***********************************************************************
149
153
Returns the type of a file space. */
152
156
fil_space_get_type(
153
157
/*===============*/
173
177
ulint id, /* in: space id where to append */
174
178
ibool is_raw);/* in: TRUE if a raw device or
175
179
a raw disk partition */
180
#ifdef UNIV_LOG_ARCHIVE
176
181
/********************************************************************
177
182
Drops files from the start of a file space, so that its size is cut by
178
183
the amount given. */
181
186
fil_space_truncate_start(
182
187
/*=====================*/
184
189
ulint trunc_len); /* in: truncate by this much; it is an error
185
190
if this does not equal to the combined size of
186
191
some initial files in the space */
192
#endif /* UNIV_LOG_ARCHIVE */
187
193
/***********************************************************************
188
194
Creates a space memory object and puts it to the 'fil system' hash table. If
189
195
there is an error, prints an error message to the .err log. */
192
198
fil_space_create(
193
199
/*=============*/
194
200
/* out: TRUE if success */
195
201
const char* name, /* in: space name */
196
202
ulint id, /* in: space id */
203
ulint zip_size,/* in: compressed page size, or
204
0 for uncompressed tablespaces */
197
205
ulint purpose);/* in: FIL_TABLESPACE, or FIL_LOG if log */
198
206
/***********************************************************************
199
207
Frees a space object from a the tablespace memory cache. Closes the files in
200
208
the chain but does not delete them. */
207
215
/***********************************************************************
208
216
Returns the size of the space in pages. The tablespace must be cached in the
212
220
fil_space_get_size(
213
221
/*===============*/
214
222
/* out: space size, 0 if space not found */
215
223
ulint id); /* in: space id */
216
224
/***********************************************************************
225
Returns the flags of the space. The tablespace must be cached
226
in the memory cache. */
231
/* out: flags, ULINT_UNDEFINED if space not found */
232
ulint id); /* in: space id */
233
/***********************************************************************
234
Returns the compressed page size of the space, or 0 if the space
235
is not compressed. The tablespace must be cached in the memory cache. */
238
fil_space_get_zip_size(
239
/*===================*/
240
/* out: compressed page size, ULINT_UNDEFINED
241
if space not found */
242
ulint id); /* in: space id */
243
/***********************************************************************
217
244
Checks if the pair space, page_no refers to an existing page in a tablespace
218
245
file space. The tablespace must be cached in the memory cache. */
221
248
fil_check_adress_in_tablespace(
222
249
/*===========================*/
236
263
space objects for the log and the system tablespace have been created. The
237
264
purpose of this operation is to make sure we never run out of file descriptors
238
265
if we need to read from the insert buffer or to write to the log. */
241
268
fil_open_log_and_system_tablespace_files(void);
242
269
/*==========================================*/
243
270
/***********************************************************************
244
271
Closes all open files. There must not be any pending i/o's or not flushed
245
272
modifications in the files. */
248
275
fil_close_all_files(void);
249
276
/*=====================*/
250
277
/***********************************************************************
251
278
Sets the max tablespace id counter if the given number is bigger than the
252
279
previous value. */
255
282
fil_set_max_space_id_if_bigger(
256
283
/*===========================*/
259
286
Initializes the ibuf data structure for space 0 == the system tablespace.
260
287
This can be called after the file space headers have been created and the
261
288
dictionary system has been initialized. */
264
291
fil_ibuf_init_at_db_start(void);
265
292
/*===========================*/
266
293
/********************************************************************
267
294
Writes the flushed lsn and the latest archived log number to the page
268
295
header of the first page of each data file in the system tablespace. */
271
298
fil_write_flushed_lsn_to_data_files(
272
299
/*================================*/
273
/* out: DB_SUCCESS or error number */
274
dulint lsn, /* in: lsn to write */
275
ulint arch_log_no); /* in: latest archived log file number */
300
/* out: DB_SUCCESS or error number */
301
ib_uint64_t lsn, /* in: lsn to write */
302
ulint arch_log_no); /* in: latest archived log
276
304
/***********************************************************************
277
305
Reads the flushed lsn and arch no fields from a data file at database
281
309
fil_read_flushed_lsn_and_arch_log_no(
282
310
/*=================================*/
283
os_file_t data_file, /* in: open data file */
284
ibool one_read_already, /* in: TRUE if min and max parameters
285
below already contain sensible data */
311
os_file_t data_file, /* in: open data file */
312
ibool one_read_already, /* in: TRUE if min and max
313
parameters below already
314
contain sensible data */
286
315
#ifdef UNIV_LOG_ARCHIVE
287
ulint* min_arch_log_no, /* in/out: */
288
ulint* max_arch_log_no, /* in/out: */
316
ulint* min_arch_log_no, /* in/out: */
317
ulint* max_arch_log_no, /* in/out: */
289
318
#endif /* UNIV_LOG_ARCHIVE */
290
dulint* min_flushed_lsn, /* in/out: */
291
dulint* max_flushed_lsn); /* in/out: */
319
ib_uint64_t* min_flushed_lsn, /* in/out: */
320
ib_uint64_t* max_flushed_lsn); /* in/out: */
292
321
/***********************************************************************
293
322
Increments the count of pending insert buffer page merges, if space is not
294
323
being deleted. */
297
326
fil_inc_pending_ibuf_merges(
298
327
/*========================*/
330
359
not fir completely between ptr and end_ptr */
331
360
byte* end_ptr, /* in: buffer end */
332
361
ulint type, /* in: the type of this log record */
333
ibool do_replay, /* in: TRUE if we want to replay the
334
operation, and not just parse the log record */
335
ulint space_id); /* in: if do_replay is TRUE, the space id of
336
the tablespace in question; otherwise
362
ulint space_id); /* in: the space id of the tablespace in
363
question, or 0 if the log record should
364
only be parsed but not replayed */
338
365
/***********************************************************************
339
366
Deletes a single-table tablespace. The tablespace must be cached in the
343
370
fil_delete_tablespace(
344
371
/*==================*/
396
423
ibool is_temp, /* in: TRUE if a table created with
397
424
CREATE TEMPORARY TABLE */
425
ulint flags, /* in: tablespace flags */
398
426
ulint size); /* in: the initial size of the
399
427
tablespace file in pages,
400
428
must be >= FIL_IBD_FILE_INITIAL_SIZE */
420
448
faster (the OS caches them) than
421
449
accessing the first page of the file */
422
450
ulint id, /* in: space id */
451
ulint flags, /* in: tablespace flags */
423
452
const char* name); /* in: table name in the
424
453
databasename/tablename format */
425
454
/************************************************************************
431
460
the shutdown stamped the latest lsn to the FIL_PAGE_FILE_FLUSH_LSN in the
432
461
first page of the .ibd file, and we can determine whether we need to reset the
433
462
lsn's just by looking at that flush lsn. */
436
465
fil_reset_too_high_lsns(
437
466
/*====================*/
438
467
/* out: TRUE if success */
439
468
const char* name, /* in: table name in the
440
469
databasename/tablename format */
441
dulint current_lsn); /* in: reset lsn's if the lsn stamped
470
ib_uint64_t current_lsn); /* in: reset lsn's if the lsn stamped
442
471
to FIL_PAGE_FILE_FLUSH_LSN in the
443
472
first page is too high */
444
473
/************************************************************************
459
488
we can call this function to print an error message of orphaned .ibd files
460
489
for which there is not a data dictionary entry with a matching table name
464
493
fil_print_orphaned_tablespaces(void);
465
494
/*================================*/
466
495
/***********************************************************************
467
496
Returns TRUE if a single-table tablespace does not exist in the memory cache,
468
497
or is being deleted there. */
471
500
fil_tablespace_deleted_or_being_deleted_in_mem(
472
501
/*===========================================*/
473
502
/* out: TRUE if does not exist or is being\
475
504
ulint id, /* in: space id */
476
ib_longlong version);/* in: tablespace_version should be this; if
505
ib_int64_t version);/* in: tablespace_version should be this; if
477
506
you pass -1 as the value of this, then this
478
507
parameter is ignored */
479
508
/***********************************************************************
480
509
Returns TRUE if a single-table tablespace exists in the memory cache. */
483
512
fil_tablespace_exists_in_mem(
484
513
/*=========================*/
533
562
ibbackup --apply-log phase we extended the spaces on-demand so that log records
534
563
could be appllied, but that may have left spaces still too small compared to
535
564
the size stored in the space header. */
538
567
fil_extend_tablespaces_to_stored_len(void);
539
568
/*======================================*/
541
570
/***********************************************************************
542
571
Tries to reserve free extents in a file space. */
545
574
fil_space_reserve_free_extents(
546
575
/*===========================*/
559
588
/***********************************************************************
560
589
Gets the number of reserved extents. If the database is silent, this number
561
590
should be zero. */
564
593
fil_space_get_n_reserved_extents(
565
594
/*=============================*/
566
595
ulint id); /* in: space id */
567
596
/************************************************************************
568
597
Reads or writes data. This operation is asynchronous (aio). */
585
614
ibool sync, /* in: TRUE if synchronous aio is desired */
586
615
ulint space_id, /* in: space id */
616
ulint zip_size, /* in: compressed page size in bytes;
617
0 for uncompressed pages */
587
618
ulint block_offset, /* in: offset in number of blocks */
588
619
ulint byte_offset, /* in: remainder of offset in bytes; in
589
620
aio this must be divisible by the OS block
596
627
appropriately aligned */
597
628
void* message); /* in: message for aio handler if non-sync
598
629
aio used, else ignored */
599
/************************************************************************
600
Reads data from a space to a buffer. Remember that the possible incomplete
601
blocks at the end of file are ignored: they are not taken into account when
602
calculating the byte offset within a space. */
607
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
608
if we are trying to do i/o on a tablespace
609
which does not exist */
610
ibool sync, /* in: TRUE if synchronous aio is desired */
611
ulint space_id, /* in: space id */
612
ulint block_offset, /* in: offset in number of blocks */
613
ulint byte_offset, /* in: remainder of offset in bytes; in aio
614
this must be divisible by the OS block size */
615
ulint len, /* in: how many bytes to read; this must not
616
cross a file boundary; in aio this must be a
617
block size multiple */
618
void* buf, /* in/out: buffer where to store data read;
619
in aio this must be appropriately aligned */
620
void* message); /* in: message for aio handler if non-sync
621
aio used, else ignored */
622
/************************************************************************
623
Writes data to a space from a buffer. Remember that the possible incomplete
624
blocks at the end of file are ignored: they are not taken into account when
625
calculating the byte offset within a space. */
630
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
631
if we are trying to do i/o on a tablespace
632
which does not exist */
633
ibool sync, /* in: TRUE if synchronous aio is desired */
634
ulint space_id, /* in: space id */
635
ulint block_offset, /* in: offset in number of blocks */
636
ulint byte_offset, /* in: remainder of offset in bytes; in aio
637
this must be divisible by the OS block size */
638
ulint len, /* in: how many bytes to write; this must
639
not cross a file boundary; in aio this must
640
be a block size multiple */
641
void* buf, /* in: buffer from which to write; in aio
642
this must be appropriately aligned */
643
void* message); /* in: message for aio handler if non-sync
644
aio used, else ignored */
645
630
/**************************************************************************
646
631
Waits for an aio operation to complete. This function is used to write the
647
632
handler for completed requests. The aio array of pending requests is divided
648
633
into segments (see os0file.c for more info). The thread specifies which
649
634
segment it wants to wait for. */
665
650
/**************************************************************************
666
651
Flushes to disk writes in file spaces of the given type possibly cached by
670
655
fil_flush_file_spaces(
671
656
/*==================*/
672
657
ulint purpose); /* in: FIL_TABLESPACE, FIL_LOG */
673
658
/**********************************************************************
674
659
Checks the consistency of the tablespace cache. */
677
662
fil_validate(void);
678
663
/*==============*/
679
664
/* out: TRUE if ok */
680
665
/************************************************************************
681
666
Returns TRUE if file address is undefined. */
684
669
fil_addr_is_null(
685
670
/*=============*/
687
672
fil_addr_t addr); /* in: address */
688
673
/************************************************************************
689
674
Accessor functions for a file page */
692
fil_page_get_prev(byte* page);
694
fil_page_get_next(byte* page);
677
fil_page_get_prev(const byte* page);
679
fil_page_get_next(const byte* page);
695
680
/*************************************************************************
696
681
Sets the file page type. */
699
684
fil_page_set_type(
700
685
/*==============*/
702
687
ulint type); /* in: type */
703
688
/*************************************************************************
704
689
Gets the file page type. */
707
692
fil_page_get_type(
708
693
/*==============*/
709
/* out: type; NOTE that if the type has not been
710
written to page, the return value not defined */
711
byte* page); /* in: file page */
694
/* out: type; NOTE that if the type
695
has not been written to page, the
696
return value not defined */
697
const byte* page); /* in: file page */
714
700
typedef struct fil_space_struct fil_space_t;