diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 4c5ee032b75e91278d4f7d5814f4ab3366cff89e..b36fb3155c8826f46d8479615164d2c519ebd245 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -1069,7 +1069,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { pStable->info.type = TSDB_SUPER_TABLE; pStable->createdTime = taosGetTimestampMs(); - uint64_t x = (us & ((1ul<<40) - 1)); // todo refactor + uint64_t x = (us & ((((uint64_t)1)<<40) - 1)); // todo refactor x = x << 24; pStable->uid = x + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); @@ -2080,9 +2080,11 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { pTable->superTable = pMsg->pSTable; } else { if (pTable->info.type == TSDB_SUPER_TABLE) { - int64_t us = taosGetTimestampUs(); - uint64_t x = (us&0x000000FFFFFFFFFF); - x = x<<24; + uint64_t us = (uint64_t) taosGetTimestampUs(); + + uint64_t x = (us & ((((uint64_t)1)<<40) - 1)); + x = x << 24; + pTable->uid = x + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); } else { pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) +