这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Dec 10, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion index/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (s *GRPCService) Index(ctx context.Context, req *index.IndexRequest) (*empt
start := time.Now()
defer RecordMetrics(start, "index")

s.logger.Printf("[INFO] index %v", req)
s.logger.Printf("[DEBUG] index %v", req)

resp := &empty.Empty{}

Expand Down
2 changes: 2 additions & 0 deletions index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ func (b *Index) Index(id string, fields map[string]interface{}) error {
}()

// index
b.logger.Printf("[DEBUG] index %s, %v", id, fields)
err := b.index.Index(id, fields)
if err != nil {
return err
}
b.logger.Printf("[DEBUG] indexed %s, %v", id, fields)

// map[string]interface{} -> bytes
fieldsBytes, err := json.Marshal(fields)
Expand Down
4 changes: 4 additions & 0 deletions index/raft_fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func (f *RaftFSM) Search(request *bleve.SearchRequest) (*bleve.SearchResult, err
}

func (f *RaftFSM) applyIndex(id string, fields map[string]interface{}) interface{} {
f.logger.Printf("[DEBUG] index %s, %v", id, fields)

err := f.index.Index(id, fields)
if err != nil {
f.logger.Printf("[ERR] %v", err)
Expand Down Expand Up @@ -133,6 +135,8 @@ func (f *RaftFSM) Apply(l *raft.Log) interface{} {
return err
}

f.logger.Printf("[DEBUG] Apply %v", c)

switch c.Type {
case pbindex.IndexCommand_SET_METADATA:
// Any -> Node
Expand Down
2 changes: 2 additions & 0 deletions index/raft_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ func (s *RaftServer) Search(request *bleve.SearchRequest) (*bleve.SearchResult,
}

func (s *RaftServer) Index(doc *index.Document) error {
s.logger.Printf("[DEBUG] index %v", doc)

if s.raft.State() != raft.Leader {
// forward to leader node
leaderId, err := s.LeaderID(60 * time.Second)
Expand Down