Skip to content

Commit

Permalink
[#290] Make link default
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed May 11, 2024
1 parent 252ee41 commit f00fac3
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 162 deletions.
77 changes: 1 addition & 76 deletions contrib/grafana/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,81 +399,6 @@
"title": "Compression Algorithm",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"0": {
"index": 1,
"text": "No"
},
"1": {
"index": 0,
"text": "Yes"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 4,
"x": 4,
"y": 5
},
"id": 16,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "builder",
"exemplar": false,
"expr": "pgmoneta_link",
"instant": true,
"legendFormat": "__auto",
"range": false,
"refId": "pgmoneta_link"
}
],
"title": "Use Links",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -3066,4 +2991,4 @@
"uid": "IGBRf7_Vz",
"version": 3,
"weekStart": ""
}
}
1 change: 0 additions & 1 deletion doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ See a [sample](./etc/pgmoneta.conf) configuration for running `pgmoneta` on `loc
| azure_shared_key | | String | Yes | The Azure storage account key |
| azure_base_dir | | String | Yes | The base directory for the Azure container |
| retention | 7, - , - , - | Array | No | The retention time in days, weeks, months, years |
| link | `on` | Bool | No | Use links to limit backup size |
| log_type | console | String | No | The logging type (console, file, syslog) |
| log_level | info | String | No | The logging level, any of the (case insensitive) strings `FATAL`, `ERROR`, `WARN`, `INFO` and `DEBUG` (that can be more specific as `DEBUG1` thru `DEBUG5`). Debug level greater than 5 will be set to `DEBUG5`. Not recognized values will make the log_level be `INFO` |
| log_path | pgmoneta.log | String | No | The log file location. Can be a strftime(3) compatible string. |
Expand Down
3 changes: 0 additions & 3 deletions doc/man/pgmoneta.conf.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ azure_base_dir
retention
The retention time in days, weeks, months, years. Default is 7, - , - , -

link
Use links to limit backup size. Default is true

log_type
The logging type (console, file, syslog). Default is console

Expand Down
1 change: 0 additions & 1 deletion doc/manual/user-02-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ See a [sample][sample] configuration for running [**pgmoneta**][pgmoneta] on `lo
| azure_shared_key | | String | Yes | The Azure storage account key |
| azure_base_dir | | String | Yes | The base directory for the Azure container |
| retention | 7, - , - , - | Array | No | The retention time in days, weeks, months, years |
| link | `on` | Bool | No | Use links to limit backup size |
| log_type | console | String | No | The logging type (console, file, syslog) |
| log_level | info | String | No | The logging level, any of the (case insensitive) strings `FATAL`, `ERROR`, `WARN`, `INFO` and `DEBUG` (that can be more specific as `DEBUG1` thru `DEBUG5`). Debug level greater than 5 will be set to `DEBUG5`. Not recognized values will make the log_level be `INFO` |
| log_path | pgmoneta.log | String | No | The log file location. Can be a strftime(3) compatible string. |
Expand Down
8 changes: 0 additions & 8 deletions doc/manual/user-11-prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ The compression used

4 = BZIP2

## pgmoneta_link

Use symbolic links for backups

1 = Yes

0 = No

## pgmoneta_used_space

The disk space used for pgmoneta
Expand Down
1 change: 0 additions & 1 deletion src/include/pgmoneta.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ struct configuration
int retention_weeks; /**< The retention weeks for the server */
int retention_months; /**< The retention months for the server */
int retention_years; /**< The retention years for the server */
bool link; /**< Use link */

int log_type; /**< The logging type */
int log_level; /**< The logging level */
Expand Down
17 changes: 0 additions & 17 deletions src/libpgmoneta/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ pgmoneta_init_configuration(void* shm)
config->retention_months = -1;
config->retention_years = -1;

config->link = true;

config->tls = false;

