org.artifactory.storage.fs.VfsException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at ro w 1

JFrog JIRA | Roman Finkelnburg | 10 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    We tried to create a repository with a name longer than 64 characters using the Artifactory REST API. The name length seems not to be checked by the API before requests are send to the DB backend (repo keys are limited to varchar(64) in MySQL). This leads to an inconsistency between (at least) the tables `configs` and `nodes` in the MySQL DB after the creation attempt. {code} $ curl -S -s -u ******:****** -X PUT "https://******/artifactory/api/repositories/naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release" -H "Content-Type: application/json" -d '{"name":"naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release","rclass":"local","packageType":"maven"}' { "errors" : [ { "status" : 400, "message" : "Failed to reload configuration: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at row 1\n" } ] } {code} {code} $ curl -S -s -u ******:****** -X GET "https://******/artifactory/api/repositories" [ { "key" : "naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release", "description" : "", "type" : "LOCAL", "url" : "http://artifactory.olx.berlin/artifactory/naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release" } ] {code} {code} mysql> select * from nodes where repo = 'naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release'; Empty set (0.04 sec) {code} {code} $ mysqldump -h ****** -u ****** -p artifactorydb configs | tr ' ' '\n' | grep naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release Enter password <key>naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release</key>\n {code} {code} 2016-07-08 09:38:41,819 [http-nio-8081-exec-8] [WARN ] (o.a.s.f.l.SessionLockEntry:116) - Mutable item 'naspersclassifieds-regional-olxsea-olxid-atlas-android-maven-release:' has local modifications that will be discarded. 2016-07-08 09:38:41,832 [http-nio-8081-exec-8] [ERROR] (o.a.c.CentralConfigServiceImpl:310) - Failed to reload configuration: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at row 1 org.artifactory.storage.fs.VfsException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at ro w 1 at org.artifactory.storage.db.fs.service.FileServiceImpl.createFolder(FileServiceImpl.java:116) ~[artifactory-storage-db-4.9.0.jar:na] at org.artifactory.storage.db.fs.model.DbMutableFolder.doCreateNode(DbMutableFolder.java:118) ~[artifactory-storage-db-4.9.0.jar:na] at org.artifactory.storage.db.fs.model.DbMutableItem.save(DbMutableItem.java:207) ~[artifactory-storage-db-4.9.0.jar:na] ... {code} While the web interface denies to create repos with names longer than 64 chars in the first place, `too long named` repos created using the API are displayed without any error. However, changing setting like permissions using the Web interface will again lead to exceptions when the DB is updated due to limitations in the table schema.

    JFrog JIRA | 10 months ago | Roman Finkelnburg
    org.artifactory.storage.fs.VfsException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at ro w 1

    Root Cause Analysis

    1. org.artifactory.storage.fs.VfsException

      com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'repo' at ro w 1

      at org.artifactory.storage.db.fs.service.FileServiceImpl.createFolder()
    2. org.artifactory.storage
      DbMutableItem.save
      1. org.artifactory.storage.db.fs.service.FileServiceImpl.createFolder(FileServiceImpl.java:116)[artifactory-storage-db-4.9.0.jar:na]
      2. org.artifactory.storage.db.fs.model.DbMutableFolder.doCreateNode(DbMutableFolder.java:118)[artifactory-storage-db-4.9.0.jar:na]
      3. org.artifactory.storage.db.fs.model.DbMutableItem.save(DbMutableItem.java:207)[artifactory-storage-db-4.9.0.jar:na]
      3 frames