Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java (date 1419083741000) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java (revision ) @@ -337,7 +337,7 @@ // a) single characters will fit into 3 bytes // b) a surrogate pair (two Java characters) will fit into 4 bytes // thus... - private static int CHAR2OCTETRATIO = 3; + private int char2OctectRatio = 3; // capacity of DATA column private int dataLimitInOctets = 16384; @@ -434,9 +434,11 @@ + tableName + " (ID varchar(512) not null primary key, MODIFIED bigint, HASBINARY smallint, MODCOUNT bigint, CMODCOUNT bigint, DSIZE bigint, DATA varchar(16384), BDATA blob)"); } else if ("MySQL".equals(dbtype)) { + this.char2OctectRatio = 4; + this.dataLimitInOctets = 12288 * char2OctectRatio; stmt.execute("create table " + tableName - + " (ID varchar(512) not null primary key, MODIFIED bigint, HASBINARY smallint, MODCOUNT bigint, CMODCOUNT bigint, DSIZE bigint, DATA varchar(16384), BDATA mediumblob)"); + + " (ID varchar(190) not null primary key, MODIFIED bigint, HASBINARY smallint, MODCOUNT bigint, CMODCOUNT bigint, DSIZE bigint, DATA varchar(12288), BDATA mediumblob)"); } else if ("Oracle".equals(dbtype)) { // see https://issues.apache.org/jira/browse/OAK-1914 this.dataLimitInOctets = 4000; @@ -840,7 +842,7 @@ // every 16th update is a full rewrite if (isAppendableUpdate(update) && modcount % 16 != 0) { String appendData = SR.asString(update); - if (appendData.length() < this.dataLimitInOctets / CHAR2OCTETRATIO) { + if (appendData.length() < this.dataLimitInOctets / char2OctectRatio) { try { success = dbAppendingUpdate(connection, tableName, document.getId(), modified, hasBinary, modcount, cmodcount, oldmodcount, appendData); @@ -916,11 +918,17 @@ Boolean hasBinary = flag == null ? false : flag.intValue() == NodeDocument.HAS_BINARY_VAL; Long modcount = (Long) document.get(MODCOUNT); Long cmodcount = (Long) document.get(COLLISIONSMODCOUNT); - dbInsert(connection, tableName, document.getId(), modified, hasBinary, modcount, cmodcount, data); + boolean result = dbInsert(connection, tableName, document.getId(), modified, hasBinary, modcount, cmodcount, data); + if (!result) { + LOG.error("Error Id : " + data); - } - connection.commit(); + } + connection.commit(); + } +/* + connection.commit(); +*/ } catch (SQLException ex) { - LOG.debug("insert of " + ids + " failed", ex); + LOG.error("insert of " + ids + " failed", ex); this.ch.rollbackConnection(connection); throw new DocumentStoreException(ex); } finally { @@ -1082,7 +1090,7 @@ stmt.setObject(si++, cmodcount == null ? 0 : cmodcount, Types.BIGINT); stmt.setObject(si++, data.length(), Types.BIGINT); - if (data.length() < this.dataLimitInOctets / CHAR2OCTETRATIO) { + if (data.length() < this.dataLimitInOctets / char2OctectRatio) { stmt.setString(si++, data); stmt.setBinaryStream(si++, null, 0); } else { @@ -1184,7 +1192,7 @@ stmt.setObject(si++, modcount, Types.BIGINT); stmt.setObject(si++, cmodcount == null ? 0 : cmodcount, Types.BIGINT); stmt.setObject(si++, data.length(), Types.BIGINT); - if (data.length() < this.dataLimitInOctets / CHAR2OCTETRATIO) { + if (data.length() < this.dataLimitInOctets / char2OctectRatio) { stmt.setString(si++, data); stmt.setBinaryStream(si++, null, 0); } else {