Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Umegane dev 965 #58

Merged
merged 36 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
393bed2
Add limestone.h with limestone_io_exception and limestone_exception
umegane Sep 6, 2024
4afd9a4
WIP
umegane Sep 6, 2024
dbfcf90
cleanup: clang-tidy
umegane Sep 6, 2024
d26025f
Add `file_operations` class and related tests
umegane Sep 6, 2024
b3eca88
cleanup: clang-tidy
umegane Sep 6, 2024
9021717
Refactor: Simplify method names in file_operations class
umegane Sep 9, 2024
fe00567
Add test for handling IO errors in compaction_catalog class
umegane Sep 9, 2024
6463271
cleanup: clang-tidy
umegane Sep 9, 2024
ebccbfc
Add internal doc
umegane Sep 10, 2024
1c2958c
Add unit tests for compaction_catalog class
umegane Sep 10, 2024
a8116cc
Refactor: Consolidate repeated catalog entries into constant strings
umegane Sep 13, 2024
e60e8ca
Add unit tests for compaction_catalog class
umegane Sep 13, 2024
40ec0f5
cleanup: clang-tidy
umegane Sep 18, 2024
caf6f42
Fix build errors on Ubuntu 24.04 by adding missing header includes
umegane Sep 18, 2024
4578abe
Replace std::runtime_error with limestone_exception
umegane Sep 18, 2024
df6f5f8
Refactor: Replace std::abort with limestone_exception in I/O operations
umegane Sep 24, 2024
ba2d7f6
Revert "Refactor: Replace std::abort with limestone_exception in I/O …
umegane Sep 24, 2024
7530cd8
Fix: Ensure correct file name and line number are logged
umegane Sep 24, 2024
8f7f0a6
Remove garbage data from log messages
umegane Sep 24, 2024
44854c6
Handle I/O exceptions during rotation and propagate them to the initi…
umegane Sep 24, 2024
6a7e4a8
Update Document
umegane Sep 24, 2024
86df100
Refined exception handling and noexcept specifications for public APIs
umegane Sep 25, 2024
af7d8b8
Add logging for online compaction failure handling
umegane Sep 25, 2024
85736fc
Remove incorrect noexcept specifier
umegane Sep 25, 2024
1909d09
Modify logging for online compaction failure handling
umegane Sep 25, 2024
e316186
cleanup: clang-tidy
umegane Sep 25, 2024
41e2bdb
Add handling of I/O exceptions during file rotation
umegane Sep 25, 2024
6dc2d9a
Disable environment-dependent test that fails in CI environments
umegane Sep 25, 2024
0eb12e9
Update document
umegane Sep 25, 2024
baade37
Remove garbage files
umegane Sep 25, 2024
c71de8d
Merge branch 'master' into umegane-dev-965
umegane Sep 25, 2024
af60a03
Merge branch 'master' into umegane-dev-965
umegane Oct 22, 2024
05e2cc9
Temporarily replace exception throwing with logging and process termi…
umegane Oct 22, 2024
aa442d8
cleanup: clang-tidy
umegane Oct 23, 2024
e7fc948
Update an internal document
umegane Oct 23, 2024
e543ddf
fix: correct log message formatting
umegane Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/internal/exception_handling_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,23 @@ Limnestoneの処理の中で、I/Oエラーが発生すると、std::runtime_err
* datastore::recover()
* datastore::shutdown()

## 暫定対処

現在API呼び出し側で、limestone_exceptionをキャッチする仕組みが未実装である。
このままだと、I/Oエラーが発生した場合に、プロセスがストールしてしまうことが
あるため、limestone_exceptionをスローする可能性があるAPIについて、
limestone_exceptionをスローするのではなく、FATALのログを出力して
abortする対応をする。

また、APIのDoxygenコメントに以下の記述を追加する。

```
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
```





