Merge branch '1.2.4'

master
deffpuzzl 2018-08-08 14:25:32 +08:00
commit f48a769f66
7 changed files with 56 additions and 30 deletions

View File

@ -37,7 +37,7 @@ int main(int argc, char *argv[])
{
SATvm *pstSavm = (SATvm *)pGetSATvm();
if(RC_SUCC != lCreateTable(pstSavm, TBL_USER_INFO, 1000, lCreateUserInfo))
if(RC_SUCC != lCreateTable(pstSavm, TBL_USER_INFO, 100000, lCreateUserInfo))
{
fprintf(stderr, "create table %d failed, err: %s\n", TBL_USER_INFO, sGetTError(pstSavm->m_lErrno));
return RC_FAIL;

View File

@ -152,13 +152,13 @@ void vDebugTable(TABLE t, long eType)
}
}
if(eType & DEBUG_UNIQ_IDEX)
if(eType & DEBUG_UNIQ_IDEX && (((TblDef *)pstRun->m_pvAddr)->m_lIType & UNQIUE))
{
fprintf(stdout, "\n===================================UNIQUE_INDEX====================="
"==============lValid(%ld)=========================\n", lGetTblValid(t));
if(eType & DEBUG_IDEX_DALL)
{
for(i = 0; i < lGetTblRow(t); i ++)
for(i = 0; i < lGetTblRow(t) < 3 ? 3 : lGetTblRow(t); i ++)
{
pstTree = (SHTree *)(pstRun->m_pvAddr + lGetIdxPos(t) + i * sizeof(SHTree));
vPrintHex(pstTree->m_szIdx, pstTree->m_lIdx, 0);
@ -170,11 +170,11 @@ void vDebugTable(TABLE t, long eType)
}
else
{
for(i = 0; i < lGetTblValid(t); i ++)
for(i = 0; i < (lGetTblValid(t) < 3 ? 3 : lGetTblValid(t)); i ++)
{
pstTree = (SHTree *)(pstRun->m_pvAddr + lGetIdxPos(t) + i * sizeof(SHTree));
if(SELF_POS_UNUSE == pstTree->m_lSePos || NODE_NULL == pstTree->m_lSePos)
continue;
// if(SELF_POS_UNUSE == pstTree->m_lSePos || NODE_NULL == pstTree->m_lSePos)
// continue;
vPrintHex(pstTree->m_szIdx, pstTree->m_lIdx, 0);
fprintf(stdout, "NODE:[%6ld]->(%02ld), Idx:[%15s](%6ld), Color[%ld], lSePos:[%4ld], "
@ -185,7 +185,7 @@ void vDebugTable(TABLE t, long eType)
}
}
if(eType & DEBUG_GROP_IDEX)
if(eType & DEBUG_GROP_IDEX && (((TblDef *)pstRun->m_pvAddr)->m_lIType & NORMAL))
{
fprintf(stdout, "\n===================================INDEX_GROUP====================="
"==============Valid:%ld, Group:%ld================\n", lGetTblValid(t), lGetTblGroup(t));
@ -203,11 +203,11 @@ void vDebugTable(TABLE t, long eType)
}
else
{
for(i = 0; i < lGetTblValid(t); i ++)
for(i = 0; i < (lGetTblValid(t) < 3 ? 3 : lGetTblValid(t)); i ++)
{
pstTree = (SHTree *)(pstRun->m_pvAddr + lGetGrpPos(t) + i * sizeof(SHTree));
if(SELF_POS_UNUSE == pstTree->m_lSePos || NODE_NULL == pstTree->m_lSePos)
continue;
// if(SELF_POS_UNUSE == pstTree->m_lSePos || NODE_NULL == pstTree->m_lSePos)
// continue;
vPrintHex(pstTree->m_szIdx, pstTree->m_lIdx, 0);
fprintf(stdout, "NODE:[%ld](%02ld), Idx:[%4s](%ld)(%2ld), Color[%ld], lSePos:[%4ld],"
@ -218,7 +218,7 @@ void vDebugTable(TABLE t, long eType)
}
}
if(eType & DEBUG_GROP_LIST)
if(eType & DEBUG_GROP_LIST && (((TblDef *)pstRun->m_pvAddr)->m_lIType & NORMAL))
{
fprintf(stdout, "\n=================================INDEX_LIST========================"
"==============Valid(%ld)=============\n", lGetTblValid(t));
@ -235,11 +235,11 @@ void vDebugTable(TABLE t, long eType)
}
else
{
for(i = 0, j = lGetListOfs(t); i < lGetTblValid(t); i ++)
for(i = 0, j = lGetListOfs(t); i < (lGetTblValid(t) < 3 ? 3 : lGetTblValid(t)); i ++)
{
pstList = (SHList *)(pstRun->m_pvAddr + j + i * sizeof(SHList));
if(SELF_POS_UNUSE == pstList->m_lPos)
continue;
// if(SELF_POS_UNUSE == pstList->m_lPos)
// continue;
fprintf(stdout, "LIST:[%8ld][%02ld], lSePos:[%4ld], lData[%8ld], Node[%8ld], "
"Next[%8ld], Last[%8ld]\n" , (void *)pstList - pstRun->m_pvAddr, i,
@ -263,7 +263,7 @@ void vDebugTable(TABLE t, long eType)
for(i = 0; i < lGetTblRow(t); i ++)
{
pstTruck = (void *)(pstRun->m_pvAddr + lGetTblData(t) + i * lGetRowTruck(t));
fprintf(stdout, "SePos[%ld]\n", (void *)pstTruck - pstRun->m_pvAddr);
fprintf(stdout, "SePos[%ld][%X]\n", (void *)pstTruck - pstRun->m_pvAddr, pstTruck->m_chTag);
vPrintHex(pstTruck->m_pvData, lGetRowSize(t), 0);
}
}

View File

@ -13,7 +13,7 @@ OUTBIN=../bin
OBJFILE=tree.o sem.o msg.o tcp.o str.o list.o conf.o queue.o func.o
TARGET=$(OUTLIB)/libstvm.a
#TARDLL=$(OUTLIB)/libstvm.so
TARDLL=$(OUTLIB)/libstvm.so
TARVER=$(OUTLIB)/libstvm.so.1.2
STVM=$(OUTBIN)/stvm
DETVM=$(OUTBIN)/detvm

View File

@ -195,7 +195,7 @@ int getpack()
case 32:
return 8;
default:
fprintf(stdout, "当前环境对齐数值(%d)过大\n", pack);
fprintf(stdout, "number(%d) of alignment is too large\n", pack);
fflush(stdout);
return -1;
}
@ -213,7 +213,7 @@ int getpack()
case 24:
return 8;
default:
fprintf(stdout, "当前环境对齐数值(%d)过大\n", pack);
fprintf(stdout, "number(%d) of alignment is too large\n", pack);
fflush(stdout);
return -1;
}
@ -568,7 +568,10 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
strimcrlf(szField);
strimall(szField);
if(NULL == (pstKey = pFindField(ps->m_stKey, ps->m_lIdxNum, szField)))
{
fprintf(stderr, "field %s not define\n", szField);
return RC_FAIL;
}
strcpy(ps->m_stIdxUp[ps->m_lIdxUp].m_szField, szField);
ps->m_stIdxUp[ps->m_lIdxUp].m_lFrom = pstKey->m_lFrom;
@ -577,8 +580,11 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
ps->m_lIdxLen += pstKey->m_lLen;
ps->m_lIdxUp ++;
}
if(0 == ps->m_lIdxUp)
if(0 == ps->m_lIdxUp || ps->m_lIdxLen > MAX_INDEX_LEN)
{
fprintf(stderr, "index is too long or index field lost\n");
return RC_FAIL;
}
return RC_SUCC;
}
else if(NORMAL == em)
@ -590,7 +596,10 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
strimcrlf(szField);
strimall(szField);
if(NULL == (pstKey = pFindField(ps->m_stKey, ps->m_lIdxNum, szField)))
{
fprintf(stderr, "field %s not define\n", szField);
return RC_FAIL;
}
strcpy(ps->m_stGrpUp[ps->m_lGrpUp].m_szField, szField);
ps->m_stGrpUp[ps->m_lGrpUp].m_lFrom = pstKey->m_lFrom;
@ -600,8 +609,11 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
ps->m_lGrpUp ++;
}
if(0 == ps->m_lGrpUp)
if(0 == ps->m_lGrpUp || ps->m_lGrpLen > MAX_INDEX_LEN)
{
fprintf(stderr, "index is too long or index field lost\n");
return RC_FAIL;
}
return RC_SUCC;
}
else if(HASHID == em)
@ -613,7 +625,11 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
strimcrlf(szField);
strimall(szField);
if(NULL == (pstKey = pFindField(ps->m_stKey, ps->m_lIdxNum, szField)))
{
fprintf(stderr, "field %s not define\n", szField);
return RC_FAIL;
}
strcpy(ps->m_stGrpUp[ps->m_lGrpUp].m_szField, szField);
ps->m_stGrpUp[ps->m_lGrpUp].m_lFrom = pstKey->m_lFrom;
ps->m_stGrpUp[ps->m_lGrpUp].m_lLen = pstKey->m_lLen;
@ -622,11 +638,15 @@ long lIndexField(char *s, TblDef *ps, Uenum em)
ps->m_lGrpUp ++;
}
if(0 == ps->m_lGrpUp)
if(0 == ps->m_lGrpUp || ps->m_lGrpLen > MAX_INDEX_LEN)
{
fprintf(stderr, "index is too long or index field lost\n");
return RC_FAIL;
}
return RC_SUCC;
}
fprintf(stderr, "create index syntax error\n");
return RC_FAIL;
}
@ -788,10 +808,7 @@ long lAnalysIndex(char *s, long len, TblDef *ps, bool bQueue)
}
if(RC_SUCC != lRet)
{
fprintf(stderr, "parse create syntax error\n");
return RC_FAIL;
}
}
return RC_SUCC;
@ -2629,6 +2646,8 @@ long lParseAdorn(SATvm *pstSavm, char *pszAdorn, long lCount, TField *pstFiel
long lNumber, i, j;
char szWord[64], szField[512], szOrder[512];
sltrim(pszAdorn);
srtrim(pszAdorn);
if(0 == strlen(pszAdorn))
return RC_SUCC;

View File

@ -158,7 +158,7 @@ void vTraceLog(const char *pszFile, int nLine, const char *fmt, ...)
pszFile, nLine, getpid(), syscall(SYS_gettid), ptm->tm_year + 1900, ptm->tm_mon + 1,
ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, tb.millitm, szMsg);
#else
fprintf(fp, "P=%d|T=%-7ld|D=%04d%02d%02d %02d%02d%02d:%03d %s\n",
fprintf(fp, "P=%d|T=%d|D=%04d%02d%02d %02d%02d%02d:%03d %s\n",
getpid(), syscall(SYS_gettid), ptm->tm_year + 1900, ptm->tm_mon + 1,
ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, tb.millitm, szMsg);
#endif
@ -4281,9 +4281,15 @@ void* pParsePacket(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
pstCond = &pstSavm->stUpdt;
memcpy(&pstCond->uFldcmp, pvData, sizeof(uint));
if(0 == pstCond->uFldcmp) return pvBuffer;
if(0 == pstCond->uFldcmp)
{
memset(pvBuffer, 0, pstFace->m_lDLen);
return pvBuffer;
}
for(i = 0, pvData += sizeof(uint), pstVoid += pstFace->m_lDLen; i < pstCond->uFldcmp; i ++)
pstVoid += pstFace->m_lDLen;
memset(pstVoid, 0, pstFace->m_lDLen);
for(i = 0, pvData += sizeof(uint); i < pstCond->uFldcmp; i ++)
{
pstFld = &pstCond->stFdKey[i];
memcpy(pstFld, pvData, sizeof(FdKey));
@ -5026,8 +5032,6 @@ long lTvmInsert(SATvm *pstSavm)
checkbuffer(pstSavm, pstRun, 1);
memcpy(pstRun->pstVoid + sizeof(TFace), pstSavm->pstVoid, pstSavm->lSize);
fprintf(stderr, "Benum:%d, Uenum:%d, TABLE:%d, uint:%d, uint:%d, size_t:%d\n", pstFace->m_enum,
pstFace->m_lFind, pstFace->m_table, pstFace->m_lDLen, pstFace->m_lErrno, pstFace->m_lRows);
if(lWrite != lSendBuffer(pstSavm->m_skSock, (void *)pstRun->pstVoid, lWrite))
{
pstSavm->m_lErrno = SOCK_COM_EXCP;

View File

@ -180,6 +180,8 @@ void vPrintHex(char *s, long lIdx, bool bf)
{
int i = 0;
FILE *fp = NULL;
if(lIdx <= 0) return ;
if(!bf)
{
@ -3375,6 +3377,7 @@ SHTree* pInsertGroup(SATvm *pstSavm, void *pvAddr, SHTree *pstRoot, void *psvIdx
return NULL;
}
*ppstTruck = pstTruck;
return pstRoot;
}
}

View File

@ -1,5 +1,5 @@
set TABLE=20
set TABLESPACE=50000
set TABLESPACE=1000
create table TBL_USER_INFO
(