diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index e2e7427743..5cc90d2db7 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -36,6 +36,7 @@ #include "meta/MetaFactory.h" #include "meta/SqliteMetaImpl.h" #include "metrics/Metrics.h" +#include "scheduler/Definition.h" #include "scheduler/SchedInst.h" #include "scheduler/job/BuildIndexJob.h" #include "scheduler/job/DeleteJob.h" @@ -1214,6 +1215,13 @@ DBImpl::QueryAsync(const std::shared_ptr& context, const meta:: milvus::server::ContextChild tracer(context, "Query Async"); server::CollectQueryMetrics metrics(vectors.vector_count_); + if (files.size() > milvus::scheduler::TASK_TABLE_MAX_COUNT) { + std::string msg = + "Search files count exceed scheduler limit: " + std::to_string(milvus::scheduler::TASK_TABLE_MAX_COUNT); + ENGINE_LOG_ERROR << msg; + return Status(DB_ERROR, msg); + } + TimeRecorder rc(""); // step 1: construct search job diff --git a/core/src/scheduler/Definition.h b/core/src/scheduler/Definition.h index 6c32d6e0c1..10526804c9 100644 --- a/core/src/scheduler/Definition.h +++ b/core/src/scheduler/Definition.h @@ -8,6 +8,7 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License // is distributed on an "AS IS" BASIS, 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 #include @@ -35,5 +36,7 @@ using EngineFactory = engine::EngineFactory; using EngineType = engine::EngineType; using MetricType = engine::MetricType; +constexpr uint64_t TASK_TABLE_MAX_COUNT = 1ULL << 16ULL; + } // namespace scheduler } // namespace milvus diff --git a/core/src/scheduler/TaskTable.h b/core/src/scheduler/TaskTable.h index 1dfb13efe0..43f2b55af3 100644 --- a/core/src/scheduler/TaskTable.h +++ b/core/src/scheduler/TaskTable.h @@ -97,7 +97,7 @@ struct TaskTableItem : public interface::dumpable { class TaskTable : public interface::dumpable { public: - TaskTable() : table_(1ULL << 16ULL) { + TaskTable() : table_(TASK_TABLE_MAX_COUNT) { } TaskTable(const TaskTable&) = delete;