提交 1447d1d5 编写于 作者: dengyihao's avatar dengyihao

rebuild index at tag0

上级 3067417e
...@@ -32,6 +32,8 @@ void taosSeedRand(uint32_t seed); ...@@ -32,6 +32,8 @@ void taosSeedRand(uint32_t seed);
uint32_t taosRand(void); uint32_t taosRand(void);
uint32_t taosRandR(uint32_t* pSeed); uint32_t taosRandR(uint32_t* pSeed);
void taosRandStr(char* str, int32_t size); void taosRandStr(char* str, int32_t size);
void taosRandStr2(char* str, int32_t size);
uint32_t taosSafeRand(void); uint32_t taosSafeRand(void);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -866,8 +866,10 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea ...@@ -866,8 +866,10 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
mInfo("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); mInfo("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
if (mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb) != 0) goto _OVER; if (mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb) != 0) goto _OVER;
char randStr[16] = {0};
taosRandStr2(randStr, tListLen(randStr) - 1);
SSchema *pSchema = &(stbObj.pTags[0]); SSchema *pSchema = &(stbObj.pTags[0]);
sprintf(fullIdxName, "%s.%s_default", pDb->name, pSchema->name); sprintf(fullIdxName, "%s.%s_%s", pDb->name, pSchema->name, randStr);
SSIdx idx = {0}; SSIdx idx = {0};
if (mndAcquireGlobalIdx(pMnode, fullIdxName, SDB_IDX, &idx) == 0 && idx.pIdx != NULL) { if (mndAcquireGlobalIdx(pMnode, fullIdxName, SDB_IDX, &idx) == 0 && idx.pIdx != NULL) {
......
...@@ -27,11 +27,11 @@ void taosSeedRand(uint32_t seed) { return srand(seed); } ...@@ -27,11 +27,11 @@ void taosSeedRand(uint32_t seed) { return srand(seed); }
uint32_t taosRand(void) { uint32_t taosRand(void) {
#ifdef WINDOWS #ifdef WINDOWS
unsigned int pSeed; unsigned int pSeed;
rand_s(&pSeed); rand_s(&pSeed);
return pSeed; return pSeed;
#else #else
return rand(); return rand();
#endif #endif
} }
...@@ -80,6 +80,15 @@ void taosRandStr(char* str, int32_t size) { ...@@ -80,6 +80,15 @@ void taosRandStr(char* str, int32_t size) {
const char* set = "abcdefghijklmnopqrstuvwxyz0123456789-_."; const char* set = "abcdefghijklmnopqrstuvwxyz0123456789-_.";
int32_t len = 39; int32_t len = 39;
for (int32_t i = 0; i < size; ++i) {
str[i] = set[taosRand() % len];
}
}
void taosRandStr2(char* str, int32_t size) {
const char* set = "abcdefghijklmnopqrstuvwxyz0123456789";
int32_t len = 36;
for (int32_t i = 0; i < size; ++i) { for (int32_t i = 0; i < size; ++i) {
str[i] = set[taosRand() % len]; str[i] = set[taosRand() % len];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册