mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 11:16:04 +02:00
Do not log nested transactions in production (#2251)
This might be the cause of the SQL performance degradation that we are observing during the recent launch. The change went in a month ago but there hasn't been enough increase in mutating traffic to make it problematic until the launch. Note that presubmits should run faster too with this chance, which serves as an evidence that excessive logging is the culprit.
This commit is contained in:
parent
923bc13e3a
commit
e82cbe60a9
1 changed files with 5 additions and 1 deletions
|
@ -33,6 +33,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Streams;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.flogger.StackSize;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.persistence.JpaRetries;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
|
@ -164,7 +165,10 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager {
|
|||
if (!getHibernateAllowNestedTransactions()) {
|
||||
throw new IllegalStateException(NESTED_TRANSACTION_MESSAGE);
|
||||
}
|
||||
logger.atWarning().withStackTrace(StackSize.MEDIUM).log(NESTED_TRANSACTION_MESSAGE);
|
||||
if (RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION
|
||||
&& RegistryEnvironment.get() != RegistryEnvironment.UNITTEST) {
|
||||
logger.atWarning().withStackTrace(StackSize.MEDIUM).log(NESTED_TRANSACTION_MESSAGE);
|
||||
}
|
||||
// This prevents inner transaction from retrying, thus avoiding a cascade retry effect.
|
||||
return transactNoRetry(work, isolationLevel);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue