|
@@ -19,7 +19,6 @@ import com.alicloud.openservices.tablestore.model.search.sort.Sort;
|
|
|
import com.alicloud.openservices.tablestore.model.search.sort.SortOrder;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.collections4.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
@@ -51,6 +50,7 @@ public class TableStoreUtils {
|
|
|
@Value("${tableStore.instanceName}")
|
|
|
private String instanceName;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 单词交互条数 200条
|
|
|
*/
|
|
@@ -135,34 +135,34 @@ public class TableStoreUtils {
|
|
|
throw new BusinessException(ErrorCodeEnum.ERROR_PARAM.getCode(), "主键与字段数量不匹配");
|
|
|
}
|
|
|
|
|
|
- //<=最大传输数量直接执行
|
|
|
- if(CollectionUtil.isEmpty(pkValueList) && pkValueList.size()<=MAX_COUNT_ONCE){
|
|
|
- doBatchPutRow(primaryKeyName,pkValueList,tableName,columnsList);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //拆成多个list,按核数去拆(200一个list)
|
|
|
- List<List<String>> pkValuePartitionList = ListUtils.partition(pkValueList, MAX_COUNT_ONCE);
|
|
|
- List<List<List<Column>>> columnsPartitionList = ListUtils.partition(columnsList, MAX_COUNT_ONCE);
|
|
|
-
|
|
|
- log.info("batchPutRow 拆分任务数:"+pkValuePartitionList.size());
|
|
|
-
|
|
|
- //丢给执行器去多线程执行
|
|
|
- for(int i=0;i<pkValuePartitionList.size();i++){
|
|
|
- final int num = i;
|
|
|
- List<String> tempPkList = pkValuePartitionList.get(i);
|
|
|
- List<List<Column>> tempColumnsList = columnsPartitionList.get(i);
|
|
|
-
|
|
|
-
|
|
|
- taskExecutor.execute(()->{
|
|
|
- long begin = System.currentTimeMillis();
|
|
|
- log.info("第"+num+"个任务开始");
|
|
|
- doBatchPutRow(primaryKeyName,tempPkList,tableName,tempColumnsList);
|
|
|
- long end = System.currentTimeMillis();
|
|
|
- log.info("第"+num+"个任务结束,耗时"+(end-begin));
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
+ doBatchPutRow(primaryKeyName,pkValueList,tableName,columnsList);
|
|
|
+
|
|
|
+// //<=最大传输数量直接执行
|
|
|
+// if(CollectionUtil.isEmpty(pkValueList) && pkValueList.size()<=MAX_COUNT_ONCE){
|
|
|
+// doBatchPutRow(primaryKeyName,pkValueList,tableName,columnsList);
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// //拆成多个list,按核数去拆(200一个list)
|
|
|
+// List<List<String>> pkValuePartitionList = ListUtils.partition(pkValueList, MAX_COUNT_ONCE);
|
|
|
+// List<List<List<Column>>> columnsPartitionList = ListUtils.partition(columnsList, MAX_COUNT_ONCE);
|
|
|
+//
|
|
|
+// log.info("batchPutRow 拆分任务数:"+pkValuePartitionList.size());
|
|
|
+//
|
|
|
+// //丢给执行器去多线程执行
|
|
|
+// for(int i=0;i<pkValuePartitionList.size();i++){
|
|
|
+// final int num = i;
|
|
|
+// List<String> tempPkList = pkValuePartitionList.get(i);
|
|
|
+// List<List<Column>> tempColumnsList = columnsPartitionList.get(i);
|
|
|
+// taskExecutor.execute(()->{
|
|
|
+// long begin = System.currentTimeMillis();
|
|
|
+// log.info("第"+num+"个任务开始");
|
|
|
+// doBatchPutRow(primaryKeyName,tempPkList,tableName,tempColumnsList);
|
|
|
+// long end = System.currentTimeMillis();
|
|
|
+// log.info("第"+num+"个任务结束,耗时"+(end-begin));
|
|
|
+//
|
|
|
+// });
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/**
|