Commit eae8d71
[extension/storage/filestorage] Fix
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
* This enables recovery from a panic when the bbolt db is corrupted and
renames the file when a panic occurs.
* This changes the `recreate` behavior to not rename the file upon every
start of the collector.
<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Resolves
#36840
Resolves
#35899
<!--Describe what testing was performed and which tests were added.-->
#### Testing
1. Start collector with file extension configured. This should create
the file with some content within it.
2. Stop the collector.
3. Manually edit or "break" the bbolt db file by adding characters in
random places, forcefully causing a panic
4. Start the collector
5. See logs:
```json
{"level":"info","ts":"2025-07-31T23:26:34.218-0400","msg":"Setting up own telemetry...","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"}}
{"level":"info","ts":"2025-07-31T23:26:34.242-0400","msg":"Starting otelcontribcol...","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"Version":"0.131.0-dev","NumCPU":6}
{"level":"info","ts":"2025-07-31T23:26:34.242-0400","msg":"Starting extensions...","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"}}
{"level":"info","ts":"2025-07-31T23:26:34.242-0400","msg":"Extension is starting...","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"file_storage/persistent_queue_storage","otelcol.component.kind":"extension"}
{"level":"info","ts":"2025-07-31T23:26:34.242-0400","msg":"Extension started.","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"file_storage/persistent_queue_storage","otelcol.component.kind":"extension"}
#### This line ####
{"level":"warn","ts":"2025-07-31T23:26:34.242-0400","msg":"Database corruption detected, recreating database file","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"file_storage/persistent_queue_storage","otelcol.component.kind":"extension","file":"/data/otelcol/persistent_queue_storage/exporter_otlphttp_general_logs","panic":"assertion failed: Page expected to be: 96, but self identifies as 4909050520039286100"}
{"level":"info","ts":"2025-07-31T23:26:34.243-0400","msg":"Corrupted database file renamed","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"file_storage/persistent_queue_storage","otelcol.component.kind":"extension","original":"/data/otelcol/persistent_queue_storage/exporter_otlphttp_general_logs","backup":"/data/otelcol/persistent_queue_storage/exporter_otlphttp_general_logs.2025-08-27T13:26:07.479.backup"}
#### through this line ####
{"level":"info","ts":"2025-07-31T23:26:34.244-0400","msg":"New queue metadata key not found, attempting to load legacy format.","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"otlphttp/general","otelcol.component.kind":"exporter","otelcol.signal":"logs"}
{"level":"info","ts":"2025-07-31T23:26:34.244-0400","msg":"Initializing new persistent queue","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"otlphttp/general","otelcol.component.kind":"exporter","otelcol.signal":"logs"}
{"level":"info","ts":"2025-07-31T23:26:34.244-0400","msg":"Successfully migrated to consolidated metadata format","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"},"otelcol.component.id":"otlphttp/general","otelcol.component.kind":"exporter","otelcol.signal":"logs"}
{"level":"info","ts":"2025-07-31T23:26:34.255-0400","msg":"Everything is ready. Begin running and processing data.","resource":{"service.instance.id":"d830aeff-7993-49f7-9817-a0c96af3498d","service.name":"otelcontribcol","service.version":"0.131.0-dev"}}
```
<!--Describe the documentation added.-->
#### Documentation
Updated the existing documentation with behavioral changes for
`recreate` option.
<!--Please delete paragraphs that you did not use before submitting.-->
---------
Co-authored-by: Antoine Toulme <[email protected]>recreate from panic (#41802)1 parent 35f8fa4 commit eae8d71
File tree
4 files changed
+83
-11
lines changed- .chloggen
- extension/storage/filestorage
4 files changed
+83
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| 95 | + | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| |||
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
95 | 132 | | |
96 | 133 | | |
97 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
| 669 | + | |
| 670 | + | |
670 | 671 | | |
671 | 672 | | |
672 | 673 | | |
| |||
679 | 680 | | |
680 | 681 | | |
681 | 682 | | |
682 | | - | |
| 683 | + | |
683 | 684 | | |
684 | | - | |
| 685 | + | |
685 | 686 | | |
686 | 687 | | |
687 | 688 | | |
| |||
0 commit comments