-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add index correction internal logic #2194
Merged
Merged
Changes from 88 commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
a1ee9d8
implement the initail framework
ykadowak 8a1221d
add corrector configuration
ykadowak fa1eb75
add corrector logic
ykadowak 39e7d71
add build make command for index correction binary
ykadowak 2bd41e9
add Dockerfile for index correction
ykadowak 6ef29e3
add Docker image for index job correction
ykadowak c7e1ff2
add timer
ykadowak 22dcaaa
fix tag align
ykadowak d51e26b
tmp
ykadowak 6aa8fde
fix log
ykadowak 41faffd
temporally implement two versions of correct function
ykadowak 8f5bcf0
set eg limit from config
ykadowak 065e9e2
add stream list concurrency config
ykadowak 8562a99
implement index id caching
ykadowak 81345f3
add config to use cache or not
ykadowak 77c33f0
style: Format code with prettier and gofumpt
deepsource-autofix[bot] 72c3956
refactor availableAddrs
ykadowak 5ffd9b3
add kvs range duration
ykadowak 5d3c6c7
add leftAgentAddrs for performance
ykadowak 3b3710b
Revert "add kvs range duration"
ykadowak 6b3934e
refactor
ykadowak bc591ae
fix without cache bug
ykadowak 5209a72
enable observability
ykadowak a0cb7aa
refactor
ykadowak b453e61
SIGTERM after complete
ykadowak db6868d
add metrics server
ykadowak 7a630b3
add pcache
ykadowak ca84f56
remove comment
ykadowak feda428
[TEMP] use pcache
ykadowak c229a87
[TMP] use pcache
ykadowak fa0b68b
fix empty shard returns error
ykadowak 06b312b
fix to use local map
ykadowak 490345f
[TMP] add prestop for pcache
ykadowak 05838c3
[TEMP] add pcache config
ykadowak 9805e7e
style: Format code with prettier and gofumpt
deepsource-autofix[bot] a0d698e
[TEMP] add pcache log
ykadowak 9e5f2ae
fix map alloc size
ykadowak 3728276
[TMP] Add bbolt cache
ykadowak 1678ff7
update bbolt
ykadowak 4f87601
fix bbolt bug
ykadowak 01225aa
add bbolt test
ykadowak 428ee35
[TEMP] use bbolt as persistent cache
ykadowak 81b800e
style: Format code with prettier and gofumpt
deepsource-autofix[bot] bfc73c4
add SetBatch to bbolt
ykadowak d4f3695
use batch to write map to disk
ykadowak 9975237
style: Format code with prettier and gofumpt
deepsource-autofix[bot] 2b00e05
delete the map elements on finalize
ykadowak a611e88
manually call GC after the map shrink
ykadowak e21441c
add limit to SetBatch goroutine number
ykadowak 66bc79c
stop unnecesarry GC
ykadowak 3a85405
increase eg limit to the MaxBatchSize
ykadowak 16d2986
use ch to set batch bbolt
ykadowak 919c9f9
fix servers shutdown properly
ykadowak 9bd57c0
use internal/kvs/bbolt
ykadowak 55c6586
refactor
ykadowak bc92686
always use bbolt cache for correction
ykadowak 319ec8b
update sample.yaml for correction
ykadowak eb5cdb0
style: format code with Prettier and Gofumpt
deepsource-autofix[bot] d3616e5
use go std slices pkg
ykadowak 89e2339
refactor
ykadowak e2eeabc
add comment
ykadowak 9a9e622
remove valdsync
ykadowak 4c22bcc
use vald errgroup
ykadowak e0ef7a8
Merge branch 'main' into feature/index/correction-job
ykadowak 4dc4801
refactor
ykadowak 705dc29
Define ErrNoAvailableAgentToInsert
ykadowak 952a6e7
update comment in English
ykadowak 5f93398
Apply new actions yaml format
ykadowak c860ddc
Disable godox
ykadowak 2c2bb09
style: format code with Prettier and Gofumpt
deepsource-autofix[bot] 2ecf8cf
remove comment
ykadowak 8bb271d
Apply format
ykadowak e5f73a3
Add type check for type assertion
ykadowak d3e4d78
use const to specify filemode
ykadowak 7e5cd71
Add bbolt concurrency as config
ykadowak a184b22
fix var style
ykadowak 4972294
Suppress linter
ykadowak ef93123
fix comment
ykadowak 375c04e
add test template
ykadowak 33ad603
Refactor parameters for index correction
ykadowak 55bc821
Refactor config
ykadowak 004bf81
Add corrector test
ykadowak 97ff3c0
style: format code with Prettier and Gofumpt
deepsource-autofix[bot] df88705
Merge branch 'main' into feature/index/correction-job
ykadowak 8b0540d
Add timestamp check
ykadowak 5430f67
Apply format
ykadowak bdc9c70
fix schema type
ykadowak f7ffd6a
Fix DeepSource errors
ykadowak 5e73905
Fix misspell
ykadowak ce78ccf
Add type check
ykadowak ef2e20d
Remove unused config
ykadowak 93d6ab7
Fix DeepSource error
ykadowak 31058f5
Add required go:build e2e tag
ykadowak 6f79736
Remove memo
ykadowak 0d4d9d2
Refactor comment
ykadowak 0eebe24
Remove TODO comment that is already done
ykadowak 0eba31e
Remove unused config
ykadowak 5a73044
Add comment to errors
ykadowak 5117332
change app name
ykadowak 74bd1c6
replace filepath pkg with internal file
ykadowak d687013
Refactor
ykadowak ba241cb
Fix gRPC spelling
ykadowak 436da6e
Remove memo
ykadowak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# | ||
# Copyright (C) 2019-2023 vdaas.org vald team <[email protected]> | ||
# | ||
# Licensed 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 | ||
# | ||
# https://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: "Build docker image: index-job-correction" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*.*.*" | ||
- "v*.*.*" | ||
- "*.*.*-*" | ||
- "v*.*.*-*" | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/dockers-index-job-correction.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/correction/**" | ||
- "cmd/index/job/correction/**" | ||
- "dockers/index/job/correction/Dockerfile" | ||
- "versions/GO_VERSION" | ||
pull_request: | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/_docker-image.yaml" | ||
- ".github/workflows/dockers-index-job-correction.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/correction/**" | ||
- "cmd/index/job/correction/**" | ||
- "dockers/index/job/correction/Dockerfile" | ||
- "versions/GO_VERSION" | ||
pull_request_target: | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/_docker-image.yaml" | ||
- ".github/workflows/dockers-index-job-correction.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/correction/**" | ||
- "cmd/index/job/correction/**" | ||
- "dockers/index/job/correction/Dockerfile" | ||
- "versions/GO_VERSION" | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/_docker-image.yaml | ||
with: | ||
target: index-job-correction | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (C) 2019-2023 vdaas.org vald team <[email protected]> | ||
// | ||
// Licensed 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 | ||
// | ||
// https://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. | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/vdaas/vald/internal/errors" | ||
"github.com/vdaas/vald/internal/info" | ||
"github.com/vdaas/vald/internal/log" | ||
"github.com/vdaas/vald/internal/runner" | ||
"github.com/vdaas/vald/internal/safety" | ||
"github.com/vdaas/vald/pkg/index/job/correction/config" | ||
"github.com/vdaas/vald/pkg/index/job/correction/usecase" | ||
) | ||
|
||
const ( | ||
maxVersion = "v0.0.10" | ||
minVersion = "v0.0.0" | ||
name = "index correction job" | ||
) | ||
|
||
func main() { | ||
if err := safety.RecoverFunc(func() error { | ||
return runner.Do( | ||
context.Background(), | ||
runner.WithName(name), | ||
runner.WithVersion(info.Version, maxVersion, minVersion), | ||
runner.WithConfigLoader(func(path string) (interface{}, *config.GlobalConfig, error) { | ||
cfg, err := config.NewConfig(path) | ||
if err != nil { | ||
return nil, nil, errors.Wrap(err, "failed to load "+name+"'s configuration") | ||
} | ||
return cfg, &cfg.GlobalConfig, nil | ||
}), | ||
runner.WithDaemonInitializer(func(cfg interface{}) (runner.Runner, error) { | ||
c, ok := cfg.(*config.Data) | ||
if !ok { | ||
return nil, errors.ErrInvalidConfig | ||
} | ||
return usecase.New(c) | ||
}), | ||
) | ||
})(); err != nil { | ||
log.Fatal(err, info.Get()) | ||
return | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should discuss about the naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5117332