提交 107107a7 编写于 作者: H Hongze Cheng

fix

上级 7bdfff7e
...@@ -140,6 +140,7 @@ void metaCloseDB(SMeta *pMeta) { ...@@ -140,6 +140,7 @@ void metaCloseDB(SMeta *pMeta) {
int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
tb_uid_t uid; tb_uid_t uid;
char buf[512]; char buf[512];
char buf1[512];
void * pBuf; void * pBuf;
DBT key1, value1; DBT key1, value1;
DBT key2, value2; DBT key2, value2;
...@@ -178,7 +179,7 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { ...@@ -178,7 +179,7 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
} }
if (pSchema) { if (pSchema) {
pBuf = buf; pBuf = buf1;
memset(&key2, 0, sizeof(key2)); memset(&key2, 0, sizeof(key2));
memset(&value2, 0, sizeof(key2)); memset(&value2, 0, sizeof(key2));
SSchemaKey schemaKey = {uid, 0 /*TODO*/, 0}; SSchemaKey schemaKey = {uid, 0 /*TODO*/, 0};
...@@ -189,13 +190,15 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { ...@@ -189,13 +190,15 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
SSchemaWrapper sw = {.nCols = ncols, .pSchema = pSchema}; SSchemaWrapper sw = {.nCols = ncols, .pSchema = pSchema};
metaEncodeSchema(&pBuf, &sw); metaEncodeSchema(&pBuf, &sw);
value2.data = buf; value2.data = buf1;
value2.size = POINTER_DISTANCE(pBuf, buf); value2.size = POINTER_DISTANCE(pBuf, buf1);
} }
metaDBWLock(pMeta->pDB); metaDBWLock(pMeta->pDB);
pMeta->pDB->pTbDB->put(pMeta->pDB->pTbDB, NULL, &key1, &value1, 0); pMeta->pDB->pTbDB->put(pMeta->pDB->pTbDB, NULL, &key1, &value1, 0);
pMeta->pDB->pSchemaDB->put(pMeta->pDB->pSchemaDB, NULL, &key2, &value2, 0); if (pSchema) {
pMeta->pDB->pSchemaDB->put(pMeta->pDB->pSchemaDB, NULL, &key2, &value2, 0);
}
metaDBULock(pMeta->pDB); metaDBULock(pMeta->pDB);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册