config->blocking_timeout = 30;
Expand Down Expand Up @@ -1164,20 +1162,6 @@ pgmoneta_read_configuration(void* shm, char* filename)
unknown = true;
}
}
else if (!strcmp(key, "link"))
{
if (!strcmp(section, "pgmoneta"))
{
if (as_bool(value, &config->link))
{
unknown = true;
}
}
else
{
unknown = true;
}
}
else if (!strcmp(key, "encryption"))
{
if (!strcmp(section, "pgmoneta"))
Expand Down Expand Up @@ -2989,7 +2973,6 @@ transfer_configuration(struct configuration* config, struct configuration* reloa
config->retention_weeks = reload->retention_weeks;
config->retention_months = reload->retention_months;
config->retention_years = reload->retention_years;
config->link = reload->link;

/* log_type */
restart_int("log_type", config->log_type, reload->log_type);
Expand Down
38 changes: 1 addition & 37 deletions src/libpgmoneta/management.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,6 @@ pgmoneta_management_write_status(int socket, bool offline)
goto error;
}

if (write_int32("pgmoneta_management_write_status", socket, config->link ? 1 : 0))
{
goto error;
}

if (write_int32("pgmoneta_management_write_status", socket, config->workers))
{
goto error;
Expand Down Expand Up @@ -887,11 +882,6 @@ pgmoneta_management_write_details(int socket, bool offline)
goto error;
}

if (write_int32("pgmoneta_management_write_details", socket, config->link ? 1 : 0))
{
goto error;
}

if (write_int32("pgmoneta_management_write_status", socket, config->workers))
{
goto error;
Expand Down Expand Up @@ -1740,7 +1730,6 @@ read_status_json(SSL* ssl, int socket)
int retention_weeks;
int retention_months;
int retention_years;
int link;
int num_servers;
int number_of_directories;
int workers;
Expand Down Expand Up @@ -1788,12 +1777,6 @@ read_status_json(SSL* ssl, int socket)
cJSON_AddStringToObject(status, "Total space", size_string);
free(size_string);

if (read_int32("pgmoneta_management_read_status", socket, &link))
{
goto error;
}
cJSON_AddStringToObject(status, "Link", link == 1 ? "Yes" : "No");

if (read_int32("pgmoneta_management_read_status", socket, &workers))
{
goto error;
Expand Down Expand Up @@ -1909,7 +1892,6 @@ read_details_json(SSL* ssl, int socket)
int retention_weeks;
int retention_months;
int retention_years;
int link;
int num_servers;
int number_of_backups;
unsigned long backup_size;
Expand Down Expand Up @@ -1967,12 +1949,6 @@ read_details_json(SSL* ssl, int socket)
cJSON_AddStringToObject(status, "Total space", size_string);
free(size_string);

if (read_int32("pgmoneta_management_read_details", socket, &link))
{
goto error;
}
cJSON_AddStringToObject(status, "Link", link == 1 ? "Yes" : "No");

if (read_int32("pgmoneta_management_read_status", socket, &workers))
{
goto error;
Expand Down Expand Up @@ -2430,12 +2406,6 @@ print_status_json(cJSON* json)
printf("Free space : %s\n", total_space->valuestring);
}

cJSON* link = cJSON_GetObjectItemCaseSensitive(status, "Link");
if (link != NULL)
{
printf("Link : %s\n", link->valuestring);
}

cJSON* workers = cJSON_GetObjectItemCaseSensitive(status, "Workers");
if (workers != NULL)
{
Expand Down Expand Up @@ -2525,12 +2495,6 @@ print_details_json(cJSON* json)
printf("Free space : %s\n", total_space->valuestring);
}

cJSON* link = cJSON_GetObjectItemCaseSensitive(status, "Link");
if (link != NULL)
{
printf("Link : %s\n", link->valuestring);
}

cJSON* workers = cJSON_GetObjectItemCaseSensitive(status, "Workers");
if (workers != NULL)
{
Expand Down Expand Up @@ -2716,4 +2680,4 @@ print_list_backup_json(cJSON* json)
}

return 0;
}
}
13 changes: 0 additions & 13 deletions src/libpgmoneta/prometheus.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,6 @@ home_page(int client_fd)
data = pgmoneta_append(data, " <li>4 = BZIP2</li>\n");
data = pgmoneta_append(data, " </ul>\n");
data = pgmoneta_append(data, " <p>\n");
data = pgmoneta_append(data, " <h2>pgmoneta_link</h2>\n");
data = pgmoneta_append(data, " Use symbolic links for backups\n");
data = pgmoneta_append(data, " <ul>\n");
data = pgmoneta_append(data, " <li>1 = Yes</li>\n");
data = pgmoneta_append(data, " <li>0 = No</li>\n");
data = pgmoneta_append(data, " </ul>\n");
data = pgmoneta_append(data, " <p>\n");
data = pgmoneta_append(data, " <h2>pgmoneta_used_space</h2>\n");
data = pgmoneta_append(data, " The disk space used for pgmoneta\n");
data = pgmoneta_append(data, " <p>\n");
Expand Down Expand Up @@ -1064,12 +1057,6 @@ general_information(int client_fd)
data = pgmoneta_append_int(data, config->compression_type);
data = pgmoneta_append(data, "\n\n");

data = pgmoneta_append(data, "#HELP pgmoneta_link Use symbolic links for backups\n");
data = pgmoneta_append(data, "#TYPE pgmoneta_link gauge\n");
data = pgmoneta_append(data, "pgmoneta_link ");
data = pgmoneta_append_bool(data, config->link);
data = pgmoneta_append(data, "\n\n");

d = NULL;

d = pgmoneta_append(d, config->base_dir);
Expand Down
7 changes: 2 additions & 5 deletions src/libpgmoneta/workflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,8 @@ wf_backup(void)
current = current->next;
}

if (config->link)
{
current->next = pgmoneta_workflow_create_link();
current = current->next;
}
current->next = pgmoneta_workflow_create_link();
current = current->next;

current->next = pgmoneta_workflow_create_permissions(PERMISSION_TYPE_BACKUP);
current = current->next;
Expand Down

0 comments on commit f00fac3

Please sign in to comment.