Fix abnormal server terminations due to write failures#20465
Fix abnormal server terminations due to write failures#20465alexey-milovidov merged 2 commits intoClickHouse:masterfrom
Conversation
37060fd to
48791e2
Compare
48791e2 to
06e8065
Compare
|
Perhaps we should just ignore all errors in dtor as the same way the stdlib does it. If the user cares about errors during close, they must call close() themselves. Otherwise, the dtor calls close and ignores all errors from the call. |
That was previous behavior, but it does not looks safe, since "user" (developer) can forget about calling one of finalize/sync/next and the error will be simply ignored (and not only forgotten but also if something will be thrown in between), w/o any error provided to user. |
But we should not throw in dtor anyway. |
|
Destructors are noexcept by default. We can annotate it with |
Right
I tried to do this, but the problem is - there is too much classes that should be changed (including poco). And actually to me it is better to terminate the server if the write failed instead of writing error the log, someone may miss this and the data will be lost. Also note, that this patches are still make sense by themselves (regardless #19451) |
|
➕ We should not make destructors noexcept(false). |
Broken after merging NuRaft. |
OOM. |
| Poco::File(new_tmp_part_path_str + "checksums.txt").setWriteable(); | ||
| WriteBufferFromFile checksums_out(new_tmp_part_path_str + "checksums.txt", 4096); | ||
| checksums.write(checksums_out); | ||
| checksums.close(); |
There was a problem hiding this comment.
MergeTreeDataPartChecksums doesn't define close method, do you mean checksums_in.close() or checksums_out.close() ?
There was a problem hiding this comment.
Indeed, my bad, can you send a patch? (Interesting, there is no splitted check on CI, hence this wasn't captured, since ENABLE_UTILS is set only for splitted)
There was a problem hiding this comment.
Maybe there will be more patches in this PR...
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix abnormal server terminations due to write failures
Fixes: #19451 (please add the no-backport label, since it has not bee included into any release yet)