fix: some minor bugs (#370)

This commit is contained in:
Qinren Zhou 2026-04-23 16:24:59 +08:00 committed by GitHub
parent 2b16ed39cd
commit 4e7fa0f37f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 21 additions and 19 deletions

View File

@ -32,7 +32,7 @@
<a href="https://x.com/ZvecAI">🐦 <strong>X (Twitter)</strong> </a>
</p>
**Zvec** is an open-source, in-process vector database — lightweight, lightning-fast, and designed to embed directly into applications. Built on **Proxima** (Alibaba's battle-tested vector search engine), it delivers production-grade, low-latency, scalable similarity search with minimal setup.
**Zvec** is an open-source, in-process vector database — lightweight, lightning-fast, and designed to embed directly into applications. Battle-tested within Alibaba Group, it delivers production-grade, low-latency and scalable similarity search with minimal setup.
> [!Important]
> 🚀 **v0.3.1 (Apr 17, 2026)**

View File

@ -624,10 +624,11 @@ Status CollectionImpl::execute_tasks(
Status CollectionImpl::DropIndex(const std::string &column_name) {
CHECK_COLLECTION_READONLY_RETURN_STATUS;
CHECK_DESTROY_RETURN_STATUS(destroyed_, false);
std::lock_guard lock(schema_handle_mtx_);
CHECK_DESTROY_RETURN_STATUS(destroyed_, false);
auto new_schema = std::make_shared<CollectionSchema>(*schema_);
auto s = new_schema->drop_index(column_name);
CHECK_RETURN_STATUS(s);
@ -1548,8 +1549,6 @@ Status CollectionImpl::DeleteByFilter(const std::string &filter) {
CHECK_DESTROY_RETURN_STATUS(destroyed_, false);
auto segments = get_all_segments();
VectorQuery query;
query.filter_ = filter;
query.topk_ = INT32_MAX;

View File

@ -79,7 +79,8 @@ class ConcurrentRoaringBitmap32 {
std::shared_lock<std::shared_mutex> lock(mutex_);
uint64_t max_rank{0}, min_rank{0};
max_rank = roaring_bitmap_rank(bitmap_, max_doc_id);
min_rank = roaring_bitmap_rank(bitmap_, min_doc_id - 1);
min_rank =
min_doc_id == 0 ? 0 : roaring_bitmap_rank(bitmap_, min_doc_id - 1);
return max_rank - min_rank;
}

View File

@ -123,8 +123,10 @@ PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidCollectionName, 2042,
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidPartitionName, 2043,
"Invalid partition name");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidFieldName, 2044, "Invalid field name");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidChannelCount, 2045, "Invalid field name");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidReplicaCount, 2046, "Invalid field name");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidChannelCount, 2045,
"Invalid channel count");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidReplicaCount, 2046,
"Invalid replica count");
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidJson, 2047, "Invalid json");
// used by master
PROXIMA_ZVEC_ERROR_CODE_DEFINE(InvalidClusterConfig, 2048,

View File

@ -144,8 +144,6 @@ PROXIMA_ZVEC_ERROR_CODE_DECLARE(UnreadyQueue);
PROXIMA_ZVEC_ERROR_CODE_DECLARE(ScheduleError);
PROXIMA_ZVEC_ERROR_CODE_DECLARE(TaskIsRunning);
PROXIMA_ZVEC_ERROR_CODE_DECLARE(DirectoryAlreadyExists);
PROXIMA_ZVEC_ERROR_CODE_DECLARE(DirectoryNotExists);
// 2000~2999 [Client Check]
PROXIMA_ZVEC_ERROR_CODE_DECLARE(EmptyCollectionName);

View File

@ -41,7 +41,7 @@ enum class FileID : uint32_t {
/*
* File name coresponding to file id
*/
static const char *GetFileName(FileID t) {
inline const char *GetFileName(FileID t) {
switch (t) {
case FileID::ID_FILE:
return "idmap";

View File

@ -13,12 +13,12 @@
// limitations under the License.
#include "rocksdb_context.h"
#include <rocksdb/filter_policy.h>
#include <rocksdb/statistics.h>
#include <rocksdb/table.h>
#include <rocksdb/utilities/checkpoint.h>
#include <zvec/ailego/logger/logger.h>
#include "rocksdb_context.h"
namespace zvec {

View File

@ -11,6 +11,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
namespace zvec {

View File

@ -323,8 +323,8 @@ class Doc {
private:
std::string pk_;
float score_{0.0f};
uint64_t doc_id_;
Operator op_;
uint64_t doc_id_{0};
Operator op_{Operator::INSERT};
template <typename T>
static constexpr bool is_valid_type_v =
@ -341,17 +341,17 @@ class Doc {
std::is_same_v<T, std::vector<int8_t>> || // 10
std::is_same_v<T, std::vector<int16_t>> || // 11
std::is_same_v<T, std::vector<int32_t>> || // 12
std::is_same_v<T, std::vector<uint32_t>> || // 13
std::is_same_v<T, std::vector<int64_t>> || // 14
std::is_same_v<T, std::vector<int64_t>> || // 13
std::is_same_v<T, std::vector<uint32_t>> || // 14
std::is_same_v<T, std::vector<uint64_t>> || // 15
std::is_same_v<T, std::vector<float16_t>> || // 16
std::is_same_v<T, std::vector<float>> || // 17
std::is_same_v<T, std::vector<double>> || // 18
std::is_same_v<T, std::vector<std::string>> || // 19
std::is_same_v<
T, std::pair<std::vector<uint32_t>, std::vector<float16_t>>> || // 20
T, std::pair<std::vector<uint32_t>, std::vector<float>>> || // 20
std::is_same_v<
T, std::pair<std::vector<uint32_t>, std::vector<float>>>; // 21
T, std::pair<std::vector<uint32_t>, std::vector<float16_t>>>; // 21
std::unordered_map<std::string, Value> fields_;
};

View File

@ -17,11 +17,11 @@
namespace zvec {
const uint32_t DEFAULT_MAX_BUFFER_SIZE = 64 * 1024 * 1024; // 128M
const uint32_t DEFAULT_MAX_BUFFER_SIZE = 64 * 1024 * 1024; // 64M
struct CollectionOptions {
bool read_only_{false};
bool enable_mmap_{true}; // ignnored when load collection
bool enable_mmap_{true}; // ignored when load collection
uint32_t max_buffer_size_{
DEFAULT_MAX_BUFFER_SIZE}; // ignored when read_only=true