Skip to content

Commit

Permalink
cleanups and adjust setvbuf param
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Oct 6, 2023
1 parent 581d67b commit 4e665e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/limestone/datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void datastore::update_min_epoch_id(bool from_switch_epoch) noexcept { // NOLIN
LOG_LP(ERROR) << "fflush failed, errno = " << errno;
std::abort();
}
if (int rc = fsync(fileno(strm)); rc != 0) {
if (fsync(fileno(strm)) != 0) {
LOG_LP(ERROR) << "fsync failed, errno = " << errno;
std::abort();
}
Expand Down
2 changes: 1 addition & 1 deletion src/limestone/datastore_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void datastore::create_snapshot() noexcept { // NOLINT(readability-function-cog
LOG_LP(ERROR) << "cannot create snapshot file (" << snapshot_file << ")";
std::abort();
}
setvbuf(ostrm, nullptr, _IOFBF, 1024L * 1024L); // NOLINT TODO: error check
setvbuf(ostrm, nullptr, _IOFBF, 128L * 1024L); // NOLINT, NB. glibc may ignore size when _IOFBF and buffer=NULL
static_assert(sizeof(log_entry::entry_type) == 1);
#if defined SORT_METHOD_PUT_ONLY
sortdb->each([&ostrm, last_key = std::string{}](std::string_view db_key, std::string_view db_value) mutable {
Expand Down
4 changes: 2 additions & 2 deletions src/limestone/log_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void log_channel::begin_session() noexcept {
LOG_LP(ERROR) << "I/O error, cannot make file on " << location_ << ", errno = " << errno;
std::abort();
}
setvbuf(strm_, nullptr, _IOFBF, 1024L * 1024L); // NOLINT TODO: error check
setvbuf(strm_, nullptr, _IOFBF, 128L * 1024L); // NOLINT, NB. glibc may ignore size when _IOFBF and buffer=NULL
if (!registered_) {
envelope_.add_file(log_file);
registered_ = true;
Expand All @@ -62,7 +62,7 @@ void log_channel::end_session() noexcept {
LOG_LP(ERROR) << "fflush failed, errno = " << errno;
std::abort();
}
if (int rc = fsync(fileno(strm_)); rc != 0) {
if (fsync(fileno(strm_)) != 0) {
LOG_LP(ERROR) << "fsync failed, errno = " << errno;
std::abort();
}
Expand Down

0 comments on commit 4e665e9

Please sign in to comment.