This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch topn-entity in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit 58d9aaf3ebdf9a9fad381009683c1d5c9250d27e Author: Gao Hongtao <hanahm...@gmail.com> AuthorDate: Tue May 14 07:55:44 2024 +0800 Fix topn query nil and add more context to err Signed-off-by: Gao Hongtao <hanahm...@gmail.com> --- banyand/internal/storage/index.go | 6 +- banyand/query/processor_topn.go | 1 + dist/LICENSE | 1 + dist/licenses/ui-licenses/license-fsevents.txt | 22 ++++++ pkg/index/index.go | 18 +++++ test/stress/vm/Makefile | 38 +++++++++++ test/stress/vm/docker-compose.yaml | 95 ++++++++++++++++++++++++++ ui/LICENSE | 1 + 8 files changed, 181 insertions(+), 1 deletion(-) diff --git a/banyand/internal/storage/index.go b/banyand/internal/storage/index.go index ce67627e..950d1640 100644 --- a/banyand/internal/storage/index.go +++ b/banyand/internal/storage/index.go @@ -101,7 +101,11 @@ func (s *seriesIndex) searchPrimary(ctx context.Context, series []*pbv1.Series) if err != nil { return nil, err } - return convertIndexSeriesToSeriesList(ss) + result, err := convertIndexSeriesToSeriesList(ss) + if err != nil { + return nil, errors.WithMessagef(err, "failed to convert index series to series list, matchers: %v, result:%v", seriesMatchers, ss) + } + return result, nil } var emptySeriesMatcher = index.SeriesMatcher{} diff --git a/banyand/query/processor_topn.go b/banyand/query/processor_topn.go index 8e64169f..99dc8b42 100644 --- a/banyand/query/processor_topn.go +++ b/banyand/query/processor_topn.go @@ -121,6 +121,7 @@ func (t *topNQueryProcessor) Rev(message bus.Message) (resp bus.Message) { if err != nil { ml.Error().Err(err).RawJSON("req", logger.Proto(request)).Msg("fail to close the topn plan") resp = bus.NewMessage(bus.MessageID(now), common.NewError("fail to execute the topn plan for measure %s: %v", topNMetadata.GetName(), err)) + return } defer func() { if err = mIterator.Close(); err != nil { diff --git a/dist/LICENSE b/dist/LICENSE index 71b7afc8..82862748 100644 --- a/dist/LICENSE +++ b/dist/LICENSE @@ -470,6 +470,7 @@ MIT licenses fill-range 7.0.1 MIT follow-redirects 1.15.6 MIT form-data 4.0.0 MIT + fsevents 2.3.3 MIT immutable 4.3.5 MIT is-binary-path 2.1.0 MIT is-extglob 2.1.1 MIT diff --git a/dist/licenses/ui-licenses/license-fsevents.txt b/dist/licenses/ui-licenses/license-fsevents.txt new file mode 100644 index 00000000..5d70441c --- /dev/null +++ b/dist/licenses/ui-licenses/license-fsevents.txt @@ -0,0 +1,22 @@ +MIT License +----------- + +Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/pkg/index/index.go b/pkg/index/index.go index 106ccaa4..92b5efa3 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -237,6 +237,10 @@ type Series struct { ID common.SeriesID } +func (s Series) String() string { + return fmt.Sprintf("%s:%d", s.EntityValues, s.ID) +} + // SeriesStore is an abstract of a series repository. type SeriesStore interface { Store @@ -262,6 +266,20 @@ type SeriesMatcher struct { Type SeriesMatcherType } +// String returns a string representation of the series matcher. +func (s SeriesMatcher) String() string { + switch s.Type { + case SeriesMatcherTypeExact: + return fmt.Sprintf("exact:%s", s.Match) + case SeriesMatcherTypePrefix: + return fmt.Sprintf("prefix:%s", s.Match) + case SeriesMatcherTypeWildcard: + return fmt.Sprintf("wildcard:%s", s.Match) + default: + return fmt.Sprintf("unknown:%s", s.Match) + } +} + // GetSearcher returns a searcher associated with input index rule type. type GetSearcher func(location databasev1.IndexRule_Type) (Searcher, error) diff --git a/test/stress/vm/Makefile b/test/stress/vm/Makefile new file mode 100644 index 00000000..43eb4a21 --- /dev/null +++ b/test/stress/vm/Makefile @@ -0,0 +1,38 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +NAME := vm + +CLI_ARGS := + +ifdef PROFILE + CLI_ARGS := $(CLI_ARGS) --profile $(PROFILE) +endif + +cli_env := DOCKER_BUILDKIT=1 USER_ID=$(shell id -u) GROUP_ID=$(shell id -g) + +.PHONY: clean +clean: + rm -rf /tmp/banyandb-stress-vm + +up: clean + $(cli_env) docker compose -f docker-compose.yaml $(CLI_ARGS) up --build + +down: + docker compose -f docker-compose.yaml down + \ No newline at end of file diff --git a/test/stress/vm/docker-compose.yaml b/test/stress/vm/docker-compose.yaml new file mode 100644 index 00000000..102e5197 --- /dev/null +++ b/test/stress/vm/docker-compose.yaml @@ -0,0 +1,95 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +version: '3.8' +services: + change-vol-ownership: + image: ubuntu + user: "root" + group_add: + - '${GROUP_ID}' + volumes: + - /tmp/banyandb-stress-vm:/tmp/change-ownership + command: chown -R ${USER_ID}:${GROUP_ID} /tmp/change-ownership + + banyandb: + user: "${USER_ID}:${GROUP_ID}" + extends: + file: ../../docker/base-compose.yml + service: banyandb + build: + dockerfile: ./docker/Dockerfile + context: ../../.. + volumes: + - /tmp/banyandb-stress-vm:/tmp:rw,delgated + ports: + - 17913:17913 + - 6060:6060 + - 2121:2121 + networks: + - skywalking + depends_on: + change-vol-ownership: + condition: service_completed_successfully + + oap: + container_name: skywalking-server-bdb + image: ${OAP_IMAGE:-ghcr.io/apache/skywalking/oap:latest} + ports: + - "11800:11800" + - "12800:12800" + - "9099:9090" + - "3100:3100" + networks: + - skywalking + healthcheck: + test: [ "CMD-SHELL", "curl http://localhost:12800/internal/l7check" ] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s +# restart: always + environment: &oap-env + TZ: Europe/Moscow + SW_HEALTH_CHECKER: default + SW_OTEL_RECEIVER: default + SW_OTEL_RECEIVER_ENABLED_OC_RULES: vm + SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm + SW_TELEMETRY: prometheus + JAVA_OPTS: "-Xms2048m -Xmx2048m" + SW_STORAGE: banyandb + SW_STORAGE_BANYANDB_TARGETS: banyandb:17912 + SW_CORE_RECORD_DATA_TTL: 14 # https://skywalking.apache.org/docs/main/next/en/setup/backend/ttl/ + SW_CORE_METRICS_DATA_TTL: 14 + SW_DCS_MAX_INBOUND_MESSAGE_SIZE: 5000000000 + depends_on: + banyandb: + condition: service_healthy + + ui: + image: ${UI_IMAGE:-ghcr.io/apache/skywalking/ui:latest} + container_name: skywalking-ui + ports: + - "1010:8080" + networks: + - skywalking + restart: always + environment: + <<: *oap-env + SW_OAP_ADDRESS: http://skywalking-server-bdb:12800 + SW_ZIPKIN_ADDRESS: http://skywalking-server-bdb:9412 + +networks: + skywalking: \ No newline at end of file diff --git a/ui/LICENSE b/ui/LICENSE index 44f625a2..51eccea3 100644 --- a/ui/LICENSE +++ b/ui/LICENSE @@ -92,6 +92,7 @@ MIT licenses fill-range 7.0.1 MIT follow-redirects 1.15.6 MIT form-data 4.0.0 MIT + fsevents 2.3.3 MIT immutable 4.3.5 MIT is-binary-path 2.1.0 MIT is-extglob 2.1.1 MIT