Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
1) session::insertTablet() and session::insertTablets() are main API used by customer.
2) custeomer's client oftern inserts 5000~50000 rows per 1 tablet,
3) Call stack example: session::insertTablet() => Session::sortTablet() => Session::sortIndexByTimestamp()
so these functions' efficiency is sensitive. But current sortIndexByTimestamp() use insert sort Algorithm, which causes 100~3000 times efficiency lossing.
On the other hande, Session::insertTablets() has another useless code that reduces performance.
void Session::insertTablets(map<string, Tablet *> &tablets, bool sorted) {
TSInsertTabletsReq request;
request.__set_sessionId(sessionId);
for (const auto &item: tablets) {
if (sorted) {
if (!checkSorted(*(item.second))) {
throw BatchExecutionException("Times in Tablet are not in ascending order");
}
} else {
sortTablet(*(item.second)); //here, it is wastful to let map search again.
{color:#de350b}}
Attachments
Issue Links
- links to