@postgres.ai/shared 4.0.2-pr-1130.1 → 4.0.2-pr-1131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postgres.ai/shared",
3
- "version": "4.0.2-pr-1130.1",
3
+ "version": "4.0.2-pr-1131",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "peerDependencies": {
@@ -571,7 +571,7 @@ export const Configuration = observer(({ instanceId, switchActiveTab, reload, is
571
571
  testConnectionState.fetchTuning.message
572
572
  ? 'error'
573
573
  : '', message: testConnectionState.fetchTuning.error ||
574
- testConnectionState.fetchTuning.message.message })) : null] }), _jsxs(Box, { children: [_jsxs(Box, { children: [_jsx(Typography, { className: styles.subsection, children: "Subsection \"retrieval.spec.logicalRestore\"" }), _jsx("span", { className: classes.grayText, children: "Restoring options." })] }), _jsx(InputWithTooltip, { label: "pg_restore jobs", value: formik.values.restoreParallelJobs, tooltipText: tooltipText.restoreParallelJobs, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('restoreParallelJobs', e.target.value) }), _jsx(InputWithChip, { value: formik.values.pgRestoreCustomOptions, label: "pg_restore customOptions", id: "pgRestoreCustomOptions", tooltipText: tooltipText.pgRestoreCustomOptions, handleDeleteChip: handleDeleteChip, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('pgRestoreCustomOptions', e.target.value) }), _jsx(InputWithTooltip, { type: "textarea", label: "Restore PostgreSQL configs", value: formik.values.restoreConfigs, tooltipText: tooltipText.restoreConfigs, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('restoreConfigs', e.target.value) }), _jsx(FormControlLabel, { style: { maxWidth: 'max-content' }, control: _jsx(Checkbox, { name: "restoreIgnoreErrors", checked: formik.values.restoreIgnoreErrors, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('restoreIgnoreErrors', e.target.checked), classes: {
574
+ testConnectionState.fetchTuning.message.message })) : null] }), _jsxs(Box, { children: [_jsxs(Box, { children: [_jsx(Typography, { className: styles.subsection, children: "Subsection \"retrieval.spec.logicalRestore\"" }), _jsx("span", { className: classes.grayText, children: "Restoring options." })] }), _jsx(InputWithTooltip, { label: "pg_restore jobs", value: formik.values.restoreParallelJobs, tooltipText: tooltipText.restoreParallelJobs, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('restoreParallelJobs', e.target.value) }), _jsx(InputWithChip, { value: formik.values.pgRestoreCustomOptions, label: "pg_restore customOptions", id: "pgRestoreCustomOptions", tooltipText: tooltipText.pgRestoreCustomOptions, handleDeleteChip: handleDeleteChip, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('pgRestoreCustomOptions', e.target.value) }), _jsx(FormControlLabel, { style: { maxWidth: 'max-content' }, control: _jsx(Checkbox, { name: "restoreIgnoreErrors", checked: formik.values.restoreIgnoreErrors, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('restoreIgnoreErrors', e.target.checked), classes: {
575
575
  root: classes.checkboxRoot,
576
576
  } }), label: 'Ignore errors during logical data restore' })] }), _jsx(Box, { mt: 1, children: _jsx(Typography, { className: styles.subsection, children: "Subsection \"retrieval.refresh\"" }) }), _jsxs("span", { className: classes.grayText, children: ["Define full data refresh on schedule. The process requires at least one additional filesystem mount point. The schedule is to be specified using", ' ', _jsxs("a", { href: "https://en.wikipedia.org/wiki/Cron#Overview", target: "_blank", className: styles.externalLink, children: ["crontab format", _jsx(ExternalIcon, { className: styles.externalIcon })] }), "."] }), _jsx(InputWithTooltip, { label: "timetable", value: formik.values.timetable, tooltipText: tooltipText.timetable, disabled: isConfigurationDisabled, onChange: (e) => formik.setFieldValue('timetable', e.target.value) })] }), _jsxs(Box, { mt: 2, mb: 2, sx: {
577
577
  display: 'flex',
@@ -15,7 +15,6 @@ export declare const tooltipText: {
15
15
  pgDumpCustomOptions: () => JSX.Element;
16
16
  restoreParallelJobs: () => JSX.Element;
17
17
  pgRestoreCustomOptions: () => JSX.Element;
18
- restoreConfigs: () => JSX.Element;
19
18
  timetable: () => JSX.Element;
20
19
  tuningParams: () => JSX.Element;
21
20
  };
@@ -16,7 +16,6 @@ export const tooltipText = {
16
16
  pgDumpCustomOptions: () => (_jsx("div", { children: "pg_dump options to be used to create a database dump, for example: '--exclude-schema=repack --exclude-schema=\"camelStyleSchemaName\"'. Note that due to security reasons, the current implementation supports only letters, numbers, hyphen, underscore, equal sign, and double quotes." })),
17
17
  restoreParallelJobs: () => (_jsx("div", { children: "Number of parallel workers used to restore databases from dump to PostgreSQL managed by DBLab. For initial data retrieval (the first data refresh), it is recommended to match the number of available vCPUs on the machine running DBLab. This yields faster restore times but can increase CPU and disk I/O usage on that machine (up to temporary resource saturation). For subsequent refreshes, if DBLab is in continuous use, it is recommended to reduce this value by 50% to reserve capacity for normal DBLab operations (such as working with clones)." })),
18
18
  pgRestoreCustomOptions: () => (_jsx("div", { children: "pg_restore options to be used to restore from a database dump, for example: '--exclude-schema=repack --exclude-schema=\"camelStyleSchemaName\"'. Note that due to security reasons, the current implementation supports only letters, numbers, hyphen, underscore, equal sign, and double quotes." })),
19
- restoreConfigs: () => (_jsxs("div", { children: ["PostgreSQL configuration parameters applied during logical restore (one", ' ', _jsx("span", { className: styles.firaCodeFont, children: "parameter=value" }), " per line). These settings are written to", ' ', _jsx("span", { className: styles.firaCodeFont, children: "postgresql.conf" }), " before restore starts and do not affect clones. Useful for tuning restore performance, for example:", ' ', _jsx("span", { className: styles.firaCodeFont, children: "maintenance_work_mem=8GB" }), ",", ' ', _jsx("span", { className: styles.firaCodeFont, children: "max_parallel_maintenance_workers=7" }), ",", ' ', _jsx("span", { className: styles.firaCodeFont, children: "shared_preload_libraries=''" }), ",", ' ', _jsx("span", { className: styles.firaCodeFont, children: "fsync=off" }), "."] })),
20
19
  timetable: () => (_jsxs("div", { children: ["Schedule for full data refreshes, in", ' ', _jsx("a", { target: '_blank', href: 'https://en.wikipedia.org/wiki/Cron#Overview', className: styles.externalLink, children: "crontab format" }), "."] })),
21
20
  tuningParams: () => (_jsxs("div", { children: ["Query tuning parameters. These are essential to ensure that cloned PostgreSQL instances generate the same plans as the source (specifically, they are crucial for query performance troubleshooting and optimization, including working with EXPLAIN plans). For details, see the", ' ', _jsx("a", { target: '_blank', href: 'https://postgres.ai/docs/how-to-guides/administration/postgresql-configuration#postgresql-configuration-in-clones', className: styles.externalLink, children: "docs" }), "."] })),
22
21
  };
@@ -19,7 +19,6 @@ export declare type FormValues = {
19
19
  dumpIgnoreErrors: boolean;
20
20
  restoreParallelJobs: string;
21
21
  restoreIgnoreErrors: boolean;
22
- restoreConfigs: string;
23
22
  pgDumpCustomOptions: string;
24
23
  pgRestoreCustomOptions: string;
25
24
  };
@@ -33,7 +33,6 @@ export const useForm = (onSubmit) => {
33
33
  databases: '',
34
34
  dumpParallelJobs: '',
35
35
  restoreParallelJobs: '',
36
- restoreConfigs: '',
37
36
  pgDumpCustomOptions: '',
38
37
  pgRestoreCustomOptions: '',
39
38
  dumpIgnoreErrors: false,
@@ -98,7 +98,6 @@ export declare class MainStore {
98
98
  dumpIgnoreErrors: boolean | undefined;
99
99
  restoreParallelJobs: string | number | undefined;
100
100
  restoreIgnoreErrors: boolean | undefined;
101
- restoreConfigs: string;
102
101
  pgDumpCustomOptions: string;
103
102
  pgRestoreCustomOptions: string;
104
103
  dockerTag?: string | undefined;
@@ -15,10 +15,8 @@ export const formatTuningParamsToObj = (tuningParams) => {
15
15
  if (tuningParams) {
16
16
  const tuningParamsArr = tuningParams.split('\n');
17
17
  tuningParamsArr.forEach((param) => {
18
- const eqIndex = param.indexOf('=');
19
- if (eqIndex !== -1) {
20
- formattedTuningParams[param.substring(0, eqIndex)] = param.substring(eqIndex + 1);
21
- }
18
+ const paramArr = param.split('=');
19
+ formattedTuningParams[paramArr[0]] = paramArr[1];
22
20
  });
23
21
  }
24
22
  return formattedTuningParams;
@@ -41,9 +41,6 @@ export declare type configTypes = {
41
41
  customOptions?: string[];
42
42
  parallelJobs?: string | number;
43
43
  ignoreErrors?: boolean;
44
- configs?: {
45
- [key: string]: string;
46
- };
47
44
  };
48
45
  };
49
46
  };
@@ -65,7 +62,6 @@ export declare const formatConfig: (config: configTypes) => {
65
62
  dumpIgnoreErrors: boolean | undefined;
66
63
  restoreParallelJobs: string | number | undefined;
67
64
  restoreIgnoreErrors: boolean | undefined;
68
- restoreConfigs: string;
69
65
  pgDumpCustomOptions: string;
70
66
  pgRestoreCustomOptions: string;
71
67
  dockerTag?: string | undefined;
@@ -32,15 +32,6 @@ export const formatConfig = (config) => {
32
32
  dumpIgnoreErrors: (_27 = (_26 = (_25 = (_24 = config.retrieval) === null || _24 === void 0 ? void 0 : _24.spec) === null || _25 === void 0 ? void 0 : _25.logicalDump) === null || _26 === void 0 ? void 0 : _26.options) === null || _27 === void 0 ? void 0 : _27.ignoreErrors,
33
33
  restoreParallelJobs: (_31 = (_30 = (_29 = (_28 = config.retrieval) === null || _28 === void 0 ? void 0 : _28.spec) === null || _29 === void 0 ? void 0 : _29.logicalRestore) === null || _30 === void 0 ? void 0 : _30.options) === null || _31 === void 0 ? void 0 : _31.parallelJobs,
34
34
  restoreIgnoreErrors: (_35 = (_34 = (_33 = (_32 = config.retrieval) === null || _32 === void 0 ? void 0 : _32.spec) === null || _33 === void 0 ? void 0 : _33.logicalRestore) === null || _34 === void 0 ? void 0 : _34.options) === null || _35 === void 0 ? void 0 : _35.ignoreErrors,
35
- restoreConfigs: (() => {
36
- var _a, _b, _c, _d;
37
- const configs = (_d = (_c = (_b = (_a = config.retrieval) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.logicalRestore) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.configs;
38
- if (!configs || Object.keys(configs).length === 0)
39
- return '';
40
- return Object.entries(configs)
41
- .map(([k, v]) => `${k}=${v}`)
42
- .join('\n');
43
- })(),
44
35
  pgDumpCustomOptions: formatDumpCustomOptions((_40 = (_39 = (_38 = (_37 = (_36 = config.retrieval) === null || _36 === void 0 ? void 0 : _36.spec) === null || _37 === void 0 ? void 0 : _37.logicalDump) === null || _38 === void 0 ? void 0 : _38.options) === null || _39 === void 0 ? void 0 : _39.customOptions) !== null && _40 !== void 0 ? _40 : null),
45
36
  pgRestoreCustomOptions: formatDumpCustomOptions((_45 = (_44 = (_43 = (_42 = (_41 = config.retrieval) === null || _41 === void 0 ? void 0 : _41.spec) === null || _42 === void 0 ? void 0 : _42.logicalRestore) === null || _43 === void 0 ? void 0 : _43.options) === null || _44 === void 0 ? void 0 : _44.customOptions) !== null && _45 !== void 0 ? _45 : null),
46
37
  };