Meituan-Dianping / Meituan-Dianping/Zebra
分库分表时RouterResult不是SingleTarget的情况下希望也打印路由出来的db和sql debug日志,方便调试
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.8k
- Forks
- 705
- PR merge metrics
- No merged PRs in 30d
Description
com.dianping.zebra.shard.jdbc.ShardStatement#executeQueryByOriginal
此方法中isSingleTarget(routerTarget)情况下打印了db,sql日志;希望else情况下也将db、sql日志打印出来。谢谢!
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("db:" + targetedSql.getDatabaseName());
LOGGER.debug("sql:" + executableSql);
}
if (isSingleTarget(routerTarget)) {
// if has only one sql,then serial execute it
for (RouterTarget targetedSql : routerTarget.getSqls()) {
for (String executableSql : targetedSql.getSqls()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("db:" + targetedSql.getDatabaseName());
LOGGER.debug("sql:" + executableSql);
}
Connection conn = connection.getRealConnection(targetedSql.getDatabaseName(), autoCommit);
Statement stmt = createStatement(conn);
actualStatements.add(stmt);
resultList.add(stmt.executeQuery(executableSql));
}
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at com.dianping.zebra.shard.jdbc.ShardStatement#executeQueryByOriginal and compare the existing debug logging in the isSingleTarget(routerTarget) branch with the other execution path. The change is complete when routed database names and executable SQL statements are also logged at debug level for non-single targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100