enh: no shuffle for array with one element
This commit is contained in:
parent
debd1e2308
commit
5d62dce2c2
|
@ -958,12 +958,14 @@ static int32_t s3InitEpIndexArray(SArray** pIndexArray) {
|
||||||
taosArraySet(indexArray, i, &i);
|
taosArraySet(indexArray, i, &i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tsS3EpNum > 1) {
|
||||||
for (int8_t i = 0; i < tsS3EpNum; ++i) {
|
for (int8_t i = 0; i < tsS3EpNum; ++i) {
|
||||||
int8_t j = taosRand() % tsS3EpNum;
|
int8_t j = taosRand() % tsS3EpNum;
|
||||||
int8_t tmp = *(int8_t *)taosArrayGet(indexArray, i);
|
int8_t tmp = *(int8_t *)taosArrayGet(indexArray, i);
|
||||||
taosArraySet(indexArray, i, taosArrayGet(indexArray, j));
|
taosArraySet(indexArray, i, taosArrayGet(indexArray, j));
|
||||||
taosArraySet(indexArray, j, &tmp);
|
taosArraySet(indexArray, j, &tmp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*pIndexArray = indexArray;
|
*pIndexArray = indexArray;
|
||||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||||
|
|
Loading…
Reference in New Issue