enhance: use specified manifest version in loon ffi reader (#46101)

Related to #44956

Use the exact manifest version from the path parameter instead of always
fetching the latest manifest. This ensures data consistency by reading
from the specific version that was requested.

Changes:
- Update GetColumnGroups to use transaction.begin(version) with the
specified version from the path JSON
- Replace get_latest_manifest() with get_current_manifest() after
beginning transaction at the target version
- Update Go FFI binding to call get_column_groups_by_version instead of
get_latest_column_groups
- Remove unused GetManifest function from util.cpp/util.h
- Bump milvus-storage version from 5fff4f5 to 33bf815

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-12-05 11:45:11 +08:00 committed by GitHub
parent 1372e84d7f
commit 3daff1ab2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 64 deletions

View File

@ -250,44 +250,6 @@ ToCStorageConfig(const milvus::storage::StorageConfig& config) {
config.max_connections}; config.max_connections};
} }
std::string
GetManifest(const std::string& path,
const std::shared_ptr<Properties>& properties) {
try {
// Parse the JSON string
json j = json::parse(path);
// Extract base_path
std::string base_path = j.at("base_path").get<std::string>();
ColumnGroupsHandle out_column_groups = 0;
int64_t out_read_version = 0;
FFIResult result = get_latest_column_groups(base_path.c_str(),
properties.get(),
&out_column_groups,
&out_read_version);
if (!IsSuccess(&result)) {
auto message = GetErrorMessage(&result);
// Copy the error message before freeing the FFIResult
std::string error_msg = message ? message : "Unknown error";
FreeFFIResult(&result);
throw std::runtime_error(error_msg);
}
FreeFFIResult(&result);
return {out_column_groups};
} catch (const json::parse_error& e) {
throw std::runtime_error(
std::string("Failed to parse manifest JSON: ") + e.what());
} catch (const json::out_of_range& e) {
throw std::runtime_error(
std::string("Missing required field in manifest: ") + e.what());
} catch (const json::type_error& e) {
throw std::runtime_error(
std::string("Invalid field type in manifest: ") + e.what());
}
}
std::shared_ptr<milvus_storage::api::ColumnGroups> std::shared_ptr<milvus_storage::api::ColumnGroups>
GetColumnGroups( GetColumnGroups(
const std::string& path, const std::string& path,
@ -296,20 +258,24 @@ GetColumnGroups(
// Parse the JSON string // Parse the JSON string
json j = json::parse(path); json j = json::parse(path);
// Extract base_path // Extract base_path & version
std::string base_path = j.at("base_path").get<std::string>(); std::string base_path = j.at("base_path").get<std::string>();
int64_t version = j.at("ver").get<int64_t>();
// TODO fetch manifest based on version after api supported
auto transaction = auto transaction =
std::make_unique<milvus_storage::api::transaction::TransactionImpl< std::make_unique<milvus_storage::api::transaction::TransactionImpl<
milvus_storage::api::ColumnGroups>>(*properties, base_path); milvus_storage::api::ColumnGroups>>(*properties, base_path);
auto latest_manifest_result = transaction->get_latest_manifest(); auto status = transaction->begin(version);
if (!latest_manifest_result.ok()) { if (!status.ok()) {
throw( throw(std::runtime_error(status.ToString()));
std::runtime_error(latest_manifest_result.status().ToString()));
} }
auto latest_manifest = latest_manifest_result.ValueOrDie(); auto current_manifest_result = transaction->get_current_manifest();
return latest_manifest; if (!current_manifest_result.ok()) {
throw(std::runtime_error(
current_manifest_result.status().ToString()));
}
auto current_manifest = current_manifest_result.ValueOrDie();
return current_manifest;
} catch (const json::parse_error& e) { } catch (const json::parse_error& e) {
throw std::runtime_error( throw std::runtime_error(
std::string("Failed to parse manifest JSON: ") + e.what()); std::string("Failed to parse manifest JSON: ") + e.what());

View File

@ -76,21 +76,6 @@ MakeInternalLocalProperies(const char* c_path);
CStorageConfig CStorageConfig
ToCStorageConfig(const milvus::storage::StorageConfig& config); ToCStorageConfig(const milvus::storage::StorageConfig& config);
/**
* @brief Retrieve manifest/column groups from storage via FFI
*
* Parses the manifest path JSON to extract base_path and version,
* then fetches the latest column groups from storage using FFI.
*
* @param path JSON string containing "base_path" and "ver" fields
* @param properties Storage properties for accessing the manifest
* @return JSON string containing column groups information
* @throws std::runtime_error If JSON parsing fails or FFI call fails
*/
std::string
GetManifest(const std::string& path,
const std::shared_ptr<Properties>& properties);
/** /**
* @brief Retrieve ColumnGroups metadata from manifest path * @brief Retrieve ColumnGroups metadata from manifest path
* *

View File

@ -14,7 +14,7 @@
# Update milvus-storage_VERSION for the first occurrence # Update milvus-storage_VERSION for the first occurrence
milvus_add_pkg_config("milvus-storage") milvus_add_pkg_config("milvus-storage")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES "") set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES "")
set( milvus-storage_VERSION 5fff4f5) set( milvus-storage_VERSION 33bf815)
set( GIT_REPOSITORY "https://github.com/milvus-io/milvus-storage.git") set( GIT_REPOSITORY "https://github.com/milvus-io/milvus-storage.git")
message(STATUS "milvus-storage repo: ${GIT_REPOSITORY}") message(STATUS "milvus-storage repo: ${GIT_REPOSITORY}")
message(STATUS "milvus-storage version: ${milvus-storage_VERSION}") message(STATUS "milvus-storage version: ${milvus-storage_VERSION}")

View File

@ -202,8 +202,7 @@ func GetColumnGroups(manifestPath string, storageConfig *indexpb.StorageConfig)
cBasePath := C.CString(basePath) cBasePath := C.CString(basePath)
defer C.free(unsafe.Pointer(cBasePath)) defer C.free(unsafe.Pointer(cBasePath))
var cVersion C.int64_t result := C.get_column_groups_by_version(cBasePath, cProperties, C.int64_t(version), &cColumnGroups)
result := C.get_latest_column_groups(cBasePath, cProperties, &cColumnGroups, &cVersion)
err = HandleFFIResult(result) err = HandleFFIResult(result)
if err != nil { if err != nil {
return cColumnGroups, err return cColumnGroups, err