Address AI review suggestions

pull/5364/head
vramesha 3 months ago
parent 15a4ed66e9
commit 091942e9d6

@ -121,7 +121,8 @@ public:
/**
* @brief Flushes the buffer to an output file stream.
*
* Writes the entire contents of the buffer to the provided file stream and resets the buffer.
* Writes the entire contents of the buffer to the provided file stream.
* The caller is responsible for resetting the buffer after flushing.
*
* @param logfile The output file stream to write to.
*/

@ -1355,6 +1355,7 @@ void MySQL_Logger::events_open_log_unlocked() {
metaEvent.write(&log_ctx->events, nullptr);
log_ctx->events.flush_to_file(events.logfile);
events.current_log_size += log_ctx->events.size();
log_ctx->events.reset(monotonic_time());
}
}
catch (const std::ofstream::failure&) {

@ -1028,7 +1028,6 @@ void PgSQL_Logger::flush() {
const uint64_t current_time = monotonic_time();
// eventslog
bool flush_eventslog = false;
if (is_events_logfile_open()) {
if (log_ctx->events.size() > 0 &&
(current_time - log_ctx->events.get_last_flush_time()) > static_cast<uint64_t>(pgsql_thread___eventslog_flush_timeout) * 1000) {
@ -1046,7 +1045,6 @@ void PgSQL_Logger::flush() {
}
// auditlogs
bool flush_auditlog = false;
if (is_audit_logfile_open()) {
if (log_ctx->audit.size() > 0 &&
(current_time - log_ctx->audit.get_last_flush_time()) > static_cast<uint64_t>(pgsql_thread___auditlog_flush_timeout) * 1000) {

@ -94,11 +94,11 @@ bool flush_and_rotate(
buffer.flush_to_file(logfile);
current_log_size += buffer.size();
flushed = true;
logfile->flush();
if (current_log_size > max_log_file_size && rotate_fn) {
rotate_fn();
current_log_size = 0;
}
logfile->flush();
}
unlock_fn();
if (flushed) {

Loading…
Cancel
Save