提交 62971c0c 编写于 作者: S slguan

[TBASE-1229]

上级 9f185225
...@@ -346,10 +346,16 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) { ...@@ -346,10 +346,16 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) {
int real_size = 0; int real_size = 0;
/* char action = SDB_TYPE_INSERT; */ /* char action = SDB_TYPE_INSERT; */
if (pTable == NULL) return -1; if (pTable == NULL) {
sdbError("sdb tables is null");
return -1;
}
if ((pTable->keyType != SDB_KEYTYPE_AUTO) || *((int64_t *)row)) if ((pTable->keyType != SDB_KEYTYPE_AUTO) || *((int64_t *)row))
if (sdbGetRow(handle, row)) return -1; if (sdbGetRow(handle, row)) {
sdbError("table:%s, failed to insert record", pTable->name);
return -1;
}
total_size = sizeof(SRowHead) + pTable->maxRowSize + sizeof(TSCKSUM); total_size = sizeof(SRowHead) + pTable->maxRowSize + sizeof(TSCKSUM);
SRowHead *rowHead = (SRowHead *)malloc(total_size); SRowHead *rowHead = (SRowHead *)malloc(total_size);
...@@ -408,24 +414,26 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) { ...@@ -408,24 +414,26 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) {
pTable->numOfRows++; pTable->numOfRows++;
switch (pTable->keyType) { switch (pTable->keyType) {
case SDB_KEYTYPE_STRING: case SDB_KEYTYPE_STRING:
sdbTrace( sdbTrace("table:%s, a record is inserted:%s, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld",
"table:%s, a record is inserted:%s, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld", pTable->name, (char *)row, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
pTable->name, (char *)row, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size); break;
case SDB_KEYTYPE_UINT32: //dnodes or mnodes
sdbTrace("table:%s, a record is inserted:%s, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld",
pTable->name, taosIpStr(*(int32_t *)row), sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
break; break;
case SDB_KEYTYPE_UINT32:
case SDB_KEYTYPE_AUTO: case SDB_KEYTYPE_AUTO:
sdbTrace( sdbTrace("table:%s, a record is inserted:%d, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld",
"table:%s, a record is inserted:%d, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld", pTable->name, *(int32_t *)row, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
pTable->name, *(int32_t *)row, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
break; break;
default: default:
sdbTrace( sdbTrace("table:%s, a record is inserted, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld",
"table:%s, a record is inserted, sdbVersion:%ld id:%ld rowSize:%d numOfRows:%d fileSize:%ld", pTable->name, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
pTable->name, sdbVersion, rowHead->id, rowHead->rowSize, pTable->numOfRows, pTable->size);
break; break;
} }
id = rowMeta.id; id = rowMeta.id;
} else {
sdbError("table:%s, failed to insert record", pTable->name);
} }
tfree(rowHead); tfree(rowHead);
...@@ -509,15 +517,16 @@ int sdbDeleteRow(void *handle, void *row) { ...@@ -509,15 +517,16 @@ int sdbDeleteRow(void *handle, void *row) {
sdbAddIntoUpdateList(pTable, SDB_TYPE_DELETE, pMetaRow); sdbAddIntoUpdateList(pTable, SDB_TYPE_DELETE, pMetaRow);
switch (pTable->keyType) { switch (pTable->keyType) {
case SDB_KEYTYPE_STRING: case SDB_KEYTYPE_STRING:
sdbTrace( sdbTrace("table:%s, a record is deleted:%s, sdbVersion:%ld id:%ld numOfRows:%d",
"table:%s, a record is deleted:%s, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, (char *)row, sdbVersion, pTable->id, pTable->numOfRows);
pTable->name, (char *)row, sdbVersion, pTable->id, pTable->numOfRows); break;
case SDB_KEYTYPE_UINT32: //dnodes or mnodes
sdbTrace("table:%s, a record is deleted:%s, sdbVersion:%ld id:%ld numOfRows:%d",
pTable->name, taosIpStr(*(int32_t *)row), sdbVersion, pTable->id, pTable->numOfRows);
break; break;
case SDB_KEYTYPE_UINT32:
case SDB_KEYTYPE_AUTO: case SDB_KEYTYPE_AUTO:
sdbTrace( sdbTrace("table:%s, a record is deleted:%d, sdbVersion:%ld id:%ld numOfRows:%d",
"table:%s, a record is deleted:%d, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, *(int32_t *)row, sdbVersion, pTable->id, pTable->numOfRows);
pTable->name, *(int32_t *)row, sdbVersion, pTable->id, pTable->numOfRows);
break; break;
default: default:
sdbTrace("table:%s, a record is deleted, sdbVersion:%ld id:%ld numOfRows:%d", sdbTrace("table:%s, a record is deleted, sdbVersion:%ld id:%ld numOfRows:%d",
...@@ -610,15 +619,16 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) { ...@@ -610,15 +619,16 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) {
switch (pTable->keyType) { switch (pTable->keyType) {
case SDB_KEYTYPE_STRING: case SDB_KEYTYPE_STRING:
sdbTrace( sdbTrace("table:%s, a record is updated:%s, sdbVersion:%ld id:%ld numOfRows:%d",
"table:%s, a record is updated:%s, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, (char *)row, sdbVersion, pTable->id, pTable->numOfRows);
pTable->name, (char *)row, sdbVersion, pTable->id, pTable->numOfRows); break;
case SDB_KEYTYPE_UINT32: //dnodes or mnodes
sdbTrace("table:%s, a record is updated:%d, sdbVersion:%ld id:%ld numOfRows:%d",
pTable->name, taosIpStr(*(int32_t *)row), sdbVersion, pTable->id, pTable->numOfRows);
break; break;
case SDB_KEYTYPE_UINT32:
case SDB_KEYTYPE_AUTO: case SDB_KEYTYPE_AUTO:
sdbTrace( sdbTrace("table:%s, a record is updated:%d, sdbVersion:%ld id:%ld numOfRows:%d",
"table:%s, a record is updated:%d, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, *(int32_t *)row, sdbVersion, pTable->id, pTable->numOfRows);
pTable->name, *(int32_t *)row, sdbVersion, pTable->id, pTable->numOfRows);
break; break;
default: default:
sdbTrace("table:%s, a record is updated, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, sdbVersion, sdbTrace("table:%s, a record is updated, sdbVersion:%ld id:%ld numOfRows:%d", pTable->name, sdbVersion,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册