Commit dad1b02
authored
[DPE-8865] Extract error messages (#1320)
* Extract warning and error messages from pgBackRest logs
Sometimes the error message is sent to the stdout instead of the stderr, so it's important to check both
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* Use semicolon separator for pgBackRest error messages
Concatenate multiple ERROR/WARN lines with "; " instead of " " for
improved readability when debugging backup issues.
Updated unit test to match new separator format.
Cherry-picked from #1328 (commit 1f1b601).
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* [DPE-9070] Handle pgBackRest archive timeout in check_stanza (#1350)
Port archive timeout error handling (error code 82) from PR #1328 to
allow users to fix network issues and retry with `juju resolve`.
When archive operations timeout, the charm enters error state instead
of blocked state, enabling recovery via juju resolve.
Fixes #1346
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* Standardize pgBackRest logging to use stderr consistently
Addresses code review feedback from PR #1320 (review #3577653265) about
potential log duplication when checking both stdout and stderr for errors.
Changes:
- Add PGBACKREST_LOG_LEVEL_STDERR constant (--log-level-stderr=warn) to
ensure all pgBackRest commands output errors/warnings to stderr
- Update all 9 pgBackRest command invocations to include the new flag
- Simplify _extract_error_message() to only check stderr (removes stdout
parameter entirely)
- Update all 8 call sites and 7 unit tests to use new single-parameter API
- Remove redundant test for stdout handling
This approach eliminates the risk of log duplication while maintaining
predictable error extraction. All errors and warnings now consistently
appear in stderr, making error handling more reliable.
Reference: https://pgbackrest.org/configuration.html#section-log
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* Revert "Standardize pgBackRest logging to use stderr consistently"
This reverts commit 13a9ac4.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* Reapply "Standardize pgBackRest logging to use stderr consistently"
This reverts commit 1c3eb04.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* Fix test_initialise_stanza and cleanup unused variables
- Add --log-level-stderr=warn to test_initialise_stanza expected command to
match implementation from commit d3a46b6
- Replace unused stdout variables with '_' in check_stanza,
_is_primary_pgbackrest_service_running, and _on_restore_action
- Add --log-level-console=debug to backup command for detailed output
Fixes assertion error in tests/unit/test_backups.py::test_initialise_stanza
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
---------
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>1 parent 7d6c6c7 commit dad1b02
3 files changed
+150
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
187 | 195 | | |
188 | 196 | | |
189 | 197 | | |
| |||
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
198 | | - | |
| 206 | + | |
| 207 | + | |
199 | 208 | | |
200 | 209 | | |
201 | 210 | | |
| |||
357 | 366 | | |
358 | 367 | | |
359 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
360 | 401 | | |
361 | 402 | | |
362 | 403 | | |
| |||
401 | 442 | | |
402 | 443 | | |
403 | 444 | | |
| 445 | + | |
404 | 446 | | |
405 | 447 | | |
406 | 448 | | |
407 | 449 | | |
408 | | - | |
| 450 | + | |
| 451 | + | |
409 | 452 | | |
410 | 453 | | |
411 | 454 | | |
| |||
472 | 515 | | |
473 | 516 | | |
474 | 517 | | |
| 518 | + | |
475 | 519 | | |
476 | 520 | | |
477 | 521 | | |
478 | 522 | | |
479 | | - | |
| 523 | + | |
| 524 | + | |
480 | 525 | | |
481 | 526 | | |
482 | 527 | | |
| |||
506 | 551 | | |
507 | 552 | | |
508 | 553 | | |
| 554 | + | |
509 | 555 | | |
510 | 556 | | |
511 | 557 | | |
512 | 558 | | |
513 | 559 | | |
514 | | - | |
| 560 | + | |
| 561 | + | |
515 | 562 | | |
516 | 563 | | |
517 | 564 | | |
| |||
623 | 670 | | |
624 | 671 | | |
625 | 672 | | |
| 673 | + | |
626 | 674 | | |
627 | 675 | | |
628 | 676 | | |
| |||
681 | 729 | | |
682 | 730 | | |
683 | 731 | | |
| 732 | + | |
684 | 733 | | |
685 | 734 | | |
686 | 735 | | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
687 | 745 | | |
688 | 746 | | |
689 | 747 | | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
690 | 751 | | |
691 | 752 | | |
692 | 753 | | |
| |||
735 | 796 | | |
736 | 797 | | |
737 | 798 | | |
| 799 | + | |
738 | 800 | | |
739 | 801 | | |
740 | 802 | | |
741 | 803 | | |
742 | 804 | | |
| 805 | + | |
743 | 806 | | |
744 | | - | |
| 807 | + | |
745 | 808 | | |
746 | 809 | | |
747 | 810 | | |
| |||
931 | 994 | | |
932 | 995 | | |
933 | 996 | | |
| 997 | + | |
934 | 998 | | |
935 | 999 | | |
936 | 1000 | | |
| |||
967 | 1031 | | |
968 | 1032 | | |
969 | 1033 | | |
970 | | - | |
| 1034 | + | |
| 1035 | + | |
971 | 1036 | | |
972 | 1037 | | |
973 | 1038 | | |
| |||
1134 | 1199 | | |
1135 | 1200 | | |
1136 | 1201 | | |
1137 | | - | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1138 | 1206 | | |
1139 | 1207 | | |
1140 | 1208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
40 | 94 | | |
41 | 95 | | |
42 | 96 | | |
| |||
694 | 748 | | |
695 | 749 | | |
696 | 750 | | |
| 751 | + | |
697 | 752 | | |
698 | 753 | | |
699 | 754 | | |
| |||
784 | 839 | | |
785 | 840 | | |
786 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
787 | 850 | | |
788 | 851 | | |
789 | 852 | | |
| |||
0 commit comments