refactor: disable diskann index create on open (#479)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <zvec/db/schema.h>
|
||||
#include <zvec/db/status.h>
|
||||
#include <zvec/db/type.h>
|
||||
#include <zvec/plugin/diskann_plugin.h>
|
||||
#include "ailego/internal/cpu_features.h"
|
||||
#include "db/common/constants.h"
|
||||
#include "db/common/typedef.h"
|
||||
@@ -172,6 +173,33 @@ Status FieldSchema::validate() const {
|
||||
}
|
||||
}
|
||||
|
||||
if (index_params_->type() == IndexType::DISKANN) {
|
||||
// Probe the DiskAnn runtime eagerly at creation time so unsupported
|
||||
// platforms (non Linux x86_64), missing libaio, or a missing plugin
|
||||
// .so fail fast with a clear message instead of surfacing later during
|
||||
// optimize(). This reuses the same gate DiskAnnIndex applies on first
|
||||
// use (zvec::LoadDiskAnnPlugin, wrapped by EnsureDiskAnnRuntimeReady).
|
||||
// All validate() call sites are creation-time only, so triggering the
|
||||
// plugin load here is safe (and idempotent/cached).
|
||||
const int rc = ::zvec::LoadDiskAnnPlugin();
|
||||
switch (rc) {
|
||||
case kDiskAnnPluginOk:
|
||||
break;
|
||||
case kDiskAnnPluginUnsupportedPlatform:
|
||||
return Status::NotSupported(
|
||||
"DiskAnn is not supported on this platform (Linux x86_64 "
|
||||
"only)");
|
||||
case kDiskAnnPluginLibAioMissing:
|
||||
return Status::NotSupported(
|
||||
"DiskAnn requires libaio at runtime, but it was not found on "
|
||||
"this host. Install it (e.g. 'apt-get install libaio1', or "
|
||||
"'libaio1t64' on Ubuntu 24.04+) and retry.");
|
||||
default:
|
||||
return Status::NotSupported(
|
||||
"DiskAnn runtime could not be initialized on this host");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vector_index_params->quantize_type() != QuantizeType::UNDEFINED) {
|
||||
auto iter = quantize_type_map.find(data_type_);
|
||||
|
||||
Reference in New Issue
Block a user