pkp / ots

PKP XML Parsing Service
GNU General Public License v3.0
32 stars 19 forks source link

Define default value for field trace in table queue_default while initializing the database #138

Closed fabiobatalha closed 6 years ago

fabiobatalha commented 6 years ago

screenshot from 2018-03-28 10-42-38

axfelix commented 6 years ago

Haven't seen this before -- under what circumstance did it occur?

fabiobatalha commented 6 years ago

It happens when you install OTS for the first time.

I'm having it because I'm building the dockerized environment. The datamodel do not define the trace field as default Null.

I fixed the error just adjusting the default value of the field "trace" to Null after initialize the database.

axfelix commented 6 years ago

Can you replicate it with https://github.com/axfelix/ots-vagrant ?

It might be a difference between MySQL versions or something... I haven't encountered it yet...

fabiobatalha commented 6 years ago

I didn't tried vagrant.

axfelix commented 6 years ago

I didn't mean vagrant specifically, I meant the environment / packages that are used in that vagrant installer -- there might be a mismatch that's triggering this.

fabiobatalha commented 6 years ago

ahh ok.. The MySQL version is not pinned in the xmlps.sh file so to figure out the version I will need to replicate the vagrant environment, but it seems to be old because PHP is still the v5.2.

The version I'm using in the Docker Environment is the last one available: mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper

kaschioudi commented 6 years ago

Recent versions of MySQL are quite strict with Data Definition statements. Multiple SQL mode have been introduced. I am not sure if this issue is related but check your Mysql install SQL mode. Sometimes a quick a dirty way is to run set sql_mode=''; before your SQL statements.

fabiobatalha commented 6 years ago

Hello @kaschioudi

Yes, a more strict Data Definition lead to a better quality and predicted behaviour. I think the matter of this issue is not to prove in which version of MySQL the code works or not, but improve the source code of OTS.

It seems to me a clear missing configuration in the data model according to the usage of it. I mean, in one side, there are input attempts that do not explicit define a value for the field queue_default.trace, in the other side, the data model do not explicit define a default value to the field queue_default.trace, and all this is leading to the given error.

kaschioudi commented 6 years ago

Thank you @fabiobatalha for you valuable contributions. I was not providing a final solution to this issue..

You mentioned having an error while building a docker environment and that you fixed the error by adjusting the default value of the field "trace" to Null *after* initialize the database. I was just suggesting a quick workaround to get you up and running with your recent version of MySQL using the existing codebase.

fabiobatalha commented 6 years ago

@kaschioudi Thanks!

I already worked around it. From my side it is ok, the change I made in the database allowed me to fully test the Docker Environment, The Docker Image is published and working.

axfelix commented 6 years ago

FYI, I would happily merge a forward-compatible fix for this if you had one :)

fabiobatalha commented 6 years ago

I don't but I will try to do it, and make a PR.

axfelix commented 6 years ago

OK, I didn't realize this was actually just toggling some existing behaviour rather than adding a declaration, which is confusing, I'll have to test more why this is happening unless @kaschioudi has any ideas

kaschioudi commented 6 years ago

@axfelix : I tested this today. You can rebase and merge this.

Basically this will make trace column of queue_default table nullable.

axfelix commented 6 years ago

Thanks, done!