Don't log failures during autoddl run
Description
is related to
relates to
Activity
Matthew Jones January 10, 2016 at 11:30 AM
Attached a patch, it's not great but it seems as minimal as I can think of. Really just changes the failquiet parameter to an integer so there's more options around it while allowing for the old boolean to still function to reduce the amount of code that needs to change.
ddl calls directly into dbWrite now with an integer value that will avoid having it print the log message. Please comment/review.
Matthew Jones January 9, 2016 at 12:52 PMEdited
I also didn't see the conversation on the (closed) pull request, but sounds like it was similar to my concerns here. I just noticed this today though and feel it should be a blocker for 11 (and possibly even 10.7)
I feel like the targeted ddl specific fix would be easy to implement and maybe the easiest since this is the specific problem we're having.
I also moved this to KNL because I feel like it's going to be a fix again to BasicSqlService rather than the sql files.
Matthew Jones January 9, 2016 at 12:50 PM
Yeah, this seems like a not so great regresion. Previously when failQuiet was enabled it was really because methods like ddl were calling
dbWriteFailQuiet
And were expecting it to try to run the first statement, and fail without writing any output. I think we'd have to change every statement for MySQL to a "NOT EXISTS" because then the first statement wouldn't fail and DDL would just fail somewhere else and produce this message.
Though I don't think Oracle even has this pattern.
I'd certainly like to avoid all of these errors too. I understand the motivation for but do we need another separate parameter to indicate that this is from the ddl process so that it really fails quietly? I don't know how else to capture the use case of "we want errors when the record already exists, but not during the ddl process"
Matthew Buckett September 30, 2015 at 5:07 AM
I think we're only seeing these errors because of the change in which added the warning.
Currently, when starting up Sakai for the second time with auto.ddl on, a number of errors are produced because tables are attempted to be created when they already exist.
MySQL provides CREATE TABLE IF NOT EXISTS to avoid this error.
MySQL also provides INSERT IGNORE INTO to avoid duplicate errors.
Here is a sample of the errors I'd like to avoid:
2015-08-21 15:38:05,684 WARN localhost-startStop-1 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): recordAlreadyExists: false, failQuiet: true, : error code: 1050, sql: CREATE TABLE SAKAI_LOCKS ( TABLE_NAME VARCHAR (64), RECORD_ID VARCHAR (512), LOCK_TI
ME DATETIME, USAGE_SESSION_ID VARCHAR (36) ), binds: , error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'sakai_locks' already exists
2015-08-21 15:38:05,991 WARN localhost-startStop-1 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): recordAlreadyExists: false, failQuiet: true, : error code: 1050, sql: CREATE TABLE SAKAI_EVENT ( EVENT_ID BIGINT AUTO_INCREMENT, EVENT_DATE TIMESTAMP, EVE
NT VARCHAR (32), REF VARCHAR (255), CONTEXT VARCHAR (255), SESSION_ID VARCHAR (163), EVENT_CODE VARCHAR (1), PRIMARY KEY (EVENT_ID) ), binds: , error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'sakai_event' already exists
2015-08-21 15:38:15,402 WARN localhost-startStop-1 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): recordAlreadyExists: false, failQuiet: true, : error code: 1050, sql: CREATE TABLE SAKAI_PREFERENCES ( PREFERENCES_ID VARCHAR (99) NOT NULL, XML LONGTEXT
), binds: , error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'sakai_preferences' already exists
2015-08-21 15:38:15,484 WARN localhost-startStop-1 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): recordAlreadyExists: false, failQuiet: true, : error code: 1050, sql: CREATE TABLE SAKAI_USER_PROPERTY ( USER_ID VARCHAR (99) NOT NULL, NAME
VARCHAR (99) NOT NULL, VALUE LONGTEXT NULL ), binds: , error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'sakai_user_property' already exists
2015-08-21 15:38:15,487 WARN localhost-startStop-1 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): recordAlreadyExists: false, failQuiet: true, : error code: 1060, sql: ALTER TABLE SAKAI_USER ADD (EMAIL_LC VARCHAR (255)), binds: , error: com.mysql.jdbc.
exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'EMAIL_LC'