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.

76 lines
1.6 KiB

20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
20 years ago
  1. /******************************************************
  2. Data dictionary creation and booting
  3. (c) 1996 Innobase Oy
  4. Created 4/18/1996 Heikki Tuuri
  5. *******************************************************/
  6. /**************************************************************************
  7. Writes the current value of the row id counter to the dictionary header file
  8. page. */
  9. UNIV_INTERN
  10. void
  11. dict_hdr_flush_row_id(void);
  12. /*=======================*/
  13. /**************************************************************************
  14. Returns a new row id. */
  15. UNIV_INLINE
  16. dulint
  17. dict_sys_get_new_row_id(void)
  18. /*=========================*/
  19. /* out: the new id */
  20. {
  21. dulint id;
  22. mutex_enter(&(dict_sys->mutex));
  23. id = dict_sys->row_id;
  24. if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) {
  25. dict_hdr_flush_row_id();
  26. }
  27. UT_DULINT_INC(dict_sys->row_id);
  28. mutex_exit(&(dict_sys->mutex));
  29. return(id);
  30. }
  31. /**************************************************************************
  32. Reads a row id from a record or other 6-byte stored form. */
  33. UNIV_INLINE
  34. dulint
  35. dict_sys_read_row_id(
  36. /*=================*/
  37. /* out: row id */
  38. byte* field) /* in: record field */
  39. {
  40. #if DATA_ROW_ID_LEN != 6
  41. # error "DATA_ROW_ID_LEN != 6"
  42. #endif
  43. return(mach_read_from_6(field));
  44. }
  45. /**************************************************************************
  46. Writes a row id to a record or other 6-byte stored form. */
  47. UNIV_INLINE
  48. void
  49. dict_sys_write_row_id(
  50. /*==================*/
  51. byte* field, /* in: record field */
  52. dulint row_id) /* in: row id */
  53. {
  54. #if DATA_ROW_ID_LEN != 6
  55. # error "DATA_ROW_ID_LEN != 6"
  56. #endif
  57. mach_write_to_6(field, row_id);
  58. }