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

fix: querynode hang when failing to allocate disk space for mmap(#35184) #35187

Merged
Merged
Changes from all commits
Commits
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
33 changes: 26 additions & 7 deletions internal/core/src/storage/ChunkCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,37 @@

// release lock and perform download and decode
// other thread request same path shall get the future.
auto field_data = DownloadAndDecodeRemoteFile(cm_.get(), filepath);
auto column = Mmap(field_data->GetFieldData(), descriptor);

// set promise value to notify the future
lck.lock();
std::unique_ptr<DataCodec> field_data;
std::shared_ptr<ColumnBase> column;
bool allocate_success = false;
ErrorCode err_code = Success;
std::string err_msg = "";

Check warning on line 60 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L56-L60

Added lines #L56 - L60 were not covered by tests
try {
field_data = DownloadAndDecodeRemoteFile(cm_.get(), filepath);
column = Mmap(field_data->GetFieldData(), descriptor);
allocate_success = true;
} catch (const SegcoreError& e) {
err_code = e.get_error_code();
err_msg = fmt::format("failed to read for chunkCache, seg_core_err:{}",
e.what());

Check warning on line 68 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L62-L68

Added lines #L62 - L68 were not covered by tests
}
std::unique_lock mmap_lck(mutex_);

Check warning on line 70 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L70

Added line #L70 was not covered by tests
it = columns_.find(filepath);
if (it != columns_.end()) {
// check pair exists then set value
it->second.first.set_value(column);
if (allocate_success) {
AssertInfo(column, "unexpected null column, file={}", filepath);

Check warning on line 76 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L75-L76

Added lines #L75 - L76 were not covered by tests
}
} else {
PanicInfo(UnexpectedError,

Check warning on line 79 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L79

Added line #L79 was not covered by tests
"Wrong code, the thread to download for cache should get the "
"target entry");
}
if (err_code != Success) {
columns_.erase(filepath);
throw SegcoreError(err_code, err_msg);

Check warning on line 85 in internal/core/src/storage/ChunkCache.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/ChunkCache.cpp#L83-L85

Added lines #L83 - L85 were not covered by tests
}
lck.unlock();
AssertInfo(column, "unexpected null column, file={}", filepath);
return column;
}

Expand Down
Loading