HHH-11209 : Log a DEBUG message if collection with queued operations is detached due to rollback; otherwise, log INFO message

(cherry picked from commit e12a688524)
This commit is contained in:
Gail Badner 2018-11-14 00:25:24 -08:00
parent 8c5b1b7740
commit 36877bfd69
2 changed files with 22 additions and 12 deletions

View File

@ -627,6 +627,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
if ( !isTempSession ) { if ( !isTempSession ) {
if ( hasQueuedOperations() ) { if ( hasQueuedOperations() ) {
final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() ); final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() );
try {
final TransactionStatus transactionStatus = final TransactionStatus transactionStatus =
session.getTransactionCoordinator().getTransactionDriverControl().getStatus(); session.getTransactionCoordinator().getTransactionDriverControl().getStatus();
if ( transactionStatus.isOneOf( if ( transactionStatus.isOneOf(
@ -636,9 +637,18 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
TransactionStatus.FAILED_ROLLBACK, TransactionStatus.FAILED_ROLLBACK,
TransactionStatus.ROLLING_BACK TransactionStatus.ROLLING_BACK
) ) { ) ) {
// It was due to a rollback.
LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString ); LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString );
} }
else { else {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
}
}
catch (Exception e) {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString ); LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
} }
} }

View File

@ -1823,7 +1823,7 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Attaching an uninitialized collection with queued operations to a session: %s", id = 495) @Message(value = "Attaching an uninitialized collection with queued operations to a session: %s", id = 495)
void queuedOperationWhenAttachToSession(String collectionInfoString); void queuedOperationWhenAttachToSession(String collectionInfoString);
@LogMessage(level = WARN) @LogMessage(level = INFO)
@Message(value = "Detaching an uninitialized collection with queued operations from a session: %s", id = 496) @Message(value = "Detaching an uninitialized collection with queued operations from a session: %s", id = 496)
void queuedOperationWhenDetachFromSession(String collectionInfoString); void queuedOperationWhenDetachFromSession(String collectionInfoString);