summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
authorsergey.galtsev <sergey.galtsev@mongodb.com>2021-07-30 20:09:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-30 20:52:11 +0000
commitc0b5fa0957205eba75360f2daecde1aa121e1090 (patch)
treec0320169a105d49f4e939ea8be046408cfabd096 /src/mongo/logv2
parent149c1670828efa6937220ab0e5bc4fa40ed55a1d (diff)
downloadmongo-c0b5fa0957205eba75360f2daecde1aa121e1090.tar.gz
SERVER-58051 close the original log when rotating to new
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r--src/mongo/logv2/file_rotate_sink.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/logv2/file_rotate_sink.cpp b/src/mongo/logv2/file_rotate_sink.cpp
index cf882cca235..ff2bea8c119 100644
--- a/src/mongo/logv2/file_rotate_sink.cpp
+++ b/src/mongo/logv2/file_rotate_sink.cpp
@@ -149,7 +149,9 @@ Status FileRotateSink::rotate(bool rename,
auto newFile = openFile(filename, false);
if (newFile.isOK()) {
+ invariant(file.second);
remove_stream(file.second);
+ file.second->close();
file.second = newFile.getValue();
add_stream(file.second);
}