fix potential problem (#2657)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
pull/2660/head
groot 2020-06-23 15:30:21 +08:00 committed by GitHub
parent cd04f3fc9f
commit d15487656c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2538,7 +2538,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) {
auto collections_flushed = [&](const std::string collection_id,
const std::set<std::string>& target_collection_names) -> uint64_t {
uint64_t max_lsn = 0;
if (options_.wal_enable_) {
if (options_.wal_enable_ && !target_collection_names.empty()) {
uint64_t lsn = 0;
for (auto& collection : target_collection_names) {
meta_ptr_->GetCollectionFlushLSN(collection, lsn);
@ -2737,7 +2737,7 @@ DBImpl::BackgroundWalThread() {
if (options_.auto_flush_interval_ > 0) {
next_auto_flush_time = get_next_auto_flush_time();
}
InternalFlush();
while (true) {
if (options_.auto_flush_interval_ > 0) {
if (std::chrono::system_clock::now() >= next_auto_flush_time) {