Add comment for indexcoord (#7950)

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/8013/head
cai.zhang 2021-09-15 22:09:50 +08:00 committed by GitHub
parent 675b71cc30
commit 130817d8c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -290,6 +290,10 @@ func (i *IndexCoord) GetStatisticsChannel(ctx context.Context) (*milvuspb.String
}, nil
}
// BuildIndex receives request from RootCoordinator to build an index.
// Index building is asynchronous, so when an index building request comes, an IndexBuildID is assigned to the task and
// the task is recorded in Meta. The background process assignTaskLoop will find this task and assign it to IndexNode for
// execution.
func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequest) (*indexpb.BuildIndexResponse, error) {
log.Debug("IndexCoord building index ...",
zap.Int64("IndexBuildID", req.IndexBuildID),
@ -546,6 +550,8 @@ func (i *IndexCoord) tsLoop() {
}
}
// recycleUnusedIndexFiles is used to delete useless index files, including lower version index files and index files
// corresponding to the deleted index.
func (i *IndexCoord) recycleUnusedIndexFiles() {
ctx, cancel := context.WithCancel(i.loopCtx)
@ -595,6 +601,7 @@ func (i *IndexCoord) recycleUnusedIndexFiles() {
}
}
// watchNodeLoop is used to monitor IndexNode going online and offline.
func (i *IndexCoord) watchNodeLoop() {
ctx, cancel := context.WithCancel(i.loopCtx)
@ -631,6 +638,7 @@ func (i *IndexCoord) watchNodeLoop() {
}
}
// watchMetaLoop is used to monitor whether the Meta in ETCD has been changed.
func (i *IndexCoord) watchMetaLoop() {
ctx, cancel := context.WithCancel(i.loopCtx)
@ -671,6 +679,7 @@ func (i *IndexCoord) watchMetaLoop() {
}
}
// assignTaskLoop is used to assign index construction tasks.
func (i *IndexCoord) assignTask(builderClient types.IndexNode, req *indexpb.CreateIndexRequest) bool {
ctx, cancel := context.WithTimeout(i.loopCtx, i.reqTimeoutInterval)
defer cancel()