rm deleted table idx
This commit is contained in:
parent
bb59553e39
commit
9805c50b38
|
@ -15,17 +15,18 @@
|
||||||
|
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
|
|
||||||
static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
||||||
static int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
static int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
||||||
static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry);
|
static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry);
|
||||||
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type);
|
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type);
|
||||||
|
static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey);
|
||||||
|
|
||||||
static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) {
|
static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) {
|
||||||
pInfo->uid = pEntry->uid;
|
pInfo->uid = pEntry->uid;
|
||||||
|
@ -591,6 +592,28 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
const SSchema *pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
const SSchema *pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
||||||
if (pTagColumn->type == TSDB_DATA_TYPE_JSON) {
|
if (pTagColumn->type == TSDB_DATA_TYPE_JSON) {
|
||||||
metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
||||||
|
} else {
|
||||||
|
STagIdxKey *pTagIdxKey = NULL;
|
||||||
|
int32_t nTagIdxKey;
|
||||||
|
|
||||||
|
const void *pTagData = NULL;
|
||||||
|
int32_t nTagData = 0;
|
||||||
|
|
||||||
|
STagVal tagVal = {.cid = pTagColumn->colId};
|
||||||
|
tTagGet((const STag *)e.ctbEntry.pTags, &tagVal);
|
||||||
|
if (IS_VAR_DATA_TYPE(pTagColumn->type)) {
|
||||||
|
pTagData = tagVal.pData;
|
||||||
|
nTagData = (int32_t)tagVal.nData;
|
||||||
|
} else {
|
||||||
|
pTagData = &(tagVal.i64);
|
||||||
|
nTagData = tDataTypes[pTagColumn->type].bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
||||||
|
&pTagIdxKey, &nTagIdxKey) == 0) {
|
||||||
|
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, &pMeta->txn);
|
||||||
|
}
|
||||||
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
}
|
}
|
||||||
tDecoderClear(&tdc);
|
tDecoderClear(&tdc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,5 +454,7 @@
|
||||||
./test.sh -f tsim/tag/set.sim
|
./test.sh -f tsim/tag/set.sim
|
||||||
./test.sh -f tsim/tag/smallint.sim
|
./test.sh -f tsim/tag/smallint.sim
|
||||||
./test.sh -f tsim/tag/tinyint.sim
|
./test.sh -f tsim/tag/tinyint.sim
|
||||||
|
./test.sh -f tsim/tag/drop_tag.sim
|
||||||
|
|
||||||
|
|
||||||
#======================b1-end===============
|
#======================b1-end===============
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
|
||||||
|
$dbPrefix = ta_bib_db
|
||||||
|
$tbPrefix = ta_bib_tb
|
||||||
|
$mtPrefix = ta_bib_mt
|
||||||
|
$tbNum = 10
|
||||||
|
$rowNum = 20
|
||||||
|
$totalNum = 200
|
||||||
|
|
||||||
|
print =============== step1
|
||||||
|
$i = 0
|
||||||
|
$db = $dbPrefix . $i
|
||||||
|
$mt = $mtPrefix . $i
|
||||||
|
|
||||||
|
sql drop database if exists $db
|
||||||
|
|
||||||
|
sql create database $db vgroups 1
|
||||||
|
sql use $db
|
||||||
|
|
||||||
|
print ======== test bigint
|
||||||
|
sql create table if not exists st( ts timestamp, order_id bigint) tags (account_id bigint)
|
||||||
|
|
||||||
|
sql create table t1 using st tags(111)
|
||||||
|
sql create table t2 using st tags(222)
|
||||||
|
|
||||||
|
sql insert into t1(ts, order_id) values(1648791213001, 1)
|
||||||
|
sql insert into t2(ts, order_id) values(1648791213002, 2)
|
||||||
|
sql select account_id,count(*) from st where account_id = 111 group by account_id
|
||||||
|
|
||||||
|
sql drop table t1
|
||||||
|
|
||||||
|
sql create table t1 using st tags(111)
|
||||||
|
|
||||||
|
sql insert into t1(ts, order_id) values(1648791213001, 1)
|
||||||
|
sql insert into t2(ts, order_id) values(1648791213002, 2)
|
||||||
|
|
||||||
|
sql select account_id,count(*) from st where account_id = 111 group by account_id
|
||||||
|
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ======== test varchar
|
||||||
|
|
||||||
|
sql drop stable st
|
||||||
|
|
||||||
|
sql create table if not exists st( ts timestamp, order_id bigint) tags (account_id binary(16))
|
||||||
|
|
||||||
|
sql create table t1 using st tags("aac")
|
||||||
|
sql create table t2 using st tags("abc")
|
||||||
|
|
||||||
|
sql insert into t1(ts, order_id) values(1648791213001, 1)
|
||||||
|
sql insert into t2(ts, order_id) values(1648791213002, 2)
|
||||||
|
sql select account_id,count(*) from st where account_id = "aac" group by account_id
|
||||||
|
|
||||||
|
sql drop table t1
|
||||||
|
|
||||||
|
sql create table t1 using st tags("aac")
|
||||||
|
|
||||||
|
sql insert into t1(ts, order_id) values(1648791213001, 1)
|
||||||
|
sql insert into t2(ts, order_id) values(1648791213002, 2)
|
||||||
|
|
||||||
|
sql select account_id,count(*) from st where account_id = "aac" group by account_id
|
||||||
|
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ====== test empty table
|
||||||
|
sql drop table t1
|
||||||
|
|
||||||
|
sql select account_id,count(*) from st where account_id = "aac" group by account_id
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
|
||||||
|
sql drop database $db
|
||||||
|
|
Loading…
Reference in New Issue