堆栈深度超过限制

报错:Cause: com.kingbase8.util.KSQLException: 错误: 堆栈深度超过限制 Hint: 在确定了平台的堆栈深度限制是足够大后,增加配置参数 "max_stack_depth"的值(当前值为2048kB).; 错误: 堆栈深度超过限制 Hint: 在确定了平台的堆栈深度限制是足够大后,增加配置参数 "max_stack_depth"的值(当前值为2048kB).; nested exception is com.kingbase8.util.KSQLException: 错误: 堆栈深度超过限制 Hint: 在确定了平台的堆栈深度限制是足够大后,增加配置参数 "max_stack_depth"的值(当前值为2048kB).]

经过以下改进仍没能解决:

java 复制代码
        List<String> sampleInfoIds = sampleInfoList.parallelStream()
                .map(BaseEntity::getId).collect(Collectors.toList());//sampleInfoIds过大
        List<String> subList1 = sampleInfoIds.subList(0, sampleInfoIds.size() / 2);
        List<String> subList2 = sampleInfoIds.subList(sampleInfoIds.size() / 2, sampleInfoIds.size()-1);
    
        List<SampleInfoDTO> sampleInfoDTOList = sampleInfoMapper.getSampleInfoDTOByIds(subList1);
        List<SampleInfoDTO> sampleInfoDTOList1 =sampleInfoMapper.getSampleInfoDTOByIds(subList2);
        sampleInfoDTOList.addAll(sampleInfoDTOList1);
java 复制代码
  List<String> sampleInfoIds = sampleInfoList.parallelStream()
                .map(BaseEntity::getId).collect(Collectors.toList());
        int batch=7000;
        int c=(int) Math.ceil((sampleInfoIds.size()*1.0)/batch);
        List<SampleInfoDTO> sampleInfoDTOList=new ArrayList<>();
        List<CompletableFuture> completableFutures=new ArrayList<>();
        for (int i=0;i<c;i++){
            int fromIndex=i*batch;
            int endIndex=(i+1)*batch-1;
            List<String> ids=sampleInfoIds.subList(fromIndex,Math.min(endIndex, sampleInfoIds.size()-1));
            CompletableFuture<List<SampleInfoDTO>> future = CompletableFuture.supplyAsync(() -> {
                return sampleInfoMapper.getSampleInfoDTOByIds(ids);
            }, executor);
            completableFutures.add(future);
        }
        CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).join();
        for (CompletableFuture future : completableFutures) {
            try {
                sampleInfoDTOList.addAll((List<SampleInfoDTO>)  future.get());
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            } catch (ExecutionException e) {
                throw new RuntimeException(e);
            }
        }
相关推荐
该用户已不存在1 小时前
MySQL 与 PostgreSQL,该怎么选?
数据库·mysql·postgresql
川石课堂软件测试2 小时前
自动化测试之 Cucumber 工具
数据库·功能测试·网络协议·测试工具·mysql·单元测试·prometheus
lang201509282 小时前
MySQL数据类型存储全解析
mysql
siriuuus3 小时前
Linux MySQL 多实例部署与配置实践
linux·运维·mysql
王木风4 小时前
1分钟理解什么是MySQL的Buffer Pool和LRU 算法?
前端·mysql
qq_404643346 小时前
MySQL中RUNCATE、DELETE、DROP 的基本介绍
数据库·mysql
像风一样!7 小时前
MySQL数据库如何实现主从复制
数据库·mysql
大白的编程日记.7 小时前
【MySQL】数据库表的CURD(二)
android·数据库·mysql
Olrookie8 小时前
MySQL运维常用SQL
运维·数据库·sql·mysql·dba
jingfeng5149 小时前
MySQL表的增删改查
数据库·mysql