Skip to content

Commit

Permalink
Add the high-contention warning
Browse files Browse the repository at this point in the history
If the number of serialization-related retry is greater than predefined
value (currently 8) a warning is issued instead of the usual debug
message. This is to tell administrator that something wrong - i.e. high
contention - is occurring.
  • Loading branch information
mederly committed Jun 6, 2018
1 parent e127003 commit cf323c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -104,6 +104,7 @@ public class SqlRepositoryServiceImpl extends SqlBaseService implements Reposito
public static final String PERFORMANCE_LOG_NAME = SqlRepositoryServiceImpl.class.getName() + ".performance";
public static final String CONTENTION_LOG_NAME = SqlRepositoryServiceImpl.class.getName() + ".contention";
public static final int CONTENTION_LOG_DEBUG_THRESHOLD = 3;
public static final int MAIN_LOG_WARN_THRESHOLD = 8;

private static final Trace LOGGER = TraceManager.getTrace(SqlRepositoryServiceImpl.class);
private static final Trace LOGGER_PERFORMANCE = TraceManager.getTrace(PERFORMANCE_LOG_NAME);
Expand Down
Expand Up @@ -216,7 +216,11 @@ public int logOperationAttempt(String oid, String operation, int attempt, @NotNu
} else {
CONTENTION_LOGGER.trace(message, objects);
}
LOGGER.debug(message, objects);
if (attempt >= SqlRepositoryServiceImpl.MAIN_LOG_WARN_THRESHOLD) {
LOGGER.warn(message, objects);
} else {
LOGGER.debug(message, objects);
}
if (waitTime > 0) {
try {
Thread.sleep(waitTime);
Expand Down

0 comments on commit cf323c7

Please sign in to comment.