You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1158 lines
42 KiB

Applying InnoDB Plugin 1.0.5 snapshot, part 4 From revision r5703 to r5716 Detailed revision comments: r5703 | marko | 2009-08-27 02:25:00 -0500 (Thu, 27 Aug 2009) | 41 lines branches/zip: Replace the constant 3/8 ratio that controls the LRU_old size with the settable global variable innodb_old_blocks_pct. The minimum and maximum values are 5 and 95 per cent, respectively. The default is 100*3/8, in line with the old behavior. ut_time_ms(): New utility function, to return the current time in milliseconds. TODO: Is there a more efficient timestamp function, such as rdtsc divided by a power of two? buf_LRU_old_threshold_ms: New variable, corresponding to innodb_old_blocks_time. The value 0 is the default behaviour: no timeout before making blocks 'new'. bpage->accessed, bpage->LRU_position, buf_pool->ulint_clock: Remove. bpage->access_time: New field, replacing bpage->accessed. Protected by buf_pool_mutex instead of bpage->mutex. Updated when a page is created or accessed the first time in the buffer pool. buf_LRU_old_ratio, innobase_old_blocks_pct: New variables, corresponding to innodb_old_blocks_pct buf_LRU_old_ratio_update(), innobase_old_blocks_pct_update(): Update functions for buf_LRU_old_ratio, innobase_old_blocks_pct. buf_page_peek_if_too_old(): Compare ut_time_ms() to bpage->access_time if buf_LRU_old_threshold_ms && bpage->old. Else observe buf_LRU_old_ratio and bpage->freed_page_clock. buf_pool_t: Add n_pages_made_young, n_pages_not_made_young, n_pages_made_young_old, n_pages_not_made_young, for statistics. buf_print(): Display buf_pool->n_pages_made_young, buf_pool->n_pages_not_made_young. This function is only for crash diagnostics. buf_print_io(): Display buf_pool->LRU_old_len and quantities derived from buf_pool->n_pages_made_young, buf_pool->n_pages_not_made_young. This function is invoked by SHOW ENGINE INNODB STATUS. rb://129 approved by Heikki Tuuri. This addresses Bug #45015. r5704 | marko | 2009-08-27 03:31:17 -0500 (Thu, 27 Aug 2009) | 32 lines branches/zip: Fix a critical bug in fast index creation that could corrupt the created indexes. row_merge(): Make "half" an in/out parameter. Determine the offset of half the output file. Copy the last blocks record-by-record instead of block-by-block, so that the records can be counted. Check that the input and output have matching n_rec. row_merge_sort(): Do not assume that two blocks of size N are merged into a block of size 2*N. The output block can be shorter than the input if the last page of each input block is almost empty. Use an accurate termination condition, based on the "half" computed by row_merge(). row_merge_read(), row_merge_write(), row_merge_blocks(): Add debug output. merge_file_t, row_merge_file_create(): Add n_rec, the number of records in the merge file. row_merge_read_clustered_index(): Update n_rec. row_merge_blocks(): Update and check n_rec. row_merge_blocks_copy(): New function, for copying the last blocks in row_merge(). Update and check n_rec. This bug was discovered with a user-supplied test case that creates an index where the initial temporary file is 249 one-megabyte blocks and the merged files become smaller. In the test, possible merge record sizes are 10, 18, and 26 bytes. rb://150 approved by Sunny Bains. This addresses Issue #320. r5705 | marko | 2009-08-27 06:56:24 -0500 (Thu, 27 Aug 2009) | 11 lines branches/zip: dict_index_find_cols(): On column name lookup failure, return DB_CORRUPTION (HA_ERR_CRASHED) instead of abnormally terminating the server. Also, disable the previously added diagnostic output to the error log, because mysql-test-run does not like extra output in the error log. (Bug #44571) dict_index_add_to_cache(): Handle errors from dict_index_find_cols(). mysql-test/innodb_bug44571.test: A test case for triggering the bug. rb://135 approved by Sunny Bains. r5706 | inaam | 2009-08-27 11:00:27 -0500 (Thu, 27 Aug 2009) | 20 lines branches/zip rb://147 Done away with following two status variables: innodb_buffer_pool_read_ahead_rnd innodb_buffer_pool_read_ahead_seq Introduced two new status variables: innodb_buffer_pool_read_ahead = number of pages read as part of readahead since server startup innodb_buffer_pool_read_ahead_evicted = number of pages that are read in as readahead but were evicted before ever being accessed since server startup i.e.: a measure of how badly our readahead is performing SHOW INNODB STATUS will show two extra numbers in buffer pool section: pages read ahead/sec and pages evicted without access/sec Approved by: Marko r5707 | inaam | 2009-08-27 11:20:35 -0500 (Thu, 27 Aug 2009) | 6 lines branches/zip Remove unused macros as we erased the random readahead code in r5703. Also fixed some comments. r5708 | inaam | 2009-08-27 17:43:32 -0500 (Thu, 27 Aug 2009) | 4 lines branches/zip Remove redundant TRUE : FALSE from the return statement r5709 | inaam | 2009-08-28 01:22:46 -0500 (Fri, 28 Aug 2009) | 5 lines branches/zip rb://152 Disable display of deprecated parameter innodb_file_io_threads in 'show variables'. r5714 | marko | 2009-08-31 01:10:10 -0500 (Mon, 31 Aug 2009) | 5 lines branches/zip: buf_chunk_not_freed(): Do not acquire block->mutex unless block->page.state == BUF_BLOCK_FILE_PAGE. Check that block->page.state makes sense. Approved by Sunny Bains over the IM. r5716 | vasil | 2009-08-31 02:47:49 -0500 (Mon, 31 Aug 2009) | 9 lines branches/zip: Fix Bug#46718 InnoDB plugin incompatible with gcc 4.1 (at least: on PPC): "Undefined symbol" by implementing our own check in plug.in instead of using the result from the check from MySQL because it is insufficient. Approved by: Marko (rb://154)
16 years ago
  1. /*****************************************************************************
  2. Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free Software
  5. Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along with
  10. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  11. Place, Suite 330, Boston, MA 02111-1307 USA
  12. *****************************************************************************/
  13. /**************************************************//**
  14. @file include/dict0dict.h
  15. Data dictionary system
  16. Created 1/8/1996 Heikki Tuuri
  17. *******************************************************/
  18. #ifndef dict0dict_h
  19. #define dict0dict_h
  20. #include "univ.i"
  21. #include "dict0types.h"
  22. #include "dict0mem.h"
  23. #include "data0type.h"
  24. #include "data0data.h"
  25. #include "mem0mem.h"
  26. #include "rem0types.h"
  27. #include "ut0mem.h"
  28. #include "ut0lst.h"
  29. #include "hash0hash.h"
  30. #include "ut0rnd.h"
  31. #include "ut0byte.h"
  32. #include "trx0types.h"
  33. #ifndef UNIV_HOTBACKUP
  34. # include "sync0sync.h"
  35. # include "sync0rw.h"
  36. /******************************************************************//**
  37. Makes all characters in a NUL-terminated UTF-8 string lower case. */
  38. UNIV_INTERN
  39. void
  40. dict_casedn_str(
  41. /*============*/
  42. char* a); /*!< in/out: string to put in lower case */
  43. /********************************************************************//**
  44. Get the database name length in a table name.
  45. @return database name length */
  46. UNIV_INTERN
  47. ulint
  48. dict_get_db_name_len(
  49. /*=================*/
  50. const char* name); /*!< in: table name in the form
  51. dbname '/' tablename */
  52. /********************************************************************//**
  53. Return the end of table name where we have removed dbname and '/'.
  54. @return table name */
  55. const char*
  56. dict_remove_db_name(
  57. /*================*/
  58. const char* name); /*!< in: table name in the form
  59. dbname '/' tablename */
  60. /**********************************************************************//**
  61. Returns a table object based on table id.
  62. @return table, NULL if does not exist */
  63. UNIV_INTERN
  64. dict_table_t*
  65. dict_table_get_on_id(
  66. /*=================*/
  67. dulint table_id, /*!< in: table id */
  68. trx_t* trx); /*!< in: transaction handle */
  69. /********************************************************************//**
  70. Decrements the count of open MySQL handles to a table. */
  71. UNIV_INTERN
  72. void
  73. dict_table_decrement_handle_count(
  74. /*==============================*/
  75. dict_table_t* table, /*!< in/out: table */
  76. ibool dict_locked); /*!< in: TRUE=data dictionary locked */
  77. /**********************************************************************//**
  78. Inits the data dictionary module. */
  79. UNIV_INTERN
  80. void
  81. dict_init(void);
  82. /*===========*/
  83. /********************************************************************//**
  84. Gets the space id of every table of the data dictionary and makes a linear
  85. list and a hash table of them to the data dictionary cache. This function
  86. can be called at database startup if we did not need to do a crash recovery.
  87. In crash recovery we must scan the space id's from the .ibd files in MySQL
  88. database directories. */
  89. UNIV_INTERN
  90. void
  91. dict_load_space_id_list(void);
  92. /*=========================*/
  93. /*********************************************************************//**
  94. Gets the column data type. */
  95. UNIV_INLINE
  96. void
  97. dict_col_copy_type(
  98. /*===============*/
  99. const dict_col_t* col, /*!< in: column */
  100. dtype_t* type); /*!< out: data type */
  101. #endif /* !UNIV_HOTBACKUP */
  102. #ifdef UNIV_DEBUG
  103. /*********************************************************************//**
  104. Assert that a column and a data type match.
  105. @return TRUE */
  106. UNIV_INLINE
  107. ibool
  108. dict_col_type_assert_equal(
  109. /*=======================*/
  110. const dict_col_t* col, /*!< in: column */
  111. const dtype_t* type); /*!< in: data type */
  112. #endif /* UNIV_DEBUG */
  113. #ifndef UNIV_HOTBACKUP
  114. /***********************************************************************//**
  115. Returns the minimum size of the column.
  116. @return minimum size */
  117. UNIV_INLINE
  118. ulint
  119. dict_col_get_min_size(
  120. /*==================*/
  121. const dict_col_t* col); /*!< in: column */
  122. /***********************************************************************//**
  123. Returns the maximum size of the column.
  124. @return maximum size */
  125. UNIV_INLINE
  126. ulint
  127. dict_col_get_max_size(
  128. /*==================*/
  129. const dict_col_t* col); /*!< in: column */
  130. /***********************************************************************//**
  131. Returns the size of a fixed size column, 0 if not a fixed size column.
  132. @return fixed size, or 0 */
  133. UNIV_INLINE
  134. ulint
  135. dict_col_get_fixed_size(
  136. /*====================*/
  137. const dict_col_t* col, /*!< in: column */
  138. ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */
  139. /***********************************************************************//**
  140. Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
  141. For fixed length types it is the fixed length of the type, otherwise 0.
  142. @return SQL null storage size in ROW_FORMAT=REDUNDANT */
  143. UNIV_INLINE
  144. ulint
  145. dict_col_get_sql_null_size(
  146. /*=======================*/
  147. const dict_col_t* col, /*!< in: column */
  148. ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */
  149. /*********************************************************************//**
  150. Gets the column number.
  151. @return col->ind, table column position (starting from 0) */
  152. UNIV_INLINE
  153. ulint
  154. dict_col_get_no(
  155. /*============*/
  156. const dict_col_t* col); /*!< in: column */
  157. /*********************************************************************//**
  158. Gets the column position in the clustered index. */
  159. UNIV_INLINE
  160. ulint
  161. dict_col_get_clust_pos(
  162. /*===================*/
  163. const dict_col_t* col, /*!< in: table column */
  164. const dict_index_t* clust_index); /*!< in: clustered index */
  165. /****************************************************************//**
  166. If the given column name is reserved for InnoDB system columns, return
  167. TRUE.
  168. @return TRUE if name is reserved */
  169. UNIV_INTERN
  170. ibool
  171. dict_col_name_is_reserved(
  172. /*======================*/
  173. const char* name); /*!< in: column name */
  174. /********************************************************************//**
  175. Acquire the autoinc lock. */
  176. UNIV_INTERN
  177. void
  178. dict_table_autoinc_lock(
  179. /*====================*/
  180. dict_table_t* table); /*!< in/out: table */
  181. /********************************************************************//**
  182. Unconditionally set the autoinc counter. */
  183. UNIV_INTERN
  184. void
  185. dict_table_autoinc_initialize(
  186. /*==========================*/
  187. dict_table_t* table, /*!< in/out: table */
  188. ib_uint64_t value); /*!< in: next value to assign to a row */
  189. /********************************************************************//**
  190. Reads the next autoinc value (== autoinc counter value), 0 if not yet
  191. initialized.
  192. @return value for a new row, or 0 */
  193. UNIV_INTERN
  194. ib_uint64_t
  195. dict_table_autoinc_read(
  196. /*====================*/
  197. const dict_table_t* table); /*!< in: table */
  198. /********************************************************************//**
  199. Updates the autoinc counter if the value supplied is greater than the
  200. current value. */
  201. UNIV_INTERN
  202. void
  203. dict_table_autoinc_update_if_greater(
  204. /*=================================*/
  205. dict_table_t* table, /*!< in/out: table */
  206. ib_uint64_t value); /*!< in: value which was assigned to a row */
  207. /********************************************************************//**
  208. Release the autoinc lock. */
  209. UNIV_INTERN
  210. void
  211. dict_table_autoinc_unlock(
  212. /*======================*/
  213. dict_table_t* table); /*!< in/out: table */
  214. #endif /* !UNIV_HOTBACKUP */
  215. /**********************************************************************//**
  216. Adds system columns to a table object. */
  217. UNIV_INTERN
  218. void
  219. dict_table_add_system_columns(
  220. /*==========================*/
  221. dict_table_t* table, /*!< in/out: table */
  222. mem_heap_t* heap); /*!< in: temporary heap */
  223. #ifndef UNIV_HOTBACKUP
  224. /**********************************************************************//**
  225. Adds a table object to the dictionary cache. */
  226. UNIV_INTERN
  227. void
  228. dict_table_add_to_cache(
  229. /*====================*/
  230. dict_table_t* table, /*!< in: table */
  231. mem_heap_t* heap); /*!< in: temporary heap */
  232. /**********************************************************************//**
  233. Removes a table object from the dictionary cache. */
  234. UNIV_INTERN
  235. void
  236. dict_table_remove_from_cache(
  237. /*=========================*/
  238. dict_table_t* table); /*!< in, own: table */
  239. /**********************************************************************//**
  240. Renames a table object.
  241. @return TRUE if success */
  242. UNIV_INTERN
  243. ibool
  244. dict_table_rename_in_cache(
  245. /*=======================*/
  246. dict_table_t* table, /*!< in/out: table */
  247. const char* new_name, /*!< in: new name */
  248. ibool rename_also_foreigns);/*!< in: in ALTER TABLE we want
  249. to preserve the original table name
  250. in constraints which reference it */
  251. /**********************************************************************//**
  252. Removes an index from the dictionary cache. */
  253. UNIV_INTERN
  254. void
  255. dict_index_remove_from_cache(
  256. /*=========================*/
  257. dict_table_t* table, /*!< in/out: table */
  258. dict_index_t* index); /*!< in, own: index */
  259. /**********************************************************************//**
  260. Change the id of a table object in the dictionary cache. This is used in
  261. DISCARD TABLESPACE. */
  262. UNIV_INTERN
  263. void
  264. dict_table_change_id_in_cache(
  265. /*==========================*/
  266. dict_table_t* table, /*!< in/out: table object already in cache */
  267. dulint new_id);/*!< in: new id to set */
  268. /**********************************************************************//**
  269. Adds a foreign key constraint object to the dictionary cache. May free
  270. the object if there already is an object with the same identifier in.
  271. At least one of foreign table or referenced table must already be in
  272. the dictionary cache!
  273. @return DB_SUCCESS or error code */
  274. UNIV_INTERN
  275. ulint
  276. dict_foreign_add_to_cache(
  277. /*======================*/
  278. dict_foreign_t* foreign, /*!< in, own: foreign key constraint */
  279. ibool check_charsets);/*!< in: TRUE=check charset
  280. compatibility */
  281. /*********************************************************************//**
  282. Check if the index is referenced by a foreign key, if TRUE return the
  283. matching instance NULL otherwise.
  284. @return pointer to foreign key struct if index is defined for foreign
  285. key, otherwise NULL */
  286. UNIV_INTERN
  287. dict_foreign_t*
  288. dict_table_get_referenced_constraint(
  289. /*=================================*/
  290. dict_table_t* table, /*!< in: InnoDB table */
  291. dict_index_t* index); /*!< in: InnoDB index */
  292. /*********************************************************************//**
  293. Checks if a table is referenced by foreign keys.
  294. @return TRUE if table is referenced by a foreign key */
  295. UNIV_INTERN
  296. ibool
  297. dict_table_is_referenced_by_foreign_key(
  298. /*====================================*/
  299. const dict_table_t* table); /*!< in: InnoDB table */
  300. /**********************************************************************//**
  301. Replace the index in the foreign key list that matches this index's
  302. definition with an equivalent index. */
  303. UNIV_INTERN
  304. void
  305. dict_table_replace_index_in_foreign_list(
  306. /*=====================================*/
  307. dict_table_t* table, /*!< in/out: table */
  308. dict_index_t* index); /*!< in: index to be replaced */
  309. /*********************************************************************//**
  310. Checks if a index is defined for a foreign key constraint. Index is a part
  311. of a foreign key constraint if the index is referenced by foreign key
  312. or index is a foreign key index
  313. @return pointer to foreign key struct if index is defined for foreign
  314. key, otherwise NULL */
  315. UNIV_INTERN
  316. dict_foreign_t*
  317. dict_table_get_foreign_constraint(
  318. /*==============================*/
  319. dict_table_t* table, /*!< in: InnoDB table */
  320. dict_index_t* index); /*!< in: InnoDB index */
  321. /*********************************************************************//**
  322. Scans a table create SQL string and adds to the data dictionary
  323. the foreign key constraints declared in the string. This function
  324. should be called after the indexes for a table have been created.
  325. Each foreign key constraint must be accompanied with indexes in
  326. bot participating tables. The indexes are allowed to contain more
  327. fields than mentioned in the constraint.
  328. @return error code or DB_SUCCESS */
  329. UNIV_INTERN
  330. ulint
  331. dict_create_foreign_constraints(
  332. /*============================*/
  333. trx_t* trx, /*!< in: transaction */
  334. const char* sql_string, /*!< in: table create statement where
  335. foreign keys are declared like:
  336. FOREIGN KEY (a, b) REFERENCES
  337. table2(c, d), table2 can be written
  338. also with the database
  339. name before it: test.table2; the
  340. default database id the database of
  341. parameter name */
  342. const char* name, /*!< in: table full name in the
  343. normalized form
  344. database_name/table_name */
  345. ibool reject_fks); /*!< in: if TRUE, fail with error
  346. code DB_CANNOT_ADD_CONSTRAINT if
  347. any foreign keys are found. */
  348. /**********************************************************************//**
  349. Parses the CONSTRAINT id's to be dropped in an ALTER TABLE statement.
  350. @return DB_SUCCESS or DB_CANNOT_DROP_CONSTRAINT if syntax error or the
  351. constraint id does not match */
  352. UNIV_INTERN
  353. ulint
  354. dict_foreign_parse_drop_constraints(
  355. /*================================*/
  356. mem_heap_t* heap, /*!< in: heap from which we can
  357. allocate memory */
  358. trx_t* trx, /*!< in: transaction */
  359. dict_table_t* table, /*!< in: table */
  360. ulint* n, /*!< out: number of constraints
  361. to drop */
  362. const char*** constraints_to_drop); /*!< out: id's of the
  363. constraints to drop */
  364. /**********************************************************************//**
  365. Returns a table object and optionally increment its MySQL open handle count.
  366. NOTE! This is a high-level function to be used mainly from outside the
  367. 'dict' directory. Inside this directory dict_table_get_low is usually the
  368. appropriate function.
  369. @return table, NULL if does not exist */
  370. UNIV_INTERN
  371. dict_table_t*
  372. dict_table_get(
  373. /*===========*/
  374. const char* table_name, /*!< in: table name */
  375. ibool inc_mysql_count);
  376. /*!< in: whether to increment the open
  377. handle count on the table */
  378. /**********************************************************************//**
  379. Returns a index object, based on table and index id, and memoryfixes it.
  380. @return index, NULL if does not exist */
  381. UNIV_INTERN
  382. dict_index_t*
  383. dict_index_get_on_id_low(
  384. /*=====================*/
  385. dict_table_t* table, /*!< in: table */
  386. dulint index_id); /*!< in: index id */
  387. /**********************************************************************//**
  388. Checks if a table is in the dictionary cache.
  389. @return table, NULL if not found */
  390. UNIV_INLINE
  391. dict_table_t*
  392. dict_table_check_if_in_cache_low(
  393. /*=============================*/
  394. const char* table_name); /*!< in: table name */
  395. /**********************************************************************//**
  396. Gets a table; loads it to the dictionary cache if necessary. A low-level
  397. function.
  398. @return table, NULL if not found */
  399. UNIV_INLINE
  400. dict_table_t*
  401. dict_table_get_low(
  402. /*===============*/
  403. const char* table_name); /*!< in: table name */
  404. /**********************************************************************//**
  405. Returns a table object based on table id.
  406. @return table, NULL if does not exist */
  407. UNIV_INLINE
  408. dict_table_t*
  409. dict_table_get_on_id_low(
  410. /*=====================*/
  411. dulint table_id); /*!< in: table id */
  412. /**********************************************************************//**
  413. Find an index that is equivalent to the one passed in and is not marked
  414. for deletion.
  415. @return index equivalent to foreign->foreign_index, or NULL */
  416. UNIV_INTERN
  417. dict_index_t*
  418. dict_foreign_find_equiv_index(
  419. /*==========================*/
  420. dict_foreign_t* foreign);/*!< in: foreign key */
  421. /**********************************************************************//**
  422. Returns an index object by matching on the name and column names and
  423. if more than one index matches return the index with the max id
  424. @return matching index, NULL if not found */
  425. UNIV_INTERN
  426. dict_index_t*
  427. dict_table_get_index_by_max_id(
  428. /*===========================*/
  429. dict_table_t* table, /*!< in: table */
  430. const char* name, /*!< in: the index name to find */
  431. const char** columns,/*!< in: array of column names */
  432. ulint n_cols);/*!< in: number of columns */
  433. /**********************************************************************//**
  434. Returns a column's name.
  435. @return column name. NOTE: not guaranteed to stay valid if table is
  436. modified in any way (columns added, etc.). */
  437. UNIV_INTERN
  438. const char*
  439. dict_table_get_col_name(
  440. /*====================*/
  441. const dict_table_t* table, /*!< in: table */
  442. ulint col_nr);/*!< in: column number */
  443. /**********************************************************************//**
  444. Prints a table definition. */
  445. UNIV_INTERN
  446. void
  447. dict_table_print(
  448. /*=============*/
  449. dict_table_t* table); /*!< in: table */
  450. /**********************************************************************//**
  451. Prints a table data. */
  452. UNIV_INTERN
  453. void
  454. dict_table_print_low(
  455. /*=================*/
  456. dict_table_t* table); /*!< in: table */
  457. /**********************************************************************//**
  458. Prints a table data when we know the table name. */
  459. UNIV_INTERN
  460. void
  461. dict_table_print_by_name(
  462. /*=====================*/
  463. const char* name); /*!< in: table name */
  464. /**********************************************************************//**
  465. Outputs info on foreign keys of a table. */
  466. UNIV_INTERN
  467. void
  468. dict_print_info_on_foreign_keys(
  469. /*============================*/
  470. ibool create_table_format, /*!< in: if TRUE then print in
  471. a format suitable to be inserted into
  472. a CREATE TABLE, otherwise in the format
  473. of SHOW TABLE STATUS */
  474. FILE* file, /*!< in: file where to print */
  475. trx_t* trx, /*!< in: transaction */
  476. dict_table_t* table); /*!< in: table */
  477. /**********************************************************************//**
  478. Outputs info on a foreign key of a table in a format suitable for
  479. CREATE TABLE. */
  480. UNIV_INTERN
  481. void
  482. dict_print_info_on_foreign_key_in_create_format(
  483. /*============================================*/
  484. FILE* file, /*!< in: file where to print */
  485. trx_t* trx, /*!< in: transaction */
  486. dict_foreign_t* foreign, /*!< in: foreign key constraint */
  487. ibool add_newline); /*!< in: whether to add a newline */
  488. /********************************************************************//**
  489. Displays the names of the index and the table. */
  490. UNIV_INTERN
  491. void
  492. dict_index_name_print(
  493. /*==================*/
  494. FILE* file, /*!< in: output stream */
  495. trx_t* trx, /*!< in: transaction */
  496. const dict_index_t* index); /*!< in: index to print */
  497. #ifdef UNIV_DEBUG
  498. /********************************************************************//**
  499. Gets the first index on the table (the clustered index).
  500. @return index, NULL if none exists */
  501. UNIV_INLINE
  502. dict_index_t*
  503. dict_table_get_first_index(
  504. /*=======================*/
  505. const dict_table_t* table); /*!< in: table */
  506. /********************************************************************//**
  507. Gets the next index on the table.
  508. @return index, NULL if none left */
  509. UNIV_INLINE
  510. dict_index_t*
  511. dict_table_get_next_index(
  512. /*======================*/
  513. const dict_index_t* index); /*!< in: index */
  514. #else /* UNIV_DEBUG */
  515. # define dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes)
  516. # define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index)
  517. #endif /* UNIV_DEBUG */
  518. #endif /* !UNIV_HOTBACKUP */
  519. /********************************************************************//**
  520. Check whether the index is the clustered index.
  521. @return nonzero for clustered index, zero for other indexes */
  522. UNIV_INLINE
  523. ulint
  524. dict_index_is_clust(
  525. /*================*/
  526. const dict_index_t* index) /*!< in: index */
  527. __attribute__((pure));
  528. /********************************************************************//**
  529. Check whether the index is unique.
  530. @return nonzero for unique index, zero for other indexes */
  531. UNIV_INLINE
  532. ulint
  533. dict_index_is_unique(
  534. /*=================*/
  535. const dict_index_t* index) /*!< in: index */
  536. __attribute__((pure));
  537. /********************************************************************//**
  538. Check whether the index is the insert buffer tree.
  539. @return nonzero for insert buffer, zero for other indexes */
  540. UNIV_INLINE
  541. ulint
  542. dict_index_is_ibuf(
  543. /*===============*/
  544. const dict_index_t* index) /*!< in: index */
  545. __attribute__((pure));
  546. /********************************************************************//**
  547. Check whether the index is a secondary index or the insert buffer tree.
  548. @return nonzero for insert buffer, zero for other indexes */
  549. UNIV_INLINE
  550. ulint
  551. dict_index_is_sec_or_ibuf(
  552. /*======================*/
  553. const dict_index_t* index) /*!< in: index */
  554. __attribute__((pure));
  555. /********************************************************************//**
  556. Gets the number of user-defined columns in a table in the dictionary
  557. cache.
  558. @return number of user-defined (e.g., not ROW_ID) columns of a table */
  559. UNIV_INLINE
  560. ulint
  561. dict_table_get_n_user_cols(
  562. /*=======================*/
  563. const dict_table_t* table); /*!< in: table */
  564. /********************************************************************//**
  565. Gets the number of system columns in a table in the dictionary cache.
  566. @return number of system (e.g., ROW_ID) columns of a table */
  567. UNIV_INLINE
  568. ulint
  569. dict_table_get_n_sys_cols(
  570. /*======================*/
  571. const dict_table_t* table); /*!< in: table */
  572. /********************************************************************//**
  573. Gets the number of all columns (also system) in a table in the dictionary
  574. cache.
  575. @return number of columns of a table */
  576. UNIV_INLINE
  577. ulint
  578. dict_table_get_n_cols(
  579. /*==================*/
  580. const dict_table_t* table); /*!< in: table */
  581. #ifdef UNIV_DEBUG
  582. /********************************************************************//**
  583. Gets the nth column of a table.
  584. @return pointer to column object */
  585. UNIV_INLINE
  586. dict_col_t*
  587. dict_table_get_nth_col(
  588. /*===================*/
  589. const dict_table_t* table, /*!< in: table */
  590. ulint pos); /*!< in: position of column */
  591. /********************************************************************//**
  592. Gets the given system column of a table.
  593. @return pointer to column object */
  594. UNIV_INLINE
  595. dict_col_t*
  596. dict_table_get_sys_col(
  597. /*===================*/
  598. const dict_table_t* table, /*!< in: table */
  599. ulint sys); /*!< in: DATA_ROW_ID, ... */
  600. #else /* UNIV_DEBUG */
  601. #define dict_table_get_nth_col(table, pos) \
  602. ((table)->cols + (pos))
  603. #define dict_table_get_sys_col(table, sys) \
  604. ((table)->cols + (table)->n_cols + (sys) - DATA_N_SYS_COLS)
  605. #endif /* UNIV_DEBUG */
  606. /********************************************************************//**
  607. Gets the given system column number of a table.
  608. @return column number */
  609. UNIV_INLINE
  610. ulint
  611. dict_table_get_sys_col_no(
  612. /*======================*/
  613. const dict_table_t* table, /*!< in: table */
  614. ulint sys); /*!< in: DATA_ROW_ID, ... */
  615. #ifndef UNIV_HOTBACKUP
  616. /********************************************************************//**
  617. Returns the minimum data size of an index record.
  618. @return minimum data size in bytes */
  619. UNIV_INLINE
  620. ulint
  621. dict_index_get_min_size(
  622. /*====================*/
  623. const dict_index_t* index); /*!< in: index */
  624. #endif /* !UNIV_HOTBACKUP */
  625. /********************************************************************//**
  626. Check whether the table uses the compact page format.
  627. @return TRUE if table uses the compact page format */
  628. UNIV_INLINE
  629. ibool
  630. dict_table_is_comp(
  631. /*===============*/
  632. const dict_table_t* table); /*!< in: table */
  633. /********************************************************************//**
  634. Determine the file format of a table.
  635. @return file format version */
  636. UNIV_INLINE
  637. ulint
  638. dict_table_get_format(
  639. /*==================*/
  640. const dict_table_t* table); /*!< in: table */
  641. /********************************************************************//**
  642. Set the file format of a table. */
  643. UNIV_INLINE
  644. void
  645. dict_table_set_format(
  646. /*==================*/
  647. dict_table_t* table, /*!< in/out: table */
  648. ulint format);/*!< in: file format version */
  649. /********************************************************************//**
  650. Extract the compressed page size from table flags.
  651. @return compressed page size, or 0 if not compressed */
  652. UNIV_INLINE
  653. ulint
  654. dict_table_flags_to_zip_size(
  655. /*=========================*/
  656. ulint flags) /*!< in: flags */
  657. __attribute__((const));
  658. /********************************************************************//**
  659. Check whether the table uses the compressed compact page format.
  660. @return compressed page size, or 0 if not compressed */
  661. UNIV_INLINE
  662. ulint
  663. dict_table_zip_size(
  664. /*================*/
  665. const dict_table_t* table); /*!< in: table */
  666. /********************************************************************//**
  667. Checks if a column is in the ordering columns of the clustered index of a
  668. table. Column prefixes are treated like whole columns.
  669. @return TRUE if the column, or its prefix, is in the clustered key */
  670. UNIV_INTERN
  671. ibool
  672. dict_table_col_in_clustered_key(
  673. /*============================*/
  674. const dict_table_t* table, /*!< in: table */
  675. ulint n); /*!< in: column number */
  676. #ifndef UNIV_HOTBACKUP
  677. /*******************************************************************//**
  678. Copies types of columns contained in table to tuple and sets all
  679. fields of the tuple to the SQL NULL value. This function should
  680. be called right after dtuple_create(). */
  681. UNIV_INTERN
  682. void
  683. dict_table_copy_types(
  684. /*==================*/
  685. dtuple_t* tuple, /*!< in/out: data tuple */
  686. const dict_table_t* table); /*!< in: table */
  687. /**********************************************************************//**
  688. Looks for an index with the given id. NOTE that we do not reserve
  689. the dictionary mutex: this function is for emergency purposes like
  690. printing info of a corrupt database page!
  691. @return index or NULL if not found from cache */
  692. UNIV_INTERN
  693. dict_index_t*
  694. dict_index_find_on_id_low(
  695. /*======================*/
  696. dulint id); /*!< in: index id */
  697. /**********************************************************************//**
  698. Adds an index to the dictionary cache.
  699. @return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
  700. UNIV_INTERN
  701. ulint
  702. dict_index_add_to_cache(
  703. /*====================*/
  704. dict_table_t* table, /*!< in: table on which the index is */
  705. dict_index_t* index, /*!< in, own: index; NOTE! The index memory
  706. object is freed in this function! */
  707. ulint page_no,/*!< in: root page number of the index */
  708. ibool strict);/*!< in: TRUE=refuse to create the index
  709. if records could be too big to fit in
  710. an B-tree page */
  711. /**********************************************************************//**
  712. Removes an index from the dictionary cache. */
  713. UNIV_INTERN
  714. void
  715. dict_index_remove_from_cache(
  716. /*=========================*/
  717. dict_table_t* table, /*!< in/out: table */
  718. dict_index_t* index); /*!< in, own: index */
  719. #endif /* !UNIV_HOTBACKUP */
  720. /********************************************************************//**
  721. Gets the number of fields in the internal representation of an index,
  722. including fields added by the dictionary system.
  723. @return number of fields */
  724. UNIV_INLINE
  725. ulint
  726. dict_index_get_n_fields(
  727. /*====================*/
  728. const dict_index_t* index); /*!< in: an internal
  729. representation of index (in
  730. the dictionary cache) */
  731. /********************************************************************//**
  732. Gets the number of fields in the internal representation of an index
  733. that uniquely determine the position of an index entry in the index, if
  734. we do not take multiversioning into account: in the B-tree use the value
  735. returned by dict_index_get_n_unique_in_tree.
  736. @return number of fields */
  737. UNIV_INLINE
  738. ulint
  739. dict_index_get_n_unique(
  740. /*====================*/
  741. const dict_index_t* index); /*!< in: an internal representation
  742. of index (in the dictionary cache) */
  743. /********************************************************************//**
  744. Gets the number of fields in the internal representation of an index
  745. which uniquely determine the position of an index entry in the index, if
  746. we also take multiversioning into account.
  747. @return number of fields */
  748. UNIV_INLINE
  749. ulint
  750. dict_index_get_n_unique_in_tree(
  751. /*============================*/
  752. const dict_index_t* index); /*!< in: an internal representation
  753. of index (in the dictionary cache) */
  754. /********************************************************************//**
  755. Gets the number of user-defined ordering fields in the index. In the internal
  756. representation we add the row id to the ordering fields to make all indexes
  757. unique, but this function returns the number of fields the user defined
  758. in the index as ordering fields.
  759. @return number of fields */
  760. UNIV_INLINE
  761. ulint
  762. dict_index_get_n_ordering_defined_by_user(
  763. /*======================================*/
  764. const dict_index_t* index); /*!< in: an internal representation
  765. of index (in the dictionary cache) */
  766. #ifdef UNIV_DEBUG
  767. /********************************************************************//**
  768. Gets the nth field of an index.
  769. @return pointer to field object */
  770. UNIV_INLINE
  771. dict_field_t*
  772. dict_index_get_nth_field(
  773. /*=====================*/
  774. const dict_index_t* index, /*!< in: index */
  775. ulint pos); /*!< in: position of field */
  776. #else /* UNIV_DEBUG */
  777. # define dict_index_get_nth_field(index, pos) ((index)->fields + (pos))
  778. #endif /* UNIV_DEBUG */
  779. /********************************************************************//**
  780. Gets pointer to the nth column in an index.
  781. @return column */
  782. UNIV_INLINE
  783. const dict_col_t*
  784. dict_index_get_nth_col(
  785. /*===================*/
  786. const dict_index_t* index, /*!< in: index */
  787. ulint pos); /*!< in: position of the field */
  788. /********************************************************************//**
  789. Gets the column number of the nth field in an index.
  790. @return column number */
  791. UNIV_INLINE
  792. ulint
  793. dict_index_get_nth_col_no(
  794. /*======================*/
  795. const dict_index_t* index, /*!< in: index */
  796. ulint pos); /*!< in: position of the field */
  797. /********************************************************************//**
  798. Looks for column n in an index.
  799. @return position in internal representation of the index;
  800. ULINT_UNDEFINED if not contained */
  801. UNIV_INTERN
  802. ulint
  803. dict_index_get_nth_col_pos(
  804. /*=======================*/
  805. const dict_index_t* index, /*!< in: index */
  806. ulint n); /*!< in: column number */
  807. /********************************************************************//**
  808. Returns TRUE if the index contains a column or a prefix of that column.
  809. @return TRUE if contains the column or its prefix */
  810. UNIV_INTERN
  811. ibool
  812. dict_index_contains_col_or_prefix(
  813. /*==============================*/
  814. const dict_index_t* index, /*!< in: index */
  815. ulint n); /*!< in: column number */
  816. /********************************************************************//**
  817. Looks for a matching field in an index. The column has to be the same. The
  818. column in index must be complete, or must contain a prefix longer than the
  819. column in index2. That is, we must be able to construct the prefix in index2
  820. from the prefix in index.
  821. @return position in internal representation of the index;
  822. ULINT_UNDEFINED if not contained */
  823. UNIV_INTERN
  824. ulint
  825. dict_index_get_nth_field_pos(
  826. /*=========================*/
  827. const dict_index_t* index, /*!< in: index from which to search */
  828. const dict_index_t* index2, /*!< in: index */
  829. ulint n); /*!< in: field number in index2 */
  830. /********************************************************************//**
  831. Looks for column n position in the clustered index.
  832. @return position in internal representation of the clustered index */
  833. UNIV_INTERN
  834. ulint
  835. dict_table_get_nth_col_pos(
  836. /*=======================*/
  837. const dict_table_t* table, /*!< in: table */
  838. ulint n); /*!< in: column number */
  839. /********************************************************************//**
  840. Returns the position of a system column in an index.
  841. @return position, ULINT_UNDEFINED if not contained */
  842. UNIV_INLINE
  843. ulint
  844. dict_index_get_sys_col_pos(
  845. /*=======================*/
  846. const dict_index_t* index, /*!< in: index */
  847. ulint type); /*!< in: DATA_ROW_ID, ... */
  848. /*******************************************************************//**
  849. Adds a column to index. */
  850. UNIV_INTERN
  851. void
  852. dict_index_add_col(
  853. /*===============*/
  854. dict_index_t* index, /*!< in/out: index */
  855. const dict_table_t* table, /*!< in: table */
  856. dict_col_t* col, /*!< in: column */
  857. ulint prefix_len); /*!< in: column prefix length */
  858. #ifndef UNIV_HOTBACKUP
  859. /*******************************************************************//**
  860. Copies types of fields contained in index to tuple. */
  861. UNIV_INTERN
  862. void
  863. dict_index_copy_types(
  864. /*==================*/
  865. dtuple_t* tuple, /*!< in/out: data tuple */
  866. const dict_index_t* index, /*!< in: index */
  867. ulint n_fields); /*!< in: number of
  868. field types to copy */
  869. #endif /* !UNIV_HOTBACKUP */
  870. /*********************************************************************//**
  871. Gets the field column.
  872. @return field->col, pointer to the table column */
  873. UNIV_INLINE
  874. const dict_col_t*
  875. dict_field_get_col(
  876. /*===============*/
  877. const dict_field_t* field); /*!< in: index field */
  878. #ifndef UNIV_HOTBACKUP
  879. /**********************************************************************//**
  880. Returns an index object if it is found in the dictionary cache.
  881. Assumes that dict_sys->mutex is already being held.
  882. @return index, NULL if not found */
  883. UNIV_INTERN
  884. dict_index_t*
  885. dict_index_get_if_in_cache_low(
  886. /*===========================*/
  887. dulint index_id); /*!< in: index id */
  888. #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
  889. /**********************************************************************//**
  890. Returns an index object if it is found in the dictionary cache.
  891. @return index, NULL if not found */
  892. UNIV_INTERN
  893. dict_index_t*
  894. dict_index_get_if_in_cache(
  895. /*=======================*/
  896. dulint index_id); /*!< in: index id */
  897. #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
  898. #ifdef UNIV_DEBUG
  899. /**********************************************************************//**
  900. Checks that a tuple has n_fields_cmp value in a sensible range, so that
  901. no comparison can occur with the page number field in a node pointer.
  902. @return TRUE if ok */
  903. UNIV_INTERN
  904. ibool
  905. dict_index_check_search_tuple(
  906. /*==========================*/
  907. const dict_index_t* index, /*!< in: index tree */
  908. const dtuple_t* tuple); /*!< in: tuple used in a search */
  909. /**********************************************************************//**
  910. Check for duplicate index entries in a table [using the index name] */
  911. UNIV_INTERN
  912. void
  913. dict_table_check_for_dup_indexes(
  914. /*=============================*/
  915. const dict_table_t* table); /*!< in: Check for dup indexes
  916. in this table */
  917. #endif /* UNIV_DEBUG */
  918. /**********************************************************************//**
  919. Builds a node pointer out of a physical record and a page number.
  920. @return own: node pointer */
  921. UNIV_INTERN
  922. dtuple_t*
  923. dict_index_build_node_ptr(
  924. /*======================*/
  925. const dict_index_t* index, /*!< in: index */
  926. const rec_t* rec, /*!< in: record for which to build node
  927. pointer */
  928. ulint page_no,/*!< in: page number to put in node
  929. pointer */
  930. mem_heap_t* heap, /*!< in: memory heap where pointer
  931. created */
  932. ulint level); /*!< in: level of rec in tree:
  933. 0 means leaf level */
  934. /**********************************************************************//**
  935. Copies an initial segment of a physical record, long enough to specify an
  936. index entry uniquely.
  937. @return pointer to the prefix record */
  938. UNIV_INTERN
  939. rec_t*
  940. dict_index_copy_rec_order_prefix(
  941. /*=============================*/
  942. const dict_index_t* index, /*!< in: index */
  943. const rec_t* rec, /*!< in: record for which to
  944. copy prefix */
  945. ulint* n_fields,/*!< out: number of fields copied */
  946. byte** buf, /*!< in/out: memory buffer for the
  947. copied prefix, or NULL */
  948. ulint* buf_size);/*!< in/out: buffer size */
  949. /**********************************************************************//**
  950. Builds a typed data tuple out of a physical record.
  951. @return own: data tuple */
  952. UNIV_INTERN
  953. dtuple_t*
  954. dict_index_build_data_tuple(
  955. /*========================*/
  956. dict_index_t* index, /*!< in: index */
  957. rec_t* rec, /*!< in: record for which to build data tuple */
  958. ulint n_fields,/*!< in: number of data fields */
  959. mem_heap_t* heap); /*!< in: memory heap where tuple created */
  960. /*********************************************************************//**
  961. Gets the space id of the root of the index tree.
  962. @return space id */
  963. UNIV_INLINE
  964. ulint
  965. dict_index_get_space(
  966. /*=================*/
  967. const dict_index_t* index); /*!< in: index */
  968. /*********************************************************************//**
  969. Sets the space id of the root of the index tree. */
  970. UNIV_INLINE
  971. void
  972. dict_index_set_space(
  973. /*=================*/
  974. dict_index_t* index, /*!< in/out: index */
  975. ulint space); /*!< in: space id */
  976. /*********************************************************************//**
  977. Gets the page number of the root of the index tree.
  978. @return page number */
  979. UNIV_INLINE
  980. ulint
  981. dict_index_get_page(
  982. /*================*/
  983. const dict_index_t* tree); /*!< in: index */
  984. /*********************************************************************//**
  985. Sets the page number of the root of index tree. */
  986. UNIV_INLINE
  987. void
  988. dict_index_set_page(
  989. /*================*/
  990. dict_index_t* index, /*!< in/out: index */
  991. ulint page); /*!< in: page number */
  992. /*********************************************************************//**
  993. Gets the read-write lock of the index tree.
  994. @return read-write lock */
  995. UNIV_INLINE
  996. rw_lock_t*
  997. dict_index_get_lock(
  998. /*================*/
  999. dict_index_t* index); /*!< in: index */
  1000. /********************************************************************//**
  1001. Returns free space reserved for future updates of records. This is
  1002. relevant only in the case of many consecutive inserts, as updates
  1003. which make the records bigger might fragment the index.
  1004. @return number of free bytes on page, reserved for updates */
  1005. UNIV_INLINE
  1006. ulint
  1007. dict_index_get_space_reserve(void);
  1008. /*==============================*/
  1009. /*********************************************************************//**
  1010. Calculates the minimum record length in an index. */
  1011. UNIV_INTERN
  1012. ulint
  1013. dict_index_calc_min_rec_len(
  1014. /*========================*/
  1015. const dict_index_t* index); /*!< in: index */
  1016. /*********************************************************************//**
  1017. Calculates new estimates for table and index statistics. The statistics
  1018. are used in query optimization. */
  1019. UNIV_INTERN
  1020. void
  1021. dict_update_statistics_low(
  1022. /*=======================*/
  1023. dict_table_t* table, /*!< in/out: table */
  1024. ibool has_dict_mutex);/*!< in: TRUE if the caller has the
  1025. dictionary mutex */
  1026. /*********************************************************************//**
  1027. Calculates new estimates for table and index statistics. The statistics
  1028. are used in query optimization. */
  1029. UNIV_INTERN
  1030. void
  1031. dict_update_statistics(
  1032. /*===================*/
  1033. dict_table_t* table); /*!< in/out: table */
  1034. /********************************************************************//**
  1035. Reserves the dictionary system mutex for MySQL. */
  1036. UNIV_INTERN
  1037. void
  1038. dict_mutex_enter_for_mysql(void);
  1039. /*============================*/
  1040. /********************************************************************//**
  1041. Releases the dictionary system mutex for MySQL. */
  1042. UNIV_INTERN
  1043. void
  1044. dict_mutex_exit_for_mysql(void);
  1045. /*===========================*/
  1046. /********************************************************************//**
  1047. Checks if the database name in two table names is the same.
  1048. @return TRUE if same db name */
  1049. UNIV_INTERN
  1050. ibool
  1051. dict_tables_have_same_db(
  1052. /*=====================*/
  1053. const char* name1, /*!< in: table name in the form
  1054. dbname '/' tablename */
  1055. const char* name2); /*!< in: table name in the form
  1056. dbname '/' tablename */
  1057. /*********************************************************************//**
  1058. Removes an index from the cache */
  1059. UNIV_INTERN
  1060. void
  1061. dict_index_remove_from_cache(
  1062. /*=========================*/
  1063. dict_table_t* table, /*!< in/out: table */
  1064. dict_index_t* index); /*!< in, own: index */
  1065. /**********************************************************************//**
  1066. Get index by name
  1067. @return index, NULL if does not exist */
  1068. UNIV_INTERN
  1069. dict_index_t*
  1070. dict_table_get_index_on_name(
  1071. /*=========================*/
  1072. dict_table_t* table, /*!< in: table */
  1073. const char* name); /*!< in: name of the index to find */
  1074. /**********************************************************************//**
  1075. In case there is more than one index with the same name return the index
  1076. with the min(id).
  1077. @return index, NULL if does not exist */
  1078. UNIV_INTERN
  1079. dict_index_t*
  1080. dict_table_get_index_on_name_and_min_id(
  1081. /*====================================*/
  1082. dict_table_t* table, /*!< in: table */
  1083. const char* name); /*!< in: name of the index to find */
  1084. /* Buffers for storing detailed information about the latest foreign key
  1085. and unique key errors */
  1086. extern FILE* dict_foreign_err_file;
  1087. extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
  1088. /** the dictionary system */
  1089. extern dict_sys_t* dict_sys;
  1090. /** the data dictionary rw-latch protecting dict_sys */
  1091. extern rw_lock_t dict_operation_lock;
  1092. /* Dictionary system struct */
  1093. struct dict_sys_struct{
  1094. mutex_t mutex; /*!< mutex protecting the data
  1095. dictionary; protects also the
  1096. disk-based dictionary system tables;
  1097. this mutex serializes CREATE TABLE
  1098. and DROP TABLE, as well as reading
  1099. the dictionary data for a table from
  1100. system tables */
  1101. dulint row_id; /*!< the next row id to assign;
  1102. NOTE that at a checkpoint this
  1103. must be written to the dict system
  1104. header and flushed to a file; in
  1105. recovery this must be derived from
  1106. the log records */
  1107. hash_table_t* table_hash; /*!< hash table of the tables, based
  1108. on name */
  1109. hash_table_t* table_id_hash; /*!< hash table of the tables, based
  1110. on id */
  1111. UT_LIST_BASE_NODE_T(dict_table_t)
  1112. table_LRU; /*!< LRU list of tables */
  1113. ulint size; /*!< varying space in bytes occupied
  1114. by the data dictionary table and
  1115. index objects */
  1116. dict_table_t* sys_tables; /*!< SYS_TABLES table */
  1117. dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
  1118. dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
  1119. dict_table_t* sys_fields; /*!< SYS_FIELDS table */
  1120. };
  1121. #endif /* !UNIV_HOTBACKUP */
  1122. /** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
  1123. extern dict_index_t* dict_ind_redundant;
  1124. /** dummy index for ROW_FORMAT=COMPACT supremum and infimum records */
  1125. extern dict_index_t* dict_ind_compact;
  1126. /**********************************************************************//**
  1127. Inits dict_ind_redundant and dict_ind_compact. */
  1128. UNIV_INTERN
  1129. void
  1130. dict_ind_init(void);
  1131. /*===============*/
  1132. #ifndef UNIV_NONINL
  1133. #include "dict0dict.ic"
  1134. #endif
  1135. #endif