Skip to content
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

fix(dbrpv2): reflect match count correctly #18211

Merged
merged 1 commit into from
May 26, 2020
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
4 changes: 3 additions & 1 deletion dbrp/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte
}
}

return ms, len(ms), s.store.View(ctx, func(tx kv.Tx) error {
err := s.store.View(ctx, func(tx kv.Tx) error {
// Optimized path, use index.
if orgID := filter.OrgID; orgID != nil {
// The index performs a prefix search.
Expand Down Expand Up @@ -338,6 +338,8 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte
}
return nil
})

return ms, len(ms), err
}

// Create creates a new mapping.
Expand Down
5 changes: 4 additions & 1 deletion testing/dbrp_mapping_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,13 @@ func CreateDBRPMappingV2(
}
}

dbrpMappings, _, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{})
dbrpMappings, n, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{})
if err != nil {
t.Fatalf("failed to retrieve dbrps: %v", err)
}
if n != len(tt.wants.dbrpMappings) {
t.Errorf("want dbrpMappings count of %d, got %d", len(tt.wants.dbrpMappings), n)
}
if diff := cmp.Diff(tt.wants.dbrpMappings, dbrpMappings, DBRPMappingCmpOptionsV2...); diff != "" {
t.Errorf("dbrpMappings are different -want/+got\ndiff %s", diff)
}
Expand Down