Pbxt.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * The PBXT storage engine
  5. *
  6. * @package PhpMyAdmin-Engines
  7. */
  8. namespace PhpMyAdmin\Engines;
  9. use PhpMyAdmin\Core;
  10. use PhpMyAdmin\StorageEngine;
  11. use PhpMyAdmin\Util;
  12. /**
  13. * The PBXT storage engine
  14. *
  15. * @package PhpMyAdmin-Engines
  16. */
  17. class Pbxt extends StorageEngine
  18. {
  19. /**
  20. * Returns array with variable names dedicated to PBXT storage engine
  21. *
  22. * @return array variable names
  23. */
  24. public function getVariables()
  25. {
  26. return array(
  27. 'pbxt_index_cache_size' => array(
  28. 'title' => __('Index cache size'),
  29. 'desc' => __(
  30. 'This is the amount of memory allocated to the'
  31. . ' index cache. Default value is 32MB. The memory'
  32. . ' allocated here is used only for caching index pages.'
  33. ),
  34. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  35. ),
  36. 'pbxt_record_cache_size' => array(
  37. 'title' => __('Record cache size'),
  38. 'desc' => __(
  39. 'This is the amount of memory allocated to the'
  40. . ' record cache used to cache table data. The default'
  41. . ' value is 32MB. This memory is used to cache changes to'
  42. . ' the handle data (.xtd) and row pointer (.xtr) files.'
  43. ),
  44. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  45. ),
  46. 'pbxt_log_cache_size' => array(
  47. 'title' => __('Log cache size'),
  48. 'desc' => __(
  49. 'The amount of memory allocated to the'
  50. . ' transaction log cache used to cache on transaction log'
  51. . ' data. The default is 16MB.'
  52. ),
  53. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  54. ),
  55. 'pbxt_log_file_threshold' => array(
  56. 'title' => __('Log file threshold'),
  57. 'desc' => __(
  58. 'The size of a transaction log before rollover,'
  59. . ' and a new log is created. The default value is 16MB.'
  60. ),
  61. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  62. ),
  63. 'pbxt_transaction_buffer_size' => array(
  64. 'title' => __('Transaction buffer size'),
  65. 'desc' => __(
  66. 'The size of the global transaction log buffer'
  67. . ' (the engine allocates 2 buffers of this size).'
  68. . ' The default is 1MB.'
  69. ),
  70. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  71. ),
  72. 'pbxt_checkpoint_frequency' => array(
  73. 'title' => __('Checkpoint frequency'),
  74. 'desc' => __(
  75. 'The amount of data written to the transaction'
  76. . ' log before a checkpoint is performed.'
  77. . ' The default value is 24MB.'
  78. ),
  79. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  80. ),
  81. 'pbxt_data_log_threshold' => array(
  82. 'title' => __('Data log threshold'),
  83. 'desc' => __(
  84. 'The maximum size of a data log file. The default'
  85. . ' value is 64MB. PBXT can create a maximum of 32000 data'
  86. . ' logs, which are used by all tables. So the value of'
  87. . ' this variable can be increased to increase the total'
  88. . ' amount of data that can be stored in the database.'
  89. ),
  90. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  91. ),
  92. 'pbxt_garbage_threshold' => array(
  93. 'title' => __('Garbage threshold'),
  94. 'desc' => __(
  95. 'The percentage of garbage in a data log file'
  96. . ' before it is compacted. This is a value between 1 and'
  97. . ' 99. The default is 50.'
  98. ),
  99. 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
  100. ),
  101. 'pbxt_log_buffer_size' => array(
  102. 'title' => __('Log buffer size'),
  103. 'desc' => __(
  104. 'The size of the buffer used when writing a data'
  105. . ' log. The default is 256MB. The engine allocates one'
  106. . ' buffer per thread, but only if the thread is required'
  107. . ' to write a data log.'
  108. ),
  109. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  110. ),
  111. 'pbxt_data_file_grow_size' => array(
  112. 'title' => __('Data file grow size'),
  113. 'desc' => __('The grow size of the handle data (.xtd) files.'),
  114. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  115. ),
  116. 'pbxt_row_file_grow_size' => array(
  117. 'title' => __('Row file grow size'),
  118. 'desc' => __('The grow size of the row pointer (.xtr) files.'),
  119. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
  120. ),
  121. 'pbxt_log_file_count' => array(
  122. 'title' => __('Log file count'),
  123. 'desc' => __(
  124. 'This is the number of transaction log files'
  125. . ' (pbxt/system/xlog*.xt) the system will maintain. If the'
  126. . ' number of logs exceeds this value then old logs will be'
  127. . ' deleted, otherwise they are renamed and given the next'
  128. . ' highest number.'
  129. ),
  130. 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
  131. ),
  132. );
  133. }
  134. /**
  135. * returns the pbxt engine specific handling for
  136. * PMA_ENGINE_DETAILS_TYPE_SIZE variables.
  137. *
  138. * @param string $formatted_size the size expression (for example 8MB)
  139. *
  140. * @return string the formatted value and its unit
  141. */
  142. public function resolveTypeSize($formatted_size)
  143. {
  144. if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
  145. $value = Util::extractValueFromFormattedSize(
  146. $formatted_size
  147. );
  148. } else {
  149. $value = $formatted_size;
  150. }
  151. return Util::formatByteDown($value);
  152. }
  153. //--------------------
  154. /**
  155. * Get information about pages
  156. *
  157. * @return array Information about pages
  158. */
  159. public function getInfoPages()
  160. {
  161. $pages = array();
  162. $pages['Documentation'] = __('Documentation');
  163. return $pages;
  164. }
  165. //--------------------
  166. /**
  167. * Get content of documentation page
  168. *
  169. * @return string
  170. */
  171. public function getPageDocumentation()
  172. {
  173. $output = '<p>' . sprintf(
  174. __(
  175. 'Documentation and further information about PBXT'
  176. . ' can be found on the %sPrimeBase XT Home Page%s.'
  177. ),
  178. '<a href="' . Core::linkURL('https://mariadb.com/kb/en/mariadb/about-pbxt/')
  179. . '" rel="noopener noreferrer" target="_blank">',
  180. '</a>'
  181. )
  182. . '</p>' . "\n";
  183. return $output;
  184. }
  185. }