3 changes: 3 additions & 0 deletions include/limestone/api/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class cursor {
* @brief change the current cursor to point to the next entry
* @attention this function is not thread-safe.
* @exception limestone_exception if an error occurs while reading the log entry
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @return true if the next entry exists, false otherwise
*/
bool next();
Expand Down
15 changes: 15 additions & 0 deletions include/limestone/api/datastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class datastore {
* @brief create an object with the given configuration
* @param conf a reference to a configuration object used in the object construction
* @exception limestone_exception if an I/O error occurs during construction
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
*/
explicit datastore(configuration const& conf);

Expand Down Expand Up @@ -114,6 +117,9 @@ class datastore {
* @brief transition this object to an operational state
* @details after this method is called, create_channel() can be invoked.
* @exception limestone_io_exception Thrown if an I/O error occurs.
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe, and the from directory must not contain any files other than log files.
*/
void ready();
Expand Down Expand Up @@ -153,6 +159,9 @@ class datastore {
* @brief change the current epoch ID
* @param new epoch id which must be greater than current epoch ID.
* @exception limestone_io_exception Thrown if an I/O error occurs.
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function should be called after the ready() is called.
*/
void switch_epoch(epoch_id_type epoch_id);
Expand Down Expand Up @@ -194,6 +203,9 @@ class datastore {
* @brief start backup operation
* @detail a backup object is created, which contains a list of log files.
* @exception limestone_io_exception Thrown if an I/O error occurs.
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @return a reference to the backup object.
*/
backup& begin_backup();
Expand All @@ -203,6 +215,9 @@ class datastore {
* @brief start backup operation
* @detail a backup_detail object is created, which contains a list of log entry.
* @exception limestone_io_exception Thrown if an I/O error occurs.
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @return a reference to the backup_detail object.
*/
std::unique_ptr<backup_detail> begin_backup(backup_type btype);
Expand Down
24 changes: 24 additions & 0 deletions include/limestone/api/log_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class log_channel {
* @brief join a persistence session for the current epoch in this channel
* @attention this function is not thread-safe.
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @note the current epoch is the last epoch specified by datastore::switch_epoch()
* @note datastore::switch_epoch() and this function can be called simultaneously.
* If these functions are invoked at the same time, the result will be as if one of them was called first,
Expand All @@ -58,6 +61,9 @@ class log_channel {
* @brief notifies the completion of an operation in this channel for the current persistent session the channel is participating in
* @attention this function is not thread-safe.
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @note when all channels that have participated in the current persistent session call end_session() and the current epoch is
* greater than the session's epoch, the persistent session itself is complete
*/
Expand All @@ -76,6 +82,9 @@ class log_channel {
* @param value the value byte string for the entry to be added
* @param write_version (optional) the write version of the entry to be added. If omitted, the default value is used
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
*/
void add_entry(storage_id_type storage_id, std::string_view key, std::string_view value, write_version_type write_version);
Expand All @@ -88,6 +97,9 @@ class log_channel {
* @param write_version (optional) the write version of the entry to be added. If omitted, the default value is used
* @param large_objects (optional) the list of large objects associated with the entry to be added
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
*/
void add_entry(storage_id_type storage_id, std::string_view key, std::string_view value, write_version_type write_version, const std::vector<large_object_input>& large_objects);
Expand All @@ -98,6 +110,9 @@ class log_channel {
* @param key the key byte string for the entry to be deleted
* @param write_version the write version of the entry to be removed
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
* @note no deletion operation is performed on the entry that has been added to the current persistent session, instead,
* the entries to be deleted are treated as if they do not exist in a recover() operation from a log stored in the current persistent session
Expand All @@ -109,6 +124,9 @@ class log_channel {
* @param storage_id the storage ID of the entry to be added
* @param write_version the write version of the entry to be added
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
* @impl this operation may be ignored.
*/
Expand All @@ -119,6 +137,9 @@ class log_channel {
* @param storage_id the storage ID of the entry to be removed
* @param write_version the write version of the entry to be removed
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
* @note no deletion operation is performed on the entry that has been added to the current persistent session, instead,
* the target entries are treated as if they do not exist in the recover() operation from the log stored in the current persistent session.
Expand All @@ -130,6 +151,9 @@ class log_channel {
* @param storage_id the storage ID of the entry to be removed
* @param write_version the write version of the entry to be removed
* @exception limestone_exception if I/O error occurs
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @attention this function is not thread-safe.
* @note no deletion operation is performed on the entry that has been added to the current persistent session, instead,
* the target entries are treated as if they do not exist in the recover() operation from the log stored in the current persistent session.
Expand Down
3 changes: 3 additions & 0 deletions include/limestone/api/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class snapshot {
* @details the returned cursor points to the first element by calling cursor::next().
* @attention this function is thread-safe.
* @exception limestone_exception if the file stream of the cursor is not good.
* @note Currently, this function does not throw an exception but logs the error and aborts the process.
* However, throwing an exception is the intended behavior, and this will be restored in future versions.
* Therefore, callers of this API must handle the exception properly as per the original design.
* @return unique pointer of the cursor
*/
[[nodiscard]] std::unique_ptr<cursor> get_cursor() const;
Expand Down
7 changes: 6 additions & 1 deletion src/limestone/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ cursor::~cursor() noexcept {
}

bool cursor::next() {
return pimpl->next();
try {
return pimpl->next();
} catch (...) {
HANDLE_EXCEPTION_AND_ABORT();
throw; // Unreachable, but required to satisfy the compiler
}
}

storage_id_type cursor::storage() const noexcept {
Expand Down
Loading