Merge pull request #27434 from taosdata/enh/TD-31543-3.0
enh: rm ASSERT in mndArbGroup.c/geosWrapper.c/geomFuncTestUtil.cpp
This commit is contained in:
commit
f240c78f76
|
@ -29,7 +29,7 @@ void mndReleaseArbGroup(SMnode *pMnode, SArbGroup *pObj);
|
||||||
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup);
|
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup);
|
||||||
SSdbRow *mndArbGroupActionDecode(SSdbRaw *pRaw);
|
SSdbRow *mndArbGroupActionDecode(SSdbRaw *pRaw);
|
||||||
|
|
||||||
void mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup);
|
int32_t mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup);
|
||||||
|
|
||||||
int32_t mndSetCreateArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup);
|
int32_t mndSetCreateArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup);
|
||||||
int32_t mndSetCreateArbGroupUndoLogs(STrans *pTrans, SArbGroup *pGroup);
|
int32_t mndSetCreateArbGroupUndoLogs(STrans *pTrans, SArbGroup *pGroup);
|
||||||
|
|
|
@ -102,8 +102,10 @@ void mndReleaseArbGroup(SMnode *pMnode, SArbGroup *pGroup) {
|
||||||
sdbRelease(pSdb, pGroup);
|
sdbRelease(pSdb, pGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup) {
|
int32_t mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup) {
|
||||||
ASSERT(pVgObj->replica == 2);
|
if (pVgObj->replica != 2) {
|
||||||
|
TAOS_RETURN(TSDB_CODE_INVALID_PARA);
|
||||||
|
}
|
||||||
(void)memset(outGroup, 0, sizeof(SArbGroup));
|
(void)memset(outGroup, 0, sizeof(SArbGroup));
|
||||||
outGroup->dbUid = pVgObj->dbUid;
|
outGroup->dbUid = pVgObj->dbUid;
|
||||||
outGroup->vgId = pVgObj->vgId;
|
outGroup->vgId = pVgObj->vgId;
|
||||||
|
@ -111,6 +113,8 @@ void mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup) {
|
||||||
SArbGroupMember *pMember = &outGroup->members[i];
|
SArbGroupMember *pMember = &outGroup->members[i];
|
||||||
pMember->info.dnodeId = pVgObj->vnodeGid[i].dnodeId;
|
pMember->info.dnodeId = pVgObj->vnodeGid[i].dnodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup) {
|
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup) {
|
||||||
|
|
|
@ -629,7 +629,7 @@ static int32_t mndSetCreateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
||||||
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
||||||
SVgObj *pVgObj = pVgroups + v;
|
SVgObj *pVgObj = pVgroups + v;
|
||||||
SArbGroup arbGroup = {0};
|
SArbGroup arbGroup = {0};
|
||||||
mndArbGroupInitFromVgObj(pVgObj, &arbGroup);
|
TAOS_CHECK_RETURN(mndArbGroupInitFromVgObj(pVgObj, &arbGroup));
|
||||||
TAOS_CHECK_RETURN(mndSetCreateArbGroupRedoLogs(pTrans, &arbGroup));
|
TAOS_CHECK_RETURN(mndSetCreateArbGroupRedoLogs(pTrans, &arbGroup));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ static int32_t mndSetCreateDbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
||||||
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
||||||
SVgObj *pVgObj = pVgroups + v;
|
SVgObj *pVgObj = pVgroups + v;
|
||||||
SArbGroup arbGroup = {0};
|
SArbGroup arbGroup = {0};
|
||||||
mndArbGroupInitFromVgObj(pVgObj, &arbGroup);
|
TAOS_CHECK_RETURN(mndArbGroupInitFromVgObj(pVgObj, &arbGroup));
|
||||||
TAOS_CHECK_RETURN(mndSetCreateArbGroupUndoLogs(pTrans, &arbGroup));
|
TAOS_CHECK_RETURN(mndSetCreateArbGroupUndoLogs(pTrans, &arbGroup));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ static int32_t mndSetCreateDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
|
||||||
SVgObj *pVgObj = pVgroups + v;
|
SVgObj *pVgObj = pVgroups + v;
|
||||||
SArbGroup arbGroup = {0};
|
SArbGroup arbGroup = {0};
|
||||||
mndArbGroupInitFromVgObj(pVgObj, &arbGroup);
|
TAOS_CHECK_RETURN(mndArbGroupInitFromVgObj(pVgObj, &arbGroup));
|
||||||
TAOS_CHECK_RETURN(mndSetCreateArbGroupCommitLogs(pTrans, &arbGroup));
|
TAOS_CHECK_RETURN(mndSetCreateArbGroupCommitLogs(pTrans, &arbGroup));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1156,51 +1156,45 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb) {
|
static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb) {
|
||||||
int32_t code = 0;
|
int32_t code = 0, lino = 0;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
|
SVgObj *pVgroup = NULL;
|
||||||
SArray *pArray = mndBuildDnodesArray(pMnode, 0);
|
SArray *pArray = mndBuildDnodesArray(pMnode, 0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SVgObj *pVgroup = NULL;
|
|
||||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
if (mndVgroupInDb(pVgroup, pNewDb->uid)) {
|
if (mndVgroupInDb(pVgroup, pNewDb->uid)) {
|
||||||
SVgObj newVgroup = {0};
|
SVgObj newVgroup = {0};
|
||||||
if ((code = mndBuildAlterVgroupAction(pMnode, pTrans, pOldDb, pNewDb, pVgroup, pArray, &newVgroup)) != 0) {
|
TAOS_CHECK_GOTO(mndBuildAlterVgroupAction(pMnode, pTrans, pOldDb, pNewDb, pVgroup, pArray, &newVgroup), &lino,
|
||||||
sdbCancelFetch(pSdb, pIter);
|
_err);
|
||||||
sdbRelease(pSdb, pVgroup);
|
|
||||||
taosArrayDestroy(pArray);
|
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
|
||||||
if (pNewDb->cfg.withArbitrator != pOldDb->cfg.withArbitrator) {
|
if (pNewDb->cfg.withArbitrator != pOldDb->cfg.withArbitrator) {
|
||||||
if (pNewDb->cfg.withArbitrator) {
|
if (pNewDb->cfg.withArbitrator) {
|
||||||
SArbGroup arbGroup = {0};
|
SArbGroup arbGroup = {0};
|
||||||
mndArbGroupInitFromVgObj(&newVgroup, &arbGroup);
|
TAOS_CHECK_GOTO(mndArbGroupInitFromVgObj(&newVgroup, &arbGroup), &lino, _err);
|
||||||
if ((code = mndSetCreateArbGroupCommitLogs(pTrans, &arbGroup)) != 0) {
|
TAOS_CHECK_GOTO(mndSetCreateArbGroupCommitLogs(pTrans, &arbGroup), &lino, _err);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
|
||||||
sdbRelease(pSdb, pVgroup);
|
|
||||||
taosArrayDestroy(pArray);
|
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SArbGroup arbGroup = {0};
|
SArbGroup arbGroup = {0};
|
||||||
mndArbGroupInitFromVgObj(pVgroup, &arbGroup);
|
TAOS_CHECK_GOTO(mndArbGroupInitFromVgObj(pVgroup, &arbGroup), &lino, _err);
|
||||||
if ((code = mndSetDropArbGroupCommitLogs(pTrans, &arbGroup)) != 0) {
|
TAOS_CHECK_GOTO(mndSetDropArbGroupCommitLogs(pTrans, &arbGroup), &lino, _err);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_err:
|
||||||
|
mError("db:%s, %s failed at %d since %s", pNewDb->name, __func__, lino, tstrerror(code));
|
||||||
|
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
|
||||||
|
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,18 +331,26 @@ int32_t doGeosRelation(const GEOSGeometry *geom1, const GEOSPreparedGeometry *pr
|
||||||
|
|
||||||
if (!preparedGeom1) {
|
if (!preparedGeom1) {
|
||||||
if (!swapped) {
|
if (!swapped) {
|
||||||
ASSERT(relationFn);
|
if (!relationFn) {
|
||||||
|
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||||
|
}
|
||||||
*res = relationFn(geosCtx->handle, geom1, geom2);
|
*res = relationFn(geosCtx->handle, geom1, geom2);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(swappedRelationFn);
|
if (!swappedRelationFn) {
|
||||||
|
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||||
|
}
|
||||||
*res = swappedRelationFn(geosCtx->handle, geom1, geom2);
|
*res = swappedRelationFn(geosCtx->handle, geom1, geom2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!swapped) {
|
if (!swapped) {
|
||||||
ASSERT(preparedRelationFn);
|
if (!preparedRelationFn) {
|
||||||
|
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||||
|
}
|
||||||
*res = preparedRelationFn(geosCtx->handle, preparedGeom1, geom2);
|
*res = preparedRelationFn(geosCtx->handle, preparedGeom1, geom2);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(swappedPreparedRelationFn);
|
if (!swappedPreparedRelationFn) {
|
||||||
|
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||||
|
}
|
||||||
*res = swappedPreparedRelationFn(geosCtx->handle, preparedGeom1, geom2);
|
*res = swappedPreparedRelationFn(geosCtx->handle, preparedGeom1, geom2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,7 +399,9 @@ int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom,
|
||||||
const GEOSPreparedGeometry **outputPreparedGeom) {
|
const GEOSPreparedGeometry **outputPreparedGeom) {
|
||||||
SGeosContext *geosCtx = getThreadLocalGeosCtx();
|
SGeosContext *geosCtx = getThreadLocalGeosCtx();
|
||||||
|
|
||||||
ASSERT(outputGeom); // it is not allowed if outputGeom is NULL
|
if (!outputGeom) {
|
||||||
|
return TSDB_CODE_FUNC_FUNTION_PARA_VALUE;
|
||||||
|
}
|
||||||
*outputGeom = NULL;
|
*outputGeom = NULL;
|
||||||
|
|
||||||
if (outputPreparedGeom) { // it means not to generate PreparedGeometry if outputPreparedGeom is NULL
|
if (outputPreparedGeom) { // it means not to generate PreparedGeometry if outputPreparedGeom is NULL
|
||||||
|
|
|
@ -66,7 +66,7 @@ void setScalarParam(SScalarParam *sclParam, int32_t type, void *valueArray, TDRo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
ASSERT(0);
|
ASSERT_TRUE(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue