1805
1805
/*******************************************************************//**
1806
Reads the flushed lsn and arch no fields from a data file at database
1806
Reads the flushed lsn, arch no, and tablespace flag fields from a data
1807
file at database startup. */
1810
fil_read_flushed_lsn_and_arch_log_no(
1811
/*=================================*/
1810
fil_read_first_page(
1811
/*================*/
1812
1812
os_file_t data_file, /*!< in: open data file */
1813
1813
ibool one_read_already, /*!< in: TRUE if min and max
1814
1814
parameters below already
1815
1815
contain sensible data */
1816
ulint* flags, /*!< out: tablespace flags */
1816
1817
#ifdef UNIV_LOG_ARCHIVE
1817
ulint* min_arch_log_no, /*!< in/out: */
1818
ulint* max_arch_log_no, /*!< in/out: */
1818
ulint* min_arch_log_no, /*!< out: min of archived
1819
log numbers in data files */
1820
ulint* max_arch_log_no, /*!< out: max of archived
1821
log numbers in data files */
1819
1822
#endif /* UNIV_LOG_ARCHIVE */
1820
ib_uint64_t* min_flushed_lsn, /*!< in/out: */
1821
ib_uint64_t* max_flushed_lsn) /*!< in/out: */
1823
ib_uint64_t* min_flushed_lsn, /*!< out: min of flushed
1824
lsn values in data files */
1825
ib_uint64_t* max_flushed_lsn) /*!< out: max of flushed
1826
lsn values in data files */
1825
1830
ib_uint64_t flushed_lsn;
1827
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
1832
buf = ut_malloc(2 * UNIV_PAGE_SIZE);
1828
1833
/* Align the memory for a possible read from a raw device */
1829
buf = ut_align(buf2, UNIV_PAGE_SIZE);
1831
os_file_read(data_file, buf, 0, 0, UNIV_PAGE_SIZE);
1833
flushed_lsn = mach_read_from_8(buf + FIL_PAGE_FILE_FLUSH_LSN);
1834
page = ut_align(buf, UNIV_PAGE_SIZE);
1836
os_file_read(data_file, page, 0, 0, UNIV_PAGE_SIZE);
1838
*flags = mach_read_from_4(page +
1839
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
1841
flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN);
1837
1845
if (!one_read_already) {
1838
1846
*min_flushed_lsn = flushed_lsn;