mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 20:07:51 +00:00
renamed 2 system tables
This commit is contained in:
parent
aa17b8d725
commit
25d1c605c7
3 changed files with 33 additions and 33 deletions
|
|
@ -130,7 +130,7 @@ func (i *showTablesRowIter) Next(ctx context.Context) (types.Row, error) {
|
|||
var err error
|
||||
var spaceUsed pilosa.DiskUsage
|
||||
switch strings.ToLower(indexName) {
|
||||
case "fb_cluster_info", "fb_cluster_nodes", "fb_performance_counters", "fb_exec_requests", "fb_table_ddl":
|
||||
case fbDatabaseInfo, fbDatabaseNodes, fbPerformanceCounters, fbExecRequests, fbTableDDL:
|
||||
spaceUsed = pilosa.DiskUsage{
|
||||
Usage: 0,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import (
|
|||
// exclude this file from SonarCloud dupe eval
|
||||
|
||||
const (
|
||||
fbClusterInfo = "fb_cluster_info"
|
||||
fbClusterNodes = "fb_cluster_nodes"
|
||||
fbDatabaseInfo = "fb_database_info"
|
||||
fbDatabaseNodes = "fb_database_nodes"
|
||||
fbExecRequests = "fb_exec_requests"
|
||||
fbPerformanceCounters = "fb_performance_counters"
|
||||
|
||||
|
|
@ -32,82 +32,82 @@ type systemTable struct {
|
|||
}
|
||||
|
||||
var systemTables = map[string]*systemTable{
|
||||
fbClusterInfo: {
|
||||
name: fbClusterInfo,
|
||||
fbDatabaseInfo: {
|
||||
name: fbDatabaseInfo,
|
||||
schema: types.Schema{
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "id",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "name",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "platform",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "platform_version",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "db_version",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "state",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "node_count",
|
||||
Type: parser.NewDataTypeInt(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterInfo,
|
||||
RelationName: fbDatabaseInfo,
|
||||
ColumnName: "replica_count",
|
||||
Type: parser.NewDataTypeInt(),
|
||||
},
|
||||
},
|
||||
requiresFanout: false,
|
||||
},
|
||||
fbClusterNodes: {
|
||||
name: fbClusterNodes,
|
||||
fbDatabaseNodes: {
|
||||
name: fbDatabaseNodes,
|
||||
schema: types.Schema{
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "id",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "state",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "uri",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "grpc_uri",
|
||||
Type: parser.NewDataTypeString(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "is_primary",
|
||||
Type: parser.NewDataTypeBool(),
|
||||
},
|
||||
&types.PlannerColumn{
|
||||
RelationName: fbClusterNodes,
|
||||
RelationName: fbDatabaseNodes,
|
||||
ColumnName: "space_used",
|
||||
Type: parser.NewDataTypeInt(),
|
||||
},
|
||||
|
|
@ -311,12 +311,12 @@ func (p *PlanOpSystemTable) Children() []types.PlanOperator {
|
|||
|
||||
func (p *PlanOpSystemTable) Iterator(ctx context.Context, row types.Row) (types.RowIterator, error) {
|
||||
switch p.table.name {
|
||||
case fbClusterInfo:
|
||||
return &fbClusterInfoRowIter{
|
||||
case fbDatabaseInfo:
|
||||
return &fbDatabaseInfoRowIter{
|
||||
planner: p.planner,
|
||||
}, nil
|
||||
case fbClusterNodes:
|
||||
return &fbClusterNodesRowIter{
|
||||
case fbDatabaseNodes:
|
||||
return &fbDatabaseNodesRowIter{
|
||||
planner: p.planner,
|
||||
}, nil
|
||||
case fbExecRequests:
|
||||
|
|
@ -343,14 +343,14 @@ func (p *PlanOpSystemTable) WithChildren(children ...types.PlanOperator) (types.
|
|||
return NewPlanOpSystemTable(p.planner, p.table), nil
|
||||
}
|
||||
|
||||
type fbClusterInfoRowIter struct {
|
||||
type fbDatabaseInfoRowIter struct {
|
||||
planner *ExecutionPlanner
|
||||
rowIndex int
|
||||
}
|
||||
|
||||
var _ types.RowIterator = (*fbClusterInfoRowIter)(nil)
|
||||
var _ types.RowIterator = (*fbDatabaseInfoRowIter)(nil)
|
||||
|
||||
func (i *fbClusterInfoRowIter) Next(ctx context.Context) (types.Row, error) {
|
||||
func (i *fbDatabaseInfoRowIter) Next(ctx context.Context) (types.Row, error) {
|
||||
if i.rowIndex < 1 {
|
||||
row := []interface{}{
|
||||
i.planner.systemAPI.ClusterName(),
|
||||
|
|
@ -368,14 +368,14 @@ func (i *fbClusterInfoRowIter) Next(ctx context.Context) (types.Row, error) {
|
|||
return nil, types.ErrNoMoreRows
|
||||
}
|
||||
|
||||
type fbClusterNodesRowIter struct {
|
||||
type fbDatabaseNodesRowIter struct {
|
||||
planner *ExecutionPlanner
|
||||
result []pilosa.ClusterNode
|
||||
}
|
||||
|
||||
var _ types.RowIterator = (*fbClusterNodesRowIter)(nil)
|
||||
var _ types.RowIterator = (*fbDatabaseNodesRowIter)(nil)
|
||||
|
||||
func (i *fbClusterNodesRowIter) Next(ctx context.Context) (types.Row, error) {
|
||||
func (i *fbDatabaseNodesRowIter) Next(ctx context.Context) (types.Row, error) {
|
||||
if i.result == nil {
|
||||
i.result = i.planner.systemAPI.ClusterNodes()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ func TestPlanner_Show(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("SystemTablesInfo", func(t *testing.T) {
|
||||
results, columns, _, err := sql_test.MustQueryRows(t, c.GetNode(0).Server, `select name, platform, platform_version, db_version, state, node_count, replica_count from fb_cluster_info`)
|
||||
results, columns, _, err := sql_test.MustQueryRows(t, c.GetNode(0).Server, `select name, platform, platform_version, db_version, state, node_count, replica_count from fb_database_info`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ func TestPlanner_Show(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("SystemTablesNode", func(t *testing.T) {
|
||||
_, columns, _, err := sql_test.MustQueryRows(t, c.GetNode(0).Server, `select * from fb_cluster_nodes`)
|
||||
_, columns, _, err := sql_test.MustQueryRows(t, c.GetNode(0).Server, `select * from fb_database_nodes`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue