提交 a56b019a 编写于 作者: S slguan

[TBASE-1284]

上级 92a9613e
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#define abs(x) (((x) < 0) ? -(x) : (x)) #define abs(x) (((x) < 0) ? -(x) : (x))
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
extern char version[]; extern char version[];
const int16_t sdbFileVersion = 0; const int16_t sdbFileVersion = 0;
int sdbExtConns = 0; int sdbExtConns = 0;
...@@ -247,14 +243,14 @@ int sdbInitTableByFile(SSdbTable *pTable) { ...@@ -247,14 +243,14 @@ int sdbInitTableByFile(SSdbTable *pTable) {
(*sdbAddIndexFp[pTable->keyType])(pTable->iHandle, rowMeta.row, &rowMeta); (*sdbAddIndexFp[pTable->keyType])(pTable->iHandle, rowMeta.row, &rowMeta);
if (pTable->keyType == SDB_KEYTYPE_AUTO) { if (pTable->keyType == SDB_KEYTYPE_AUTO) {
pTable->autoIndex++; pTable->autoIndex++;
maxAutoIndex = max(maxAutoIndex, *(int32_t*)rowHead->data); maxAutoIndex = MAX(maxAutoIndex, *(int32_t*)rowHead->data);
} }
pTable->numOfRows++; pTable->numOfRows++;
} }
} else { // already exists } else { // already exists
if (pTable->keyType == SDB_KEYTYPE_AUTO) { if (pTable->keyType == SDB_KEYTYPE_AUTO) {
pTable->autoIndex++; pTable->autoIndex++;
maxAutoIndex = max(maxAutoIndex, *(int32_t *) rowHead->data); maxAutoIndex = MAX(maxAutoIndex, *(int32_t *) rowHead->data);
} }
if (rowHead->id < 0) { // Delete the object if (rowHead->id < 0) { // Delete the object
...@@ -276,7 +272,7 @@ int sdbInitTableByFile(SSdbTable *pTable) { ...@@ -276,7 +272,7 @@ int sdbInitTableByFile(SSdbTable *pTable) {
if (pTable->keyType == SDB_KEYTYPE_AUTO) { if (pTable->keyType == SDB_KEYTYPE_AUTO) {
pTable->autoIndex = maxAutoIndex; pTable->autoIndex = maxAutoIndex;
} }
sdbVersion += (pTable->id - oldId); sdbVersion += (pTable->id - oldId);
if (numOfDels > pTable->maxRows / 4) sdbSaveSnapShot(pTable); if (numOfDels > pTable->maxRows / 4) sdbSaveSnapShot(pTable);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册