Skip to content

Commit

Permalink
feat: show measurements database and retention policy wildcards (#22388)
Browse files Browse the repository at this point in the history
* feat: show measurements database and retention policy wildcards

Closes #3318
  • Loading branch information
lesam authored and chengshiwen committed Aug 29, 2024
1 parent 1eca5bd commit 5af74de
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 119 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ v1.8.11 [unreleased]
- [#25082](https://github.com/influxdata/influxdb/pull/25082): fix: GROUP BY queries with offset that crosses a DST boundary fail.
- [#25146](https://github.com/influxdata/influxdb/pull/25146): fix: Store.validateArgs wrongfully overwriting start, end unix time
- [#25182](https://github.com/influxdata/influxdb/pull/25182): fix(tsi1): fix data race between appendEntry and FlushAndSync tsi1.(*LogFile)
- [#22388](https://github.com/influxdata/influxdb/pull/22388): feat: show measurements database and retention policy wildcards

v1.8.10 [2021-10-11]
-------------------
Expand Down
151 changes: 80 additions & 71 deletions coordinator/internal/data.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions coordinator/internal/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ message TaskManagerStatementResponse {
}

message MeasurementNamesRequest {
required string Database = 1;
optional string Condition = 2;
required string Database = 1;
optional string RetentionPolicy = 2;
optional string Condition = 3;
}

message MeasurementNamesResponse {
Expand Down
7 changes: 4 additions & 3 deletions coordinator/meta_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (e *MetaExecutor) TaskManagerStatement(nodeID uint64, stmt influxql.Stateme
return resp.Result, resp.Err
}

func (e *MetaExecutor) MeasurementNames(nodeID uint64, database string, cond influxql.Expr) ([][]byte, error) {
func (e *MetaExecutor) MeasurementNames(nodeID uint64, database string, retentionPolicy string, cond influxql.Expr) ([][]byte, error) {
conn, err := e.dial(nodeID)
if err != nil {
return nil, err
Expand All @@ -200,8 +200,9 @@ func (e *MetaExecutor) MeasurementNames(nodeID uint64, database string, cond inf

// Write request.
if err := EncodeTLV(conn, measurementNamesRequestMessage, &MeasurementNamesRequest{
Database: database,
Condition: cond,
Database: database,
RetentionPolicy: retentionPolicy,
Condition: cond,
}); err != nil {
return nil, err
}
Expand Down
11 changes: 7 additions & 4 deletions coordinator/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ func (r *TaskManagerStatementResponse) UnmarshalBinary(data []byte) error {

// MeasurementNamesRequest represents a request to retrieve measurement names.
type MeasurementNamesRequest struct {
Database string
Condition influxql.Expr
Database string
RetentionPolicy string
Condition influxql.Expr
}

// MarshalBinary encodes r to a binary format.
Expand All @@ -266,8 +267,9 @@ func (r *MeasurementNamesRequest) MarshalBinary() ([]byte, error) {
condition = r.Condition.String()
}
return proto.Marshal(&internal.MeasurementNamesRequest{
Database: proto.String(r.Database),
Condition: proto.String(condition),
Database: proto.String(r.Database),
RetentionPolicy: proto.String(r.RetentionPolicy),
Condition: proto.String(condition),
})
}

Expand All @@ -279,6 +281,7 @@ func (r *MeasurementNamesRequest) UnmarshalBinary(data []byte) error {
}

r.Database = pb.GetDatabase()
r.RetentionPolicy = pb.GetRetentionPolicy()
if pb.GetCondition() != "" {
if condition, err := influxql.ParseExpr(pb.GetCondition()); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion coordinator/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func (s *Service) processMeasurementNamesRequest(conn net.Conn) {
return nil, err
}
// Return measurement names.
return s.TSDBStore.MeasurementNames(context.Background(), nil, req.Database, req.Condition)
return s.TSDBStore.MeasurementNames(context.Background(), nil, req.Database, req.RetentionPolicy, req.Condition)
}()
if err != nil {
s.Logger.Error("Error reading MeasurementNames request", zap.Error(err))
Expand Down
Loading

0 comments on commit 5af74de

Please sign in to comment.