Pbxt.php 7.0 KB

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