• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.4.0
    • 2.4.0
    • None
    • None

      2015-05-07 10:47:16,227 ERROR [org.ametys.odf.export.ODFExportEngine] (ODFExportEngine;/plugins/core/servercomm/messages.xml) ODF export has failed
      com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
              at com.mysql.jdbc.Util.getInstance(Util.java:381)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
              at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
              at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
              at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
              at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
              at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:995)
              at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
              at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
              at org.ametys.odf.export.ExportManager.executeSqlQueries(ExportManager.java:482)
              at org.ametys.odf.export.ExportManager.export(ExportManager.java:218)
              at org.ametys.odf.export.ODFExportEngine.export(ODFExportEngine.java:186)
              at org.ametys.odf.export.ODFExportEngine.run(ODFExportEngine.java:104)
              at java.lang.Thread.run(Thread.java:662)
      

          [ODF-1048] L'export SQL des formations échoue

          En latin1, 200 + 1 + 200 + 1 + 4 < 1000, ça devrait passer.
          De toute façon nos ids ne prennent en réalité qu'un cinquantaines de caractères, donc on va tronquer encore plus pour la clef primaire, de façon à ce que ça fonctionne même en UTF-8: 100*4+1 + 100*4+1 + 4 = 806 < 1000

          Raphaël Franchet added a comment - En latin1, 200 + 1 + 200 + 1 + 4 < 1000, ça devrait passer. De toute façon nos ids ne prennent en réalité qu'un cinquantaines de caractères, donc on va tronquer encore plus pour la clef primaire, de façon à ce que ça fonctionne même en UTF-8: 100*4+1 + 100*4+1 + 4 = 806 < 1000

          Laurence Perier added a comment - - edited

          Avant :
          version 5.1.73
          Server characterset: latin1

          Après :
          version 5.1.73
          Server characterset: utf-8

          Laurence Perier added a comment - - edited Avant : version 5.1.73 Server characterset: latin1 Après : version 5.1.73 Server characterset: utf-8

          UTF-8 c'est pas 4 bytes, mais au maximum 3 je crois et le plus souvent 1 ou 2
          mais par contre, pourquoi nos id, on met 255 comme longueur ?
          et pourquoi dans primary key on met (200) et pas la même taille que la colonne concernée ?

          Cédric Damioli added a comment - UTF-8 c'est pas 4 bytes, mais au maximum 3 je crois et le plus souvent 1 ou 2 mais par contre, pourquoi nos id, on met 255 comme longueur ? et pourquoi dans primary key on met (200) et pas la même taille que la colonne concernée ?

          à priori il y a eu changement de serveur MySQL, ça marchait et ça marche plus.

          Version de mysql avant/après ?
          Encoding avant/après ?

          Voici la requête formatée

          CREATE TABLE odf_course_odf_courselist 
            (
              idUp_odf_courselist VARCHAR(255) COMMENT 'Identifiant de la liste des cours', 
              FOREIGN KEY (idUp_odf_courselist) REFERENCES odf_courselist (id_odf_courselist) ,
          
              idUp_odf_course VARCHAR(255) COMMENT 'Identifiant du cours', 
              FOREIGN KEY (idUp_odf_course) REFERENCES odf_course (id_odf_course), 
          
              position INT COMMENT 'Ordonnancement des lignes de cette table par rapport à la table parente', 
          
              CONSTRAINT primary_key_link_table PRIMARY KEY (idUp_odf_courselist(200), idUp_odf_course(200), position)
            ) 
          ENGINE=MYISAM COMMENT 'Table de liaison entre les listes de cours et les cours'
          

          Le problème vient du fait que la primary key doit faire 1000 bytes max et que là en utf-8 par exemple ça fait (200 * 4 + 1) + (200 * 4 + 1) + 4

          Raphaël Franchet added a comment - à priori il y a eu changement de serveur MySQL, ça marchait et ça marche plus. Version de mysql avant/après ? Encoding avant/après ? Voici la requête formatée CREATE TABLE odf_course_odf_courselist ( idUp_odf_courselist VARCHAR(255) COMMENT 'Identifiant de la liste des cours', FOREIGN KEY (idUp_odf_courselist) REFERENCES odf_courselist (id_odf_courselist) , idUp_odf_course VARCHAR(255) COMMENT 'Identifiant du cours', FOREIGN KEY (idUp_odf_course) REFERENCES odf_course (id_odf_course), position INT COMMENT 'Ordonnancement des lignes de cette table par rapport à la table parente', CONSTRAINT primary_key_link_table PRIMARY KEY (idUp_odf_courselist(200), idUp_odf_course(200), position) ) ENGINE=MYISAM COMMENT 'Table de liaison entre les listes de cours et les cours' Le problème vient du fait que la primary key doit faire 1000 bytes max et que là en utf-8 par exemple ça fait (200 * 4 + 1) + (200 * 4 + 1) + 4

          2015-05-07 11:25:59,509 INFO  [org.ametys.odf.export.ODFExportManager] (ODFExportEngine;/plugins/core/servercomm/messages.xml) CREATE TABLE odf_course_odf_courselist (idUp_odf_courselist VARCHAR(255) COMMENT 'Identifiant de la liste des cours', FOREIGN KEY (idUp_odf_courselist) REFERENCES odf_courselist (id_odf_courselist) ,idUp_odf_course VARCHAR(255) COMMENT 'Identifiant du cours', FOREIGN KEY (idUp_odf_course) REFERENCES odf_course (id_odf_course), position INT COMMENT 'Ordonnancement des lignes de cette table par rapport à la table parente', CONSTRAINT primary_key_link_table PRIMARY KEY (idUp_odf_courselist(200), idUp_odf_course(200), position)) ENGINE=MYISAM COMMENT 'Table de liaison entre les listes de cours et les cours'
          2015-05-07 11:25:59,512 ERROR [org.ametys.odf.export.ODFExportEngine] (ODFExportEngine;/plugins/core/servercomm/messages.xml) ODF export has failed
          com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
          	at sun.reflect.GeneratedConstructorAccessor229.newInstance(Unknown Source)
          	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
          

          Laurence Perier added a comment - 2015-05-07 11:25:59,509 INFO [org.ametys.odf.export.ODFExportManager] (ODFExportEngine;/plugins/core/servercomm/messages.xml) CREATE TABLE odf_course_odf_courselist (idUp_odf_courselist VARCHAR(255) COMMENT 'Identifiant de la liste des cours', FOREIGN KEY (idUp_odf_courselist) REFERENCES odf_courselist (id_odf_courselist) ,idUp_odf_course VARCHAR(255) COMMENT 'Identifiant du cours', FOREIGN KEY (idUp_odf_course) REFERENCES odf_course (id_odf_course), position INT COMMENT 'Ordonnancement des lignes de cette table par rapport à la table parente', CONSTRAINT primary_key_link_table PRIMARY KEY (idUp_odf_courselist(200), idUp_odf_course(200), position)) ENGINE=MYISAM COMMENT 'Table de liaison entre les listes de cours et les cours' 2015-05-07 11:25:59,512 ERROR [org.ametys.odf.export.ODFExportEngine] (ODFExportEngine;/plugins/core/servercomm/messages.xml) ODF export has failed com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes at sun.reflect.GeneratedConstructorAccessor229.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

          Raphaël Franchet added a comment - - edited

          Plz temporarilly set you log in info for this category "org.ametys.odf.export.ExportManager" and give me the failing request.

          I commit that in the future, a failing request will be logged automatically

          Raphaël Franchet added a comment - - edited Plz temporarilly set you log in info for this category "org.ametys.odf.export.ExportManager" and give me the failing request. I commit that in the future, a failing request will be logged automatically

            Unassigned Unassigned
            lperier Laurence Perier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: