add topic info schema
This commit is contained in:
parent
4fd6f59092
commit
e48206f9a0
|
@ -20,7 +20,8 @@
|
||||||
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||||
|
|
||||||
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
|
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
|
||||||
static const SInfosTableSchema dnodesSchema[] = {{.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
static const SInfosTableSchema dnodesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
{.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||||
{.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
{.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||||
|
@ -28,21 +29,25 @@ static const SInfosTableSchema dnodesSchema[] = {{.name = "id", .byt
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema mnodesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
static const SInfosTableSchema mnodesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema modulesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
static const SInfosTableSchema modulesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema qnodesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
static const SInfosTableSchema qnodesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userDBSchema[] = {{.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userDBSchema[] = {
|
||||||
|
{.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
{.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||||
{.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
{.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
||||||
|
@ -59,15 +64,18 @@ static const SInfosTableSchema userDBSchema[] = {{.name = "name", .b
|
||||||
{.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
{.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||||
{.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
{.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||||
{.name = "precision", .bytes = 3 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "precision", .bytes = 3 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
|
// {.name = "update", .bytes = 1, .type =
|
||||||
|
// TSDB_DATA_TYPE_TINYINT}, // disable update
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userFuncSchema[] = {{.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userFuncSchema[] = {
|
||||||
|
{.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userIdxSchema[] = {{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userIdxSchema[] = {
|
||||||
|
{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "index_database", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "index_database", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "index_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "index_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
@ -75,7 +83,8 @@ static const SInfosTableSchema userIdxSchema[] = {{.name = "db_name", .
|
||||||
{.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userStbsSchema[] = {{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userStbsSchema[] = {
|
||||||
|
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
@ -84,7 +93,8 @@ static const SInfosTableSchema userStbsSchema[] = {{.name = "stable_name", .
|
||||||
{.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT},
|
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userStreamsSchema[] = {{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userStreamsSchema[] = {
|
||||||
|
{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
|
@ -101,7 +111,8 @@ static const SInfosTableSchema userTblsSchema[] = {
|
||||||
{.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userTblDistSchema[] = {{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userTblDistSchema[] = {
|
||||||
|
{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
@ -115,12 +126,14 @@ static const SInfosTableSchema userTblDistSchema[] = {{.name = "db_name",
|
||||||
{.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userUsersSchema[] = {{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
static const SInfosTableSchema userUsersSchema[] = {
|
||||||
|
{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
{.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema vgroupsSchema[] = {{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
static const SInfosTableSchema vgroupsSchema[] = {
|
||||||
|
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
@ -136,7 +149,34 @@ static const SInfosTableSchema vgroupsSchema[] = {{.name = "vgroup_id", .
|
||||||
{.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SInfosTableMeta infosMeta[] = {{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema)},
|
// TODO put into perf schema
|
||||||
|
static const SInfosTableSchema topicSchema[] = {
|
||||||
|
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
|
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "row_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const SInfosTableSchema consumerSchema[] = {
|
||||||
|
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
{.name = "status", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
// ep
|
||||||
|
// up time
|
||||||
|
// topics
|
||||||
|
};
|
||||||
|
|
||||||
|
static const SInfosTableSchema subscribeSchema[] = {
|
||||||
|
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const SInfosTableMeta infosMeta[] = {
|
||||||
|
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema)},
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
|
||||||
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
|
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
|
||||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
||||||
|
@ -251,5 +291,3 @@ void mndCleanupInfos(SMnode *pMnode) {
|
||||||
pMnode->infosMeta = NULL;
|
pMnode->infosMeta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue