Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 470284: Do not log a stack trace when creating a schema is no sequence #394

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Cousjava
Copy link
Member

When useing the schema generation option of JPA, eclipselink tries to read from an Oracle Database sequence to determine if it should be altered or created.

The checkIfExist() uses the general code for executing queries on the database. And thus when the sequence does not exist, it logs a stacktrace.
The exception is later on swallowed and a false is returned as the result for checkIfExist.

The exception is very irritating as it is just part of the normal processing and doe not indicate a problem with the deploy or schema generation, so this PR hides it at FINEST level.

@Cousjava Cousjava changed the title Do not log a stack trace when creating a schema is no sequence Bug 470284: Do not log a stack trace when creating a schema is no sequence Mar 25, 2019
@Cousjava
Copy link
Member Author

@lukasj @dazey3 @jgrassel Could this PR be reviewed please?

@Cousjava
Copy link
Member Author

Cousjava commented Nov 8, 2019

@rfelcman Could you re-review please?

@rfelcman
Copy link
Contributor

Sorry, I don't think, that this good. There are two reasons why I can't approve this PR:

  1. Raise log level to SessionLog.FINEST. This code will override user preferences and could generate some unnecessary messages. What about, if user wants just log messages with INFO log level and higher (WARNING, SEVERE) only.

  2. Compare output before this fix and after.
    Before fix:

[EL Warning]: ServerSession(1168849885)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 3.0.0.v201911110916): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist

Error Code: 2289
Call: SELECT ADDRESS_SEQ.NEXTVAL FROM DUAL
Query: ValueReadQuery(sql="SELECT ADDRESS_SEQ.NEXTVAL FROM DUAL")

I don't see there any stacktrace as You mentioned in PR comment.

After fix:

[EL Warning]: ServerSession(1168849885)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 3.0.0.v201911101900): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist

Error Code: 2289
Call: SELECT ADDRESS_SEQ.NEXTVAL FROM DUAL
Query: ValueReadQuery(sql="SELECT ADDRESS_SEQ.NEXTVAL FROM DUAL")
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM JPA2_XML_LOCATION_SEQ WHERE SEQ_NAME = 'LOCATION_SEQ'")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT * FROM JPA2_XML_LOCATION_SEQ WHERE SEQ_NAME = 'LOCATION_SEQ'
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM XML_CUSTOMER_SEQ WHERE SEQ_NAME = 'ORDER_CARD_SEQ'")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT * FROM XML_CUSTOMER_SEQ WHERE SEQ_NAME = 'ORDER_CARD_SEQ'
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM JPA_ORPHAN_REMOVAL_SEQUENCE WHERE SEQ_NAME = 'ENGINE_SEQ'")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT * FROM JPA_ORPHAN_REMOVAL_SEQUENCE WHERE SEQ_NAME = 'ENGINE_SEQ'
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM CMP3_ENTITYD_SEQ WHERE SEQ_NAME = 'ENTITYD_SEQ'")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT * FROM CMP3_ENTITYD_SEQ WHERE SEQ_NAME = 'ENTITYD_SEQ'
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN_TABLE'")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT * FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN_TABLE'
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].
[EL Finest]: query: ServerSession(1168849885)--Thread(Thread[main,5,main])--Execute query ValueReadQuery(sql="SELECT MaterialEreignisSEQ.NEXTVAL FROM DUAL")
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection acquired from connection pool [read].
[EL Fine]: sql: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--SELECT MaterialEreignisSEQ.NEXTVAL FROM DUAL
[EL Finest]: connection: ServerSession(1168849885)--Connection(1835638995)--Thread(Thread[main,5,main])--Connection released to connection pool [read].

There just unnecessary messages -> high amount of log messages -> resources consumption -> there is problem with Travis build too -> see in the last Travis-CI build (attached with last commit in this PR) https://travis-ci.org/eclipse-ee4j/eclipselink/jobs/609266315?utm_medium=notification&utm_source=github_status .

Maybe there is something about persistence.xml. Could You please provide it. Could You please provide mentioned stack trace output too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants