【 使用环境 】生产环境
【 OB or 其他组件 】OB
【 使用版本 】OB
【问题描述】相同的jdbc代码,查询相同的表,数据量1亿作用,直连oracle数据库查询没有问题,用oceanbase oracle模式查询内存溢出(已设置相关参数)
【复现路径】
public void run(SourceContext sourceContext) throws Exception {
try (Connection conn = DriverManager.getConnection(“jdbc:oceanbase:loadbalance://xxx:xx/xx?characterEncoding=UTF-8”, “xxx”, “xxx”)) {
try (Statement stmt = conn.prepareStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
stmt.setFetchSize(5000);
try (ResultSet rs = stmt.executeQuery("select * from hdp.test01 ")) {
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
while (rs.next()) {
HashMap rowMap = new HashMap();
for (int i = 1; i <= columnCount; i++) {
String value = rs.getObject(i) != null ? rs.getObject(i).toString() : null;
rowMap.put(md.getColumnName(i), value);
}
sourceContext.collect(rowMap.toString());
}
} catch (SQLException e) {
e.printStackTrace();
throw new Exception(e);
}
}
} catch (SQLException e) {
e.printStackTrace();
throw new Exception(e);
}
}
@Override
public void cancel() {
}
};
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):