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

Restore the MVCC functionality. #10

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2f441dc
enhance: [skip e2e]increase timeout for image build (#29083)
yellow-shine Jan 5, 2024
23183ff
feat: Add import reader for json (#29252)
bigsheeper Jan 5, 2024
a0cec40
fix: make the entity num metric accurate (#29643)
yah01 Jan 5, 2024
5be9099
enhance: add MockSerializer generation command into Makefile (#29713)
congqixia Jan 5, 2024
b5f039a
fix: Assertion all async invocations in test case (#29737)
congqixia Jan 7, 2024
5dc300c
fix: Fix bug for pk index doesn't have raw data (#29711)
xiaocai2333 Jan 7, 2024
156a0dd
feat: Add import reader for Parquet (#29618)
bigsheeper Jan 7, 2024
635a7f7
feat: add clustering key in create/describe collection (#29506)
wayblink Jan 7, 2024
271edc6
fix: throw exception when upload file failed for DiskIndex (#29627)
foxspy Jan 7, 2024
4b3de64
enhance: add rust to install_dep.sh (#29586)
longjiquan Jan 7, 2024
a3bae80
enhance: print total memory when milvus starts (#29351)
longjiquan Jan 7, 2024
d07197a
enhance: add compare simd function (#29432)
zhagnlu Jan 7, 2024
20fb847
enhance: load delta logs concurrently (#29623)
longjiquan Jan 7, 2024
e9f3df3
fix: inverted index file not found (#29695)
longjiquan Jan 7, 2024
cd34de7
enhance:[skip e2e] use docker pugin to do same thing instead (#29667)
yellow-shine Jan 8, 2024
fe47dee
fix: Set & Return correct SegmentLevel in querynode segment manager (…
congqixia Jan 8, 2024
7e6f73a
feat: Authorize users to query grant info of their roles (#29747)
czs007 Jan 8, 2024
9702cef
feat: Support multiple vector search (#29433)
xige-16 Jan 8, 2024
97e4ec5
enhance: use random root path for minio unit tests (#29753)
yah01 Jan 8, 2024
b9d76f7
Restore the MVCC functionality.
czs007 Dec 27, 2023
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
42 changes: 25 additions & 17 deletions .github/workflows/publish-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ jobs:
id: extracter
run: |
echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=sha_short::$(git rev-parse --short=7 HEAD)"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
milvusdb/milvus-env
tags: |
type=raw,enable=true,value=${{ matrix.os }}-{{date 'YYYYMMDD'}}-{{sha}}
type=raw,enable=true,value=${{ matrix.os }}-latest
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- name: Set up QEMU
Expand All @@ -59,25 +68,24 @@ jobs:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
if: success() && github.event_name == 'pull_request' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker buildx ls
docker buildx build --platform linux/amd64,linux/arm64 -t milvusdb/milvus-env:${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
- name: Docker Build&Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker buildx ls
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-latest -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
file: build/docker/builder/cpu/${{ matrix.os }}/Dockerfile
- name: Bump Builder Version
uses: ./.github/actions/bump-builder-version
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
with:
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
type: cpu
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
49 changes: 27 additions & 22 deletions .github/workflows/publish-gpu-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,38 @@ jobs:
id: extracter
run: |
echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=sha_short::$(git rev-parse --short=7 HEAD)"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
milvusdb/milvus-env
tags: |
type=raw,enable=true,value=${{ matrix.os }}-{{date 'YYYYMMDD'}}-{{sha}}
type=raw,enable=true,value=${{ matrix.os }}-latest
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- name: Docker Build
if: success() && github.event_name == 'pull_request' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker info
docker build -t milvusdb/milvus-env:gpu-${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/gpu/${OS_NAME}/Dockerfile .
- name: Docker Build&Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker info
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
# Building the first image
docker build -t milvusdb/milvus-env:gpu-${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/gpu/${OS_NAME}/Dockerfile .
docker push milvusdb/milvus-env:gpu-${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}

# Building the second image
docker build -t milvusdb/milvus-env:gpu-${OS_NAME}-latest -f build/docker/builder/gpu/${OS_NAME}/Dockerfile .
docker push milvusdb/milvus-env:gpu-${OS_NAME}-latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
file: build/docker/builder/gpu/${{ matrix.os }}/Dockerfile
- name: Bump Builder Version
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
uses: ./.github/actions/bump-builder-version
with:
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
type: gpu
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ generate-mockery-datanode: getdeps
$(INSTALL_PATH)/mockery --name=MetaCache --dir=$(PWD)/internal/datanode/metacache --output=$(PWD)/internal/datanode/metacache --filename=mock_meta_cache.go --with-expecter --structname=MockMetaCache --outpkg=metacache --inpackage
$(INSTALL_PATH)/mockery --name=SyncManager --dir=$(PWD)/internal/datanode/syncmgr --output=$(PWD)/internal/datanode/syncmgr --filename=mock_sync_manager.go --with-expecter --structname=MockSyncManager --outpkg=syncmgr --inpackage
$(INSTALL_PATH)/mockery --name=MetaWriter --dir=$(PWD)/internal/datanode/syncmgr --output=$(PWD)/internal/datanode/syncmgr --filename=mock_meta_writer.go --with-expecter --structname=MockMetaWriter --outpkg=syncmgr --inpackage
$(INSTALL_PATH)/mockery --name=Serializer --dir=$(PWD)/internal/datanode/syncmgr --output=$(PWD)/internal/datanode/syncmgr --filename=mock_serializer.go --with-expecter --structname=MockSerializer --outpkg=syncmgr --inpackage
$(INSTALL_PATH)/mockery --name=WriteBuffer --dir=$(PWD)/internal/datanode/writebuffer --output=$(PWD)/internal/datanode/writebuffer --filename=mock_write_buffer.go --with-expecter --structname=MockWriteBuffer --outpkg=writebuffer --inpackage
$(INSTALL_PATH)/mockery --name=BufferManager --dir=$(PWD)/internal/datanode/writebuffer --output=$(PWD)/internal/datanode/writebuffer --filename=mock_mananger.go --with-expecter --structname=MockBufferManager --outpkg=writebuffer --inpackage
$(INSTALL_PATH)/mockery --name=BinlogIO --dir=$(PWD)/internal/datanode/io --output=$(PWD)/internal/datanode/io --filename=mock_binlogio.go --with-expecter --structname=MockBinlogIO --outpkg=io --inpackage
Expand Down
2 changes: 1 addition & 1 deletion ci/jenkins/PublishImages.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pipeline {

options {
timestamps()
timeout(time: 100, unit: 'MINUTES')
timeout(time: 200, unit: 'MINUTES')
// parallelsAlwaysFailFast()
disableConcurrentBuilds()
}
Expand Down
10 changes: 10 additions & 0 deletions cmd/milvus/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"go.uber.org/zap"

"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/hardware"
"github.com/milvus-io/milvus/pkg/util/metricsinfo"
)

Expand All @@ -36,6 +37,7 @@ func (c *run) execute(args []string, flags *flag.FlagSet) {

c.printBanner(flags.Output())
c.injectVariablesToEnv()
c.printHardwareInfo(flags.Output())
lock, err := createPidFile(flags.Output(), filename, runtimeDir)
if err != nil {
panic(err)
Expand All @@ -59,6 +61,14 @@ func (c *run) printBanner(w io.Writer) {
fmt.Fprintln(w)
}

func (c *run) printHardwareInfo(w io.Writer) {
totalMem := hardware.GetMemoryCount()
usedMem := hardware.GetUsedMemoryCount()
fmt.Fprintf(w, "TotalMem: %d\n", totalMem)
fmt.Fprintf(w, "UsedMem: %d\n", usedMem)
fmt.Fprintln(w)
}

func (c *run) injectVariablesToEnv() {
// inject in need

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/klauspost/compress v1.16.7
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231228051838-b5442d755fa4
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231229025438-39bce6abb18f
github.com/minio/minio-go/v7 v7.0.61
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/le
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231228051838-b5442d755fa4 h1:nxIohfJOCMbixFAC3q4Lclmv0xg/8q6D8T7D8l258To=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231228051838-b5442d755fa4/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231229025438-39bce6abb18f h1:8lNcRqhQgUROtmtiIEdpQHGW82KMI5oASVKxkaZ/tBg=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20231229025438-39bce6abb18f/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
github.com/milvus-io/milvus-storage/go v0.0.0-20231109072809-1cd7b0866092 h1:UYJ7JB+QlMOoFHNdd8mUa3/lV63t9dnBX7ILXmEEWPY=
github.com/milvus-io/milvus-storage/go v0.0.0-20231109072809-1cd7b0866092/go.mod h1:GPETMcTZq1gLY1WA6Na5kiNAKnq8SEMMiVKUZrM3sho=
github.com/milvus-io/pulsar-client-go v0.6.10 h1:eqpJjU+/QX0iIhEo3nhOqMNXL+TyInAs1IAHZCrCM/A=
Expand Down
2 changes: 1 addition & 1 deletion internal/core/run_clang_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi
CorePath=$1

formatThis() {
find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | xargs clang-format-10 -i
find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs clang-format-10 -i
}

formatThis "${CorePath}/src"
Expand Down
21 changes: 20 additions & 1 deletion internal/core/src/exec/expression/CompareExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "common/Vector.h"
#include "exec/expression/Expr.h"
#include "segcore/SegmentInterface.h"
#include "simd/interface.h"

namespace milvus {
namespace exec {
Expand All @@ -41,7 +42,7 @@ using ChunkDataAccessor = std::function<const number(int)>;
template <typename T, typename U, proto::plan::OpType op>
struct CompareElementFunc {
void
operator()(const T* left, const U* right, size_t size, bool* res) {
operator_base(const T* left, const U* right, size_t size, bool* res) {
for (int i = 0; i < size; ++i) {
if constexpr (op == proto::plan::OpType::Equal) {
res[i] = left[i] == right[i];
Expand All @@ -63,6 +64,24 @@ struct CompareElementFunc {
}
}
}

void
operator()(const T* left, const U* right, size_t size, bool* res) {
#if defined(USE_DYNAMIC_SIMD)
if constexpr (std::is_same_v<T, U>) {
milvus::simd::compare_col_func<T>(
static_cast<milvus::simd::CompareType>(op),
left,
right,
size,
res);
} else {
operator_base(left, right, size, res);
}
#else
operator_base(left, right, size, res);
#endif
}
};

class PhyCompareFilterExpr : public Expr {
Expand Down
16 changes: 14 additions & 2 deletions internal/core/src/index/InvertedIndexTantivy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,20 @@ BinarySet
InvertedIndexTantivy<T>::Upload(const Config& config) {
finish();

for (const auto& entry : std::filesystem::directory_iterator(path_)) {
disk_file_manager_->AddFile(entry.path());
boost::filesystem::path p(path_);
boost::filesystem::directory_iterator end_iter;

for (boost::filesystem::directory_iterator iter(p); iter != end_iter;
iter++) {
if (boost::filesystem::is_directory(*iter)) {
LOG_WARN("{} is a directory", iter->path().string());
} else {
LOG_INFO("trying to add index file: {}", iter->path().string());
AssertInfo(disk_file_manager_->AddFile(iter->path().string()),
"failed to add index file: {}",
iter->path().string());
LOG_INFO("index file: {} added", iter->path().string());
}
}

BinarySet ret;
Expand Down
6 changes: 5 additions & 1 deletion internal/core/src/index/VectorDiskIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ template <typename T>
BinarySet
VectorDiskAnnIndex<T>::Upload(const Config& config) {
BinarySet ret;
index_.Serialize(ret);
auto stat = index_.Serialize(ret);
if (stat != knowhere::Status::success) {
PanicInfo(ErrorCode::UnexpectedError,
"failed to serialize index, " + KnowhereStatusString(stat));
}
auto remote_paths_to_size = file_manager_->GetRemotePathsToFileSize();
for (auto& file : remote_paths_to_size) {
ret.Append(file.first, nullptr, file.second);
Expand Down
21 changes: 0 additions & 21 deletions internal/core/src/query/visitors/ExecExprVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2632,30 +2632,9 @@ ExecExprVisitor::ExecTermVisitorImplTemplate(TermExpr& expr_raw) -> BitsetType {
return index->In(n, terms.data());
};

#if defined(USE_DYNAMIC_SIMD)
std::function<bool(MayConstRef<T> x)> elem_func;
if (n <= milvus::simd::TERM_EXPR_IN_SIZE_THREAD) {
elem_func = [&terms, &term_set, n](MayConstRef<T> x) {
if constexpr (std::is_integral<T>::value ||
std::is_floating_point<T>::value) {
return milvus::simd::find_term_func<T>(terms.data(), n, x);
} else {
// For string type, simd performance not better than set mode
static_assert(std::is_same<T, std::string>::value ||
std::is_same<T, std::string_view>::value);
return term_set.find(x) != term_set.end();
}
};
} else {
elem_func = [&term_set, n](MayConstRef<T> x) {
return term_set.find(x) != term_set.end();
};
}
#else
auto elem_func = [&term_set](MayConstRef<T> x) {
return term_set.find(x) != term_set.end();
};
#endif

auto default_skip_index_func = [&](const SkipIndex& skipIndex,
FieldId fieldId,
Expand Down
10 changes: 10 additions & 0 deletions internal/core/src/segcore/SegmentGrowingImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ class SegmentGrowingImpl : public SegmentGrowing {
void
check_search(const query::Plan* plan) const override {
Assert(plan);
auto& metric_str = plan->plan_node_->search_info_.metric_type_;
auto searched_field_id = plan->plan_node_->search_info_.field_id_;
auto index_meta =
index_meta_->GetFieldIndexMeta(FieldId(searched_field_id));
if (metric_str.empty()) {
metric_str = index_meta.GeMetricType();
} else {
AssertInfo(metric_str == index_meta.GeMetricType(),
"metric type not match");
}
}

const ConcurrentVector<Timestamp>&
Expand Down
5 changes: 3 additions & 2 deletions internal/core/src/segcore/SegmentInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ SegmentInternalInterface::FillTargetEntry(const query::Plan* plan,
std::unique_ptr<SearchResult>
SegmentInternalInterface::Search(
const query::Plan* plan,
const query::PlaceholderGroup* placeholder_group) const {
const query::PlaceholderGroup* placeholder_group,
Timestamp timestamp) const {
std::shared_lock lck(mutex_);
milvus::tracer::AddEvent("obtained_segment_lock_mutex");
check_search(plan);
query::ExecPlanNodeVisitor visitor(*this, 1L << 63, placeholder_group);
query::ExecPlanNodeVisitor visitor(*this, timestamp, placeholder_group);
auto results = std::make_unique<SearchResult>();
*results = visitor.get_moved_result(*plan->plan_node_);
results->segment_ = (void*)this;
Expand Down
6 changes: 4 additions & 2 deletions internal/core/src/segcore/SegmentInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class SegmentInterface {

virtual std::unique_ptr<SearchResult>
Search(const query::Plan* Plan,
const query::PlaceholderGroup* placeholder_group) const = 0;
const query::PlaceholderGroup* placeholder_group,
Timestamp timestamp) const = 0;

virtual std::unique_ptr<proto::segcore::RetrieveResults>
Retrieve(const query::RetrievePlan* Plan,
Expand Down Expand Up @@ -136,7 +137,8 @@ class SegmentInternalInterface : public SegmentInterface {

std::unique_ptr<SearchResult>
Search(const query::Plan* Plan,
const query::PlaceholderGroup* placeholder_group) const override;
const query::PlaceholderGroup* placeholder_group,
Timestamp timestamp) const override;

void
FillPrimaryKeys(const query::Plan* plan,
Expand Down
Loading
Loading