id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-3652-0ba6f9da
DERBY-3652: Add more tests to stress signature matching rules. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@658736 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3652-5c04fbc9
DERBY-3652: Allow mixing of primitive and wrapper types when matching SQL routine signatures to java methods. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@657819 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [ " *", " * The preceding paragraph is a bit misleading. As of release 10.4, the", " * second pass did not consider arbitrary combinations of primitive and", " * wrapper types. This is because the first pass removed from consideration", " * candidates which would be allowed under ANSI rules. As a fix for bug", " * DERBY-3652, we now allow primitive and wrapper type matches during", " * the first pass. The ANSI rules are documented in DERBY-3652.", " *" ], "header": "@@ -535,7 +535,14 @@ public final class ClassInspector", "removed": [ "\t *" ] } ] } ]
derby-DERBY-3652-78275372
DERBY-3652: Don't let SQL SMALLINT args match Java numerics bigger than short. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@658427 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " short sequential)" ], "header": "@@ -719,7 +719,7 @@ public class SystemProcedures {", "removed": [ " int sequential)" ] }, { "added": [ " short deleteOnlineArchivedLogFiles)" ], "header": "@@ -841,7 +841,7 @@ public class SystemProcedures {", "removed": [ " int deleteOnlineArchivedLogFiles)" ] }, { "added": [ " short deleteOnlineArchivedLogFiles)" ], "header": "@@ -877,7 +877,7 @@ public class SystemProcedures {", "removed": [ " int deleteOnlineArchivedLogFiles)" ] }, { "added": [ " short deleteOnlineArchivedLogFiles)" ], "header": "@@ -899,7 +899,7 @@ public class SystemProcedures {", "removed": [ " int deleteOnlineArchivedLogFiles)" ] }, { "added": [ " short enable)", " short enable)" ], "header": "@@ -908,14 +908,14 @@ public class SystemProcedures {", "removed": [ " int enable)", " int enable)" ] } ] } ]
derby-DERBY-3652-886e6e1f
DERBY-3652: Don't match SQL NUMERIC to Java Object. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@660630 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [ " private static final String BIGDECIMAL_TYPE_NAME = \"java.math.BigDecimal\";" ], "header": "@@ -55,6 +55,7 @@ public final class ClassInspector", "removed": [] }, { "added": [], "header": "@@ -688,7 +689,6 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "" ] } ] } ]
derby-DERBY-3652-9de50b22
DERBY-3652: Add test cases for char and long varchar. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@672029 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3652-d391eecc
DERBY-3652: Add two test cases for signatures which mix types. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@664081 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3652-e8903d64
DERBY-3652: Add signature matching tests for DECIMAL, DATE, TIME, and TIMESTAMP. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@672323 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3652-ef426356
DERBY-3652: Add tests for functions which return Blobs and Clobs but disable these tests because Derby chokes on them. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@672781 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3652-f6abacbd
DERBY-3652: Adding some tests for BINARY, VARBINARY, and LONGVARBINARY parameter and return types. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@670660 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3655-10e4538e
DERBY-3655 errror in nightly regression test: LobStreamsTest:encryptedjunit.framework.AssertionFailedError removing temporary lob file. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@701487 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ " control = new LOBStreamControl (con, blobBytes);" ], "header": "@@ -133,7 +133,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " control = new LOBStreamControl (con.getDBName(), blobBytes);" ] }, { "added": [ " getEmbedConnection(), dvdBytes);" ], "header": "@@ -173,7 +173,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " getEmbedConnection().getDBName(), dvdBytes);" ] }, { "added": [ " control = new LOBStreamControl (getEmbedConnection());" ], "header": "@@ -843,7 +843,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " control = new LOBStreamControl (getEmbedConnection().getDBName());" ] }, { "added": [ " getEmbedConnection());" ], "header": "@@ -885,7 +885,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " getEmbedConnection().getDBName());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java", "hunks": [ { "added": [ " this.clob = new TemporaryClob (this);" ], "header": "@@ -90,7 +90,7 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB", "removed": [ " this.clob = new TemporaryClob (con.getDBName(), this);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ "import java.util.HashSet;" ], "header": "@@ -75,6 +75,7 @@ import java.sql.SQLException;", "removed": [] }, { "added": [ " // Set to keep track of the open LOBFiles, so they can be closed at the end of ", " // the transaction. This would normally happen as lobReferences are freed as they", " // get garbage collected after being removed from the WeakHashMap, but it is ", " // possible that finalization will not have occurred before the user tries to ", " // remove the database (DERBY-3655). Therefore we keep this set so that we can", " // explicitly close the files.", " private HashSet lobFiles;", " " ], "header": "@@ -150,6 +151,14 @@ public abstract class EmbedConnection implements EngineConnection", "removed": [] }, { "added": [ "\t\t", "\t\tsynchronized (this) { ", "\t\t\tif (lobFiles != null) { ", "\t\t\t\tIterator it = lobFiles.iterator();", "\t\t\t\twhile (it.hasNext()) {", "\t\t\t\t\ttry {", "\t\t\t\t\t\t((LOBFile) it.next()).close();", "\t\t\t\t\t} catch (IOException ioe) {", "\t\t\t\t\t\tthrow Util.javaException(ioe);", "\t\t\t\t\t}", "\t\t\t\t\tfinally {", "\t\t\t\t\t\tlobFiles.clear();", "\t\t\t\t\t}", "\t\t\t\t}", "\t\t\t}", "\t\t}" ], "header": "@@ -3077,6 +3086,22 @@ public abstract class EmbedConnection implements EngineConnection", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [ " private final EmbedConnection conn;", " * @param conn Connection for this lob", " LOBStreamControl (EmbedConnection conn) {", " this.conn = conn;" ], "header": "@@ -59,16 +59,16 @@ class LOBStreamControl {", "removed": [ " private String dbName;", " * @param dbName database name", " LOBStreamControl (String dbName) {", " this.dbName = dbName;" ] }, { "added": [ " * @param conn Connection for this lob", " LOBStreamControl (EmbedConnection conn, byte [] data)", " this.conn = conn;" ], "header": "@@ -76,12 +76,12 @@ class LOBStreamControl {", "removed": [ " * @param dbName database name", " LOBStreamControl (String dbName, byte [] data)", " this.dbName = dbName;" ] }, { "added": [ " Property.DATABASE_MODULE, conn.getDBName());" ], "header": "@@ -93,7 +93,7 @@ class LOBStreamControl {", "removed": [ " Property.DATABASE_MODULE, dbName);" ] }, { "added": [ " conn.addLobFile(tmpFile);" ], "header": "@@ -104,6 +104,7 @@ class LOBStreamControl {", "removed": [] }, { "added": [ " conn.removeLobFile(tmpFile);" ], "header": "@@ -352,6 +353,7 @@ class LOBStreamControl {", "removed": [] }, { "added": [ " conn.removeLobFile(tmpFile);" ], "header": "@@ -436,6 +438,7 @@ class LOBStreamControl {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java", "hunks": [ { "added": [ " TemporaryClob newClob = new TemporaryClob(conChild);" ], "header": "@@ -73,7 +73,7 @@ final class TemporaryClob implements InternalClob {", "removed": [ " TemporaryClob newClob = new TemporaryClob(dbName, conChild);" ] }, { "added": [ " TemporaryClob newClob = new TemporaryClob(conChild);" ], "header": "@@ -94,7 +94,7 @@ final class TemporaryClob implements InternalClob {", "removed": [ " TemporaryClob newClob = new TemporaryClob(dbName, conChild);" ] }, { "added": [ " * ", " TemporaryClob (ConnectionChild conChild) {", " this.bytes = new LOBStreamControl(conChild.getEmbedConnection());" ], "header": "@@ -102,18 +102,17 @@ final class TemporaryClob implements InternalClob {", "removed": [ " * ", " * @param dbName name of the database the CLOB value belongs to", " TemporaryClob (String dbName, ConnectionChild conChild) {", " this.bytes = new LOBStreamControl(dbName);" ] } ] } ]
derby-DERBY-3659-049ad6e9
DERBY-3659 ; convert xaJNDI to junit test XAJNDITest. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@654656 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3659-23273615
DERBY-3659 - junit ldap tests - commit minor changes of patch DERBY-3659-3.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@662920 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3659-5883d471
DERBY-3659; modifying _Suite so it checks for property derbyTesting.ldapServer instead of derbyTesting.ldapUser, and only runs xaJNDITest if it's set; also removing old 'sample' master file. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@662094 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3659-f0477245
DERBY-3659; adding some LDAP tests (patch DERBY-3659-2b.diff). Patch contributed by Myrna van Lunteren git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@661924 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-366-f578f070
Fix for DERBY-8 Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction DERBY-366 In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored. have a patch to fix Derby-8 (Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction) and Derby-366 (In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored.) The patch is attached to both Derby-8 and Derby-366. The fix for both these bugs was centered around fixing the holdability handling in BrokeredConnection.java This was because BrokeredConnection.java had no code for restoring the holdability of real connection object and no code for saving the current holdability state of real connection object. I put fix for both these issues in BrokeredConnection.java so that both jdk13 and jdk14+ environments will be handled correctly. Had to use reflection for this holdability work because Connection.setHoldability and Connection.getHoldability methods are not available through JDK13 apis. Contributed by Mamta Satoor git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@191755 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java", "hunks": [ { "added": [ "import java.lang.reflect.*;", "", "import org.apache.derby.iapi.reference.JDBC30Translation;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.error.StandardException;", "", "\t", "\t// default for Derby", "\tprotected int stateHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;" ], "header": "@@ -33,12 +33,21 @@ import org.apache.derby.impl.jdbc.Util;", "removed": [] }, { "added": [ "\t\t// jdk13 does not have Connection.getHoldability method and hence using", "\t\t// reflection to cover both jdk13 and higher jdks", "\t\ttry {", "\t\t\tMethod sh = conn.getClass().getMethod(\"getHoldability\", null);", "\t\t\tstateHoldability = ((Integer)sh.invoke(conn, null)).intValue();", "\t\t} catch( Exception e)", "\t\t{", "\t\t\tthrow PublicAPI.wrapStandardException( StandardException.plainWrapException( e));", "\t\t} " ], "header": "@@ -383,6 +392,15 @@ public class BrokeredConnection implements Connection", "removed": [] }, { "added": [ "\t\tClass[] CONN_PARAM = { Integer.TYPE };", "\t\tObject[] CONN_ARG = { new Integer(stateHoldability)};" ], "header": "@@ -396,6 +414,8 @@ public class BrokeredConnection implements Connection", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java", "hunks": [ { "added": [], "header": "@@ -32,9 +32,6 @@ import org.apache.derby.iapi.reference.JDBC30Translation;", "removed": [ "\t", "\t// default for Cloudscape", "\tprivate int stateHoldability = java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;" ] } ] } ]
derby-DERBY-3667-34b59c62
DERBY-3667 SQL roles: Make CURRENT_ROLE check that the role is still valid This patch, derby-3667-1, makes CURRENT_ROLE, before returning the value, check if the current role set, if any, is still applicable for the current user. If it is no longer applicable, the current role is set to NONE. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@654482 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java", "hunks": [ { "added": [ "\t\t\tmethodName = \"getCurrentRoleIdChecked\";", "\t\t\t\tTypes.VARCHAR, true, 128);" ], "header": "@@ -158,10 +158,10 @@ public class SpecialFunctionNode extends ValueNode", "removed": [ "\t\t\tmethodName = \"getCurrentRoleId\";", "\t\t\t\tTypes.VARCHAR, false, 128);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ], "header": "@@ -53,6 +53,7 @@ import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList;", "removed": [] }, { "added": [ "" ], "header": "@@ -3226,7 +3227,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t" ] }, { "added": [ "\t/**", "\t * @see LanguageConnectionContext#getCurrentRoleIdChecked(Activation a)", "\t */", "\tpublic String getCurrentRoleIdChecked(Activation a)", "\t\t\tthrows StandardException {", "", "\t\tString role = getCurrentSQLSessionContext(a.getCallActivation()).", "\t\t\tgetRole();", "", "\t\tif (role != null) {", "\t\t\tbeginNestedTransaction(true);", "", "\t\t\ttry {", "\t\t\t\tif (!roleIsSettable(role)) {", "\t\t\t\t\t// invalid role, so reset it.", "\t\t\t\t\tsetCurrentRole(a, null);", "\t\t\t\t\trole = null;", "\t\t\t\t}", "\t\t\t} finally {", "\t\t\t\tcommitNestedTransaction();", "\t\t\t}", "", "\t\t}", "", "\t\treturn role;", "\t}", "", "", "\t/**", "\t * @see LanguageConnectionContext#roleIsSettable(String role)", "\t */", "\tpublic boolean roleIsSettable(String role) throws StandardException {", "\t\tDataDictionary dd = getDataDictionary();", "\t\tString dbo = dd.getAuthorizationDatabaseOwner();", "", "\t\tRoleDescriptor grantDesc = null;", "", "\t\tif (getAuthorizationId().equals(dbo)) {", "\t\t\tgrantDesc = dd.getRoleDefinitionDescriptor(role);", "\t\t} else {", "\t\t\tgrantDesc = dd.getRoleGrantDescriptor", "\t\t\t\t(role, getAuthorizationId(), dbo);", "", "\t\t\tif (grantDesc == null) {", "\t\t\t\t// or if not, via PUBLIC?", "\t\t\t\tgrantDesc = dd.getRoleGrantDescriptor", "\t\t\t\t\t(role, Authorizer.PUBLIC_AUTHORIZATION_ID,dbo);", "\t\t\t}", "\t\t}", "\t\treturn grantDesc != null;", "\t}", "" ], "header": "@@ -3245,6 +3246,58 @@ public class GenericLanguageConnectionContext", "removed": [] } ] } ]
derby-DERBY-3669-6a5890fe
DERBY-3669: ClientXADataSource fetched from JNDI not identical as originally bound; some properties have String "null" instead of null Changed ClientBaseDataSource.getReference() to match the embedded implementation in ReferenceableDataSource, which already handles null values. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@792434 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3674-ec55311e
DERBY-3674 Inplace compress test in store/TransactionTable.sql started failing after the checkin for DERBY-1062. Prior to the fix for DERBY-1062, an inplace compress request on VTI would return with no exception although the code just ignored the compress request on VTI. After DERBY-1062 fix, Derby started throwing exception. With the changes going through this commit, I am restoring the behavior to no-op on inplace compress on VTI. I am doing this by making the check for VTI in SystemProcedure and returning from it if it is a VTI. All the other inplace compress request get fulfilled through internal generation of ALTER TABLE sql. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@656797 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.store.access.TransactionController;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;" ], "header": "@@ -52,7 +52,10 @@ import org.apache.derby.impl.load.Export;", "removed": [ "" ] }, { "added": [ " \t//Inplace compress let's the user call compress on VTI but it", " \t//is really a no-op. In order to avoid having to go throught", " \t//the ALTER TABLE code just for a no-op, we simply do the check", " \t//here and return if we are dealing with VTI.", "\t\tLanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();", "\t\tTransactionController tc = lcc.getTransactionExecute();", "", "\t\ttry ", " {", " DataDictionary data_dictionary = lcc.getDataDictionary();", " SchemaDescriptor sd = ", " data_dictionary.getSchemaDescriptor(schema, tc, true);", " TableDescriptor td = ", " data_dictionary.getTableDescriptor(tablename, sd, tc);", "", " if (td != null && td.getTableType() == TableDescriptor.VTI_TYPE)", " {", " return;", " }", " }", "\t\tcatch (StandardException se)", "\t\t{", "\t\t\tthrow PublicAPI.wrapStandardException(se);", "\t\t}", "", "\t\t//Send all the other inplace compress requests to ALTER TABLE", "\t\t//machinery" ], "header": "@@ -1053,7 +1056,33 @@ public class SystemProcedures {", "removed": [ " " ] } ] } ]
derby-DERBY-3678-e4ada410
DERBY-3678 StackOverflowException in deadlock trace Patch derby-3678-3 which solves the issue and adds a new regression test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@666901 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t{", "\t\treturn locateSchemaRowBody(", "\t\t\tschemaId,", "\t\t\tTransactionController.ISOLATION_REPEATABLE_READ,", "\t\t\ttc);", "\t}", "", "", "\t/**", "\t * Get the target schema by searching for a matching row", "\t * in SYSSCHEMAS by schemaId. Read only scan.", "\t *", "\t * @param schemaId\t\tThe id of the schema we're interested in.", "\t *\t\t\t\t\t\tIf non-null, overrides schemaName", "\t * @param isolationLevel Use this explicit isolation level. Only", "\t * ISOLATION_REPEATABLE_READ (normal usage) or", "\t * ISOLATION_READ_UNCOMMITTED (corner cases)", "\t * supported for now.", "\t * @param tc\t\t\tTransactionController. If null, one", "\t *\t\t\t\t\t\tis gotten off of the language connection context.", "\t *", "\t * @return\tThe row for the schema", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tprivate SchemaDescriptor locateSchemaRow(UUID schemaId,", "\t\t\t\t\t\t\t\t\t\t\t int isolationLevel,", "\t\t\t\t\t\t\t\t\t\t\t TransactionController tc)", "\t\tthrows StandardException", "\t{", "\t\treturn locateSchemaRowBody(", "\t\t\tschemaId,", "\t\t\tisolationLevel,", "\t\t\ttc);", "\t}", "", "", "\tprivate SchemaDescriptor locateSchemaRowBody(UUID schemaId,", "\t\t\t\t\t\t\t\t\t\t\t\t int isolationLevel,", "\t\t\t\t\t\t\t\t\t\t\t\t TransactionController tc)", "\t\tthrows StandardException" ], "header": "@@ -1503,6 +1503,47 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\t\t\t\t\tisolationLevel," ], "header": "@@ -1523,6 +1564,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t{", "\t\treturn getSchemaDescriptorBody(", "\t\t\tschemaId,", "\t\t\tTransactionController.ISOLATION_REPEATABLE_READ,", "\t\t\ttc);", "\t}", "", "\t/**", "\t * Get the SchemaDescriptor for the given schema identifier.", "\t *", "\t * @param schemaId the uuid of the schema we want a descriptor for", "\t * @param isolationLevel use this explicit isolation level. Only", "\t * ISOLATION_REPEATABLE_READ (normal usage) or", "\t * ISOLATION_READ_UNCOMMITTED (corner cases)", "\t * supported for now.", "\t * @param tc transaction controller", "\t * @throws StandardException thrown on error", "\t */", "\tpublic SchemaDescriptor\tgetSchemaDescriptor(UUID schemaId,", "\t\t\t\t\t\t\t\t\t\t\t\tint isolationLevel,", "\t\t\t\t\t\t\t\t\t\t\t\tTransactionController tc)", "\t\tthrows StandardException", "\t{", "\t\treturn getSchemaDescriptorBody(", "\t\t\tschemaId,", "\t\t\tisolationLevel,", "\t\t\ttc);", "\t}", "", "", "\tprivate SchemaDescriptor getSchemaDescriptorBody(", "\t\tUUID schemaId,", "\t\tint isolationLevel,", "\t\tTransactionController tc) throws StandardException" ], "header": "@@ -1584,6 +1626,40 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\treturn locateSchemaRow(schemaId, isolationLevel, tc);" ], "header": "@@ -1631,7 +1707,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\treturn locateSchemaRow(schemaId, tc);" ] }, { "added": [ "\t * Get all of the TableDescriptors in the database and hash them", "\t * by TableId This is useful as a performance optimization for the", "\t * locking VTIs. NOTE: This method will scan SYS.SYSTABLES and", "\t * SYS.SYSSCHEMAS at READ UNCOMMITTED." ], "header": "@@ -5811,9 +5887,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * Get all of the TableDescriptors in the database and hash them by TableId", "\t * This is useful as a performance optimization for the locking VTIs.", "\t * NOTE: This method will scan SYS.SYSTABLES at READ UNCOMMITTED." ] }, { "added": [ "\t\t\t\trf.buildDescriptor(", "\t\t\t\t\toutRow,", "\t\t\t\t\t(TupleDescriptor)null,", "\t\t\t\t\tthis,", "\t\t\t\t\tTransactionController.ISOLATION_READ_UNCOMMITTED);" ], "header": "@@ -5855,8 +5932,11 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\trf.buildDescriptor(outRow, (TupleDescriptor)null,", "\t\t\t\t\t\t\t\t this);" ] }, { "added": [ "\t\treturn getDescriptorViaIndexMinion(", "\t\t\tindexId,", "\t\t\tkeyRow,", "\t\t\tscanQualifiers,", "\t\t\tti,", "\t\t\tparentTupleDescriptor,", "\t\t\tlist,", "\t\t\tforUpdate,", "\t\t\tTransactionController.ISOLATION_REPEATABLE_READ,", "\t\t\ttc);" ], "header": "@@ -8065,14 +8145,16 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\treturn getDescriptorViaIndexMinion(indexId,", "\t\t\t\t\t\t\t\t\t\t keyRow,", "\t\t\t\t\t\t\t\t\t\t scanQualifiers,", "\t\t\t\t\t\t\t\t\t\t ti,", "\t\t\t\t\t\t\t\t\t\t parentTupleDescriptor,", "\t\t\t\t\t\t\t\t\t\t list,", "\t\t\t\t\t\t\t\t\t\t forUpdate,", "\t\t\t\t\t\t\t\t\t\t tc);" ] }, { "added": [ "\t\treturn getDescriptorViaIndexMinion(", "\t\t\tindexId,", "\t\t\tkeyRow,", "\t\t\tscanQualifiers,", "\t\t\tti,", "\t\t\tparentTupleDescriptor,", "\t\t\tlist,", "\t\t\tforUpdate,", "\t\t\tTransactionController.ISOLATION_REPEATABLE_READ,", "\t\t\ttc);", "\t}", "", "\t/**", "\t * Return a (single or list of) catalog row descriptor(s) from a", "\t * system table where the access is from the index to the heap.", "\t *", "\t * This overload variant takes an explicit tc, in contrast to the normal", "\t * one which uses the one returned by getTransactionCompile.", "\t *", "\t * @param indexId The id of the index (0 to # of indexes on table) to use", "\t * @param keyRow The supplied ExecIndexRow for search", "\t * @param ti The TabInfoImpl to use", "\t * @param parentTupleDescriptor The parentDescriptor, if applicable.", "\t * @param list The list to build, if supplied. If null, then", "\t * caller expects a single descriptor", "\t * @param forUpdate Whether or not to open the index for update.", "\t * @param isolationLevel", "\t * Use this explicit isolation level. Only", "\t * ISOLATION_REPEATABLE_READ (normal usage) or", "\t * ISOLATION_READ_UNCOMMITTED (corner cases)", "\t * supported for now.", "\t * @param tc Transaction controller", "\t *", "\t * @return The last matching descriptor. If isolationLevel is", "\t * ISOLATION_READ_UNCOMMITTED, the base row may be gone by the", "\t * time we access it via the index; in such a case a null is", "\t * returned.", "\t *", "\t * @exception StandardException Thrown on error.", "\t */", "\tprivate final TupleDescriptor getDescriptorViaIndex(", "\t\t\t\t\t\tint indexId,", "\t\t\t\t\t\tExecIndexRow keyRow,", "\t\t\t\t\t\tScanQualifier [][] scanQualifiers,", "\t\t\t\t\t\tTabInfoImpl ti,", "\t\t\t\t\t\tTupleDescriptor parentTupleDescriptor,", "\t\t\t\t\t\tList list,", "\t\t\t\t\t\tboolean forUpdate,", "\t\t\t\t\t\tint isolationLevel,", "\t\t\t\t\t\tTransactionController tc)", "\t\t\tthrows StandardException", "\t{", "\t\tif (tc == null) {", "\t\t\ttc = getTransactionCompile();", "\t\t}", "" ], "header": "@@ -8110,6 +8192,62 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t isolationLevel," ], "header": "@@ -8117,6 +8255,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\t\t\t\t\tint isolationLevel," ], "header": "@@ -8129,6 +8268,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT", "\t\t\t\t(isolationLevel ==", "\t\t\t\t TransactionController.ISOLATION_REPEATABLE_READ ||", "\t\t\t\t isolationLevel ==", "\t\t\t\t TransactionController.ISOLATION_READ_UNCOMMITTED);", "", "\t\t\tif (isolationLevel ==", "\t\t\t\t TransactionController.ISOLATION_READ_UNCOMMITTED) {", "\t\t\t\t// list not used for this case", "\t\t\t\tSanityManager.ASSERT(list == null);", "\t\t\t}", "", "\t\t}", "", " isolationLevel);" ], "header": "@@ -8141,12 +8281,27 @@ public final class\tDataDictionaryImpl", "removed": [ " TransactionController.ISOLATION_REPEATABLE_READ);" ] }, { "added": [ " isolationLevel," ], "header": "@@ -8156,7 +8311,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TransactionController.ISOLATION_REPEATABLE_READ," ] }, { "added": [ "\t\twhile (true)" ], "header": "@@ -8164,7 +8319,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\twhile (scanController.next())" ] }, { "added": [ "\t\t\t// It is important for read uncommitted scans to use fetchNext()", "\t\t\t// rather than fetch, so that the fetch happens while latch is", "\t\t\t// held, otherwise the next() might position the scan on a row,", "\t\t\t// but the subsequent fetch() may find the row deleted or purged", "\t\t\t// from the table.", "\t\t\tif (!scanController.fetchNext(indexRow1.getRowArray())) {", "\t\t\t\tbreak;", "\t\t\t}" ], "header": "@@ -8172,7 +8327,14 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tscanController.fetch(indexRow1.getRowArray());" ] }, { "added": [ "\t\t\t\tif (! base_row_exists &&", "\t\t\t\t\t\t(isolationLevel ==", "\t\t\t\t\t\t\t TransactionController.ISOLATION_REPEATABLE_READ)) {" ], "header": "@@ -8222,8 +8384,9 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tif (! base_row_exists)", "\t\t\t\t{" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSTABLESRowFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.store.access.TransactionController;" ], "header": "@@ -48,6 +48,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "\t/**", "\t * Make a TableDescriptor out of a SYSTABLES row", "\t *", "\t * @param row a SYSTABLES row", "\t * @param parentTupleDescriptor\tNull for this kind of descriptor.", "\t * @param dd dataDictionary", "\t * @param isolationLevel use this explicit isolation level. Only", "\t * ISOLATION_REPEATABLE_READ (normal usage)", "\t * or ISOLATION_READ_UNCOMMITTED (corner", "\t * cases) supported for now.", "\t * @exception StandardException thrown on failure", "\t */", "\tTupleDescriptor buildDescriptor(", "\t\tExecRow\t\t\t\t\trow,", "\t\tTupleDescriptor\t\t\tparentTupleDescriptor,", "\t\tDataDictionary \t\t\tdd,", "\t\tint isolationLevel)", "\t\t\t\t\tthrows StandardException", "\t{", "\t\treturn buildDescriptorBody(row,", "\t\t\t\t\t\t\t\t parentTupleDescriptor,", "\t\t\t\t\t\t\t\t dd,", "\t\t\t\t\t\t\t\t isolationLevel);", "\t}", "", "" ], "header": "@@ -256,6 +257,32 @@ class SYSTABLESRowFactory extends CatalogRowFactory", "removed": [] }, { "added": [ "\t{", "\t\treturn buildDescriptorBody(", "\t\t\trow,", "\t\t\tparentTupleDescriptor,", "\t\t\tdd,", "\t\t\tTransactionController.ISOLATION_REPEATABLE_READ);", "\t}", "", "", "\tpublic TupleDescriptor buildDescriptorBody(", "\t\tExecRow\t\t\t\t\trow,", "\t\tTupleDescriptor\t\t\tparentTupleDescriptor,", "\t\tDataDictionary \t\t\tdd,", "\t\tint isolationLevel)", "\t\t\t\t\tthrows StandardException" ], "header": "@@ -279,6 +306,21 @@ class SYSTABLESRowFactory extends CatalogRowFactory", "removed": [] } ] } ]
derby-DERBY-3682-5b90cf19
DERBY-3682: SYSCS_BULK_INSERT doesn't quote identifiers or strings properly Ensure proper quoting of SQL identifiers and string literals by using utility functions in StringUtil and IdUtil. VTITest has been updated to test SYSCS_BULK_INSERT with a table containing single quotes and double quotes in its name. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@660153 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " String escapedSchema = IdUtil.normalToDelimited(schema);", " String escapedTableName = IdUtil.normalToDelimited(tablename);" ], "header": "@@ -723,8 +723,8 @@ public class SystemProcedures {", "removed": [ " String escapedSchema = escapeSQLIdentifier(schema);", " String escapedTableName = escapeSQLIdentifier(tablename);" ] }, { "added": [], "header": "@@ -738,22 +738,6 @@ public class SystemProcedures {", "removed": [ " /**", " * Escape an SQL identifier to preserve mixed case and special characters.", " */", " private static String escapeSQLIdentifier(String identifier) {", " StringBuffer buffer = new StringBuffer(identifier.length() + 2);", " buffer.append('\"');", " for (int i = 0; i < identifier.length(); i++) {", " char c = identifier.charAt(i);", " // if c is a double quote, escape it with an extra double quote", " if (c == '\"') buffer.append('\"');", " buffer.append(c);", " }", " buffer.append('\"');", " return buffer.toString();", " }", "" ] }, { "added": [ " String escapedSchema = IdUtil.normalToDelimited(schema);", " String escapedTableName = IdUtil.normalToDelimited(tablename);" ], "header": "@@ -1101,8 +1085,8 @@ public class SystemProcedures {", "removed": [ " String escapedSchema = escapeSQLIdentifier(schema);", " String escapedTableName = escapeSQLIdentifier(tablename);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " StringBuffer buffer = new StringBuffer(name.length() + 2);", " buffer.append('\"');", " for (int i = 0; i < name.length(); i++) {", " char c = name.charAt(i);", " // escape double quote characters with an extra double quote", " if (c == '\"') buffer.append('\"');", " buffer.append(c);", " }", " buffer.append('\"');", " return buffer.toString();" ], "header": "@@ -1259,7 +1259,16 @@ public class JDBC {", "removed": [ "\t\treturn \"\\\"\" + name + \"\\\"\";" ] }, { "added": [ " return escape(schema) + \".\" + escape(name);" ], "header": "@@ -1267,7 +1276,7 @@ public class JDBC {", "removed": [ "\t\treturn \"\\\"\" + schema + \"\\\".\\\"\" + name + \"\\\"\";" ] } ] } ]
derby-DERBY-3686-6bd82a52
DERBY-3686 convert predicatePushdown.sql to JUnit git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@661847 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java", "hunks": [ { "added": [ " " ], "header": "@@ -74,6 +74,7 @@ public class RuntimeStatisticsParser {", "removed": [] }, { "added": [ " ", " /**", " * @param tableName", " * @return true if a Table Scan ResultSet was used for tableName", " */", " public boolean usedTableScan(String tableName){", " return (statistics.indexOf(\"Table Scan ResultSet for \" + ", " tableName)!= -1);", " }", " /**", " * @param tableName", " * @return true if an Index Scan ResultSet was used for tableName", " */", " public boolean usedIndexScan(String tableName){", " return (statistics.indexOf(\"Index Scan ResultSet for \" + ", " tableName)!= -1);", " }", " ", " ", " " ], "header": "@@ -160,6 +161,26 @@ public class RuntimeStatisticsParser {", "removed": [] }, { "added": [ " /**", " * @param tableName", " * @return true if Index Row to Base Row ResultSet was used for tableName", " */", " public boolean usedIndexRowToBaseRow(String tableName) {", " ", " return (statistics.indexOf(\"Index Row to Base Row ResultSet for \" + ", " tableName)!= -1);", " ", " }", " ", " ", " /**", " * @param tableName", " * @return true if Used Distinct Scan ResultSet for tablenName", " */", " public boolean usedDistinctScan(String tableName) {", " return (statistics.indexOf(\"Distinct Scan ResultSet for \" + ", " tableName)!= -1);", "", " }", " ", " ", " " ], "header": "@@ -176,6 +197,30 @@ public class RuntimeStatisticsParser {", "removed": [] }, { "added": [ " ", " " ], "header": "@@ -202,6 +247,8 @@ public class RuntimeStatisticsParser {", "removed": [] }, { "added": [ " ", " /**", " * @return true if a hash join was used", " */", " public boolean usedHashJoin()", " {", " return (statistics.indexOf(\"Hash Join ResultSet\") != -1);", " }", "", " /**", " * Search the RuntimeStatistics for a string. It must occur", " * at least instances times.", " * @param stringToFind", " * @param instances", " * @return true if stringToFind is found instances times.", " */", " public boolean findString(String stringToFind, int instances)", " {", " int foundCount=0;", " int currentOffset=0;", " String stat = statistics;", " for (int i = 0; i < instances; i++) {", " currentOffset = stat.indexOf(stringToFind);", " if (currentOffset != -1) {", " foundCount++;", " stat = stat.substring(currentOffset + stringToFind.length());", " } else { ", " break;", " } ", " } ", " return (foundCount >=instances);", " ", " }", " " ], "header": "@@ -219,4 +266,38 @@ public class RuntimeStatisticsParser {", "removed": [] } ] } ]
derby-DERBY-3689-2949b9fb
DERBY-3689: 'PrivilegedActionException: javax.management.InstanceNotFoundException' in '*(VersionMBeanTest / NetworkServerMBeanTest)' Register MBeans before starting the client thread so that the MBeans can be accessed by the tests once they detect the network server is up and running. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1138444 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "", " // First, register any MBeans. We do this before we start accepting", " // connections from the clients to ease testing of JMX (DERBY-3689).", " // This way we know that once we can connect to the network server,", " // the MBeans will be available.", " ManagementService mgmtService = ((ManagementService)", " Monitor.getSystemModule(Module.JMX));", "", " final Object versionMBean = mgmtService.registerMBean(", " new Version(", " getNetProductVersionHolder(),", " SystemPermission.SERVER),", " VersionMBean.class,", " \"type=Version,jar=derbynet.jar\");", " final Object networkServerMBean = mgmtService.registerMBean(", " new NetworkServerMBeanImpl(this),", " NetworkServerMBean.class,", " \"type=NetworkServer\");", "" ], "header": "@@ -768,7 +768,25 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t" ] }, { "added": [ "" ], "header": "@@ -782,22 +800,7 @@ public final class NetworkServerControlImpl {", "removed": [ " ", " // Now that we are up and running, register any MBeans", " ManagementService mgmtService = ((ManagementService)", " Monitor.getSystemModule(Module.JMX));", " ", " final Object versionMBean = mgmtService.registerMBean(", " new Version(", " getNetProductVersionHolder(),", " SystemPermission.SERVER),", " VersionMBean.class,", " \"type=Version,jar=derbynet.jar\");", " final Object networkServerMBean = mgmtService.registerMBean(", " new NetworkServerMBeanImpl(this),", " NetworkServerMBean.class,", " \"type=NetworkServer\");", " \t\t\t" ] } ] } ]
derby-DERBY-3690-9526f797
DERBY-3690: EmbedPooledConnection doesn't reset schema when creating a new logical connection. Fixes the bug by resetting the schema in GLCC.resetFromPool, and adds two regression tests. Patch file: derby-3690-1b-reset_schema.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@660404 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " /**", " * Asserts that the current schema is the same as the one specified.", " *", " * @param con connection to check schema in", " * @param schema expected schema name", " * @throws SQLException if something goes wrong", " */", " public static void assertCurrentSchema(Connection con, String schema)", " throws SQLException {", " Statement stmt = con.createStatement();", " try {", " JDBC.assertSingleValueResultSet(", " stmt.executeQuery(\"VALUES CURRENT SCHEMA\"), schema);", " } finally {", " stmt.close();", " }", " }", "" ], "header": "@@ -1236,6 +1236,24 @@ public class JDBC {", "removed": [] } ] } ]
derby-DERBY-3693-8106edc9
DERBY-3850: Remove unneeded workarounds for DERBY-177 and DERBY-3693 Removed the wait parameter from methods called from SPSDescriptor.updateSYSSTATEMENTS() since waiting is prevented by another mechanism now. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@692495 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java", "hunks": [ { "added": [ "\t\tTransactionController\ttc" ], "header": "@@ -1072,15 +1072,13 @@ public interface DataDictionary", "removed": [ "\t * @param wait\t\t\tTo wait for lock or not", "\t\tTransactionController\ttc,", "\t\tboolean\t\t\t\t\twait" ] }, { "added": [], "header": "@@ -1092,10 +1090,7 @@ public interface DataDictionary", "removed": [ "\t * @param wait\t\tIf true, then the caller wants to wait for locks. False will be", "\t * when we using a nested user xaction - we want to timeout right away if", "\t * the parent holds the lock. (bug 4821)" ] }, { "added": [], "header": "@@ -1104,7 +1099,6 @@ public interface DataDictionary", "removed": [ "\t\t\tboolean\t\t\t\t\twait," ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java", "hunks": [ { "added": [], "header": "@@ -1072,10 +1072,7 @@ public class SPSDescriptor extends TupleDescriptor", "removed": [ "\t\tint[] \t\t\t\t\tcolsToUpdate;", "\t\t//bug 4821 - we want to wait for locks if updating sysstatements on parent transaction", "\t\tboolean wait = false;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\tint insertRetCode = ti.insertRow(row, tc);" ], "header": "@@ -1789,24 +1789,13 @@ public final class\tDataDictionaryImpl", "removed": [ "\t{", "\t\taddDescriptor(td, parent, catalogNumber, duplicatesAllowed, tc, true);", "\t}", "", "\t/**", "\t * @inheritDoc", "\t */", "\tpublic void addDescriptor(TupleDescriptor td, TupleDescriptor parent,", "\t\t\t\t\t\t\t int catalogNumber, boolean duplicatesAllowed,", "\t\t\t\t\t\t\t TransactionController tc, boolean wait)", "\t\tthrows StandardException", "\t\tint insertRetCode = ti.insertRow(row, tc, wait);" ] }, { "added": [], "header": "@@ -3377,9 +3366,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * @param wait\t\tIf true, then the caller wants to wait for locks. False will be", "\t * when we using a nested user xaction - we want to timeout right away if the parent", "\t * holds the lock. (bug 4821)" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\tTransactionController tc)" ], "header": "@@ -3387,8 +3373,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\t\t\t\t\tTransactionController tc,", "\t\t\t\t\t\t\t\t\t\tboolean wait)" ] }, { "added": [ "\t\t\t\t\t tc);" ], "header": "@@ -3458,8 +3443,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t tc,", "\t\t\t\t\t wait);" ] }, { "added": [ "\t\tTransactionController\ttc" ], "header": "@@ -3959,8 +3943,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tTransactionController\ttc,", "\t\tboolean wait" ] }, { "added": [ "\t\t\tinsertRetCode = ti.insertRow(row, tc);" ], "header": "@@ -3982,7 +3965,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tinsertRetCode = ti.insertRow(row, tc, wait);" ] }, { "added": [ "\t\taddSPSParams(descriptor, tc);", "\tprivate void addSPSParams(SPSDescriptor spsd, TransactionController tc)" ], "header": "@@ -3995,14 +3978,14 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\taddSPSParams(descriptor, tc, wait);", "\tprivate void addSPSParams(SPSDescriptor spsd, TransactionController tc, boolean wait)" ] }, { "added": [ "\t\t\t\t\t\t tc);" ], "header": "@@ -4034,7 +4017,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\t tc, wait);" ] }, { "added": [], "header": "@@ -4079,13 +4062,9 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * @param wait\t\tIf true, then the caller wants to wait for locks. False will be", "\t * when we using a nested user xaction - we want to timeout right away if the parent", "\t * holds the lock. (bug 4821)", "\t *" ] }, { "added": [], "header": "@@ -4093,14 +4072,12 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tboolean\t\t\t\t\twait,", "\t\tDataValueDescriptor\t\t\tcolumnNameOrderable;" ] }, { "added": [ "\t\t\t\t\t tc);" ], "header": "@@ -4148,8 +4125,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t tc,", "\t\t\t\t\t wait);" ] }, { "added": [ "\t\t\taddSPSParams(spsd, tc);" ], "header": "@@ -4180,7 +4156,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\taddSPSParams(spsd, tc, wait);" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t tc);" ], "header": "@@ -4220,8 +4196,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\t\t\t\t tc,", "\t\t\t\t\t\t\t\t\t wait);" ] }, { "added": [ "\t\tti.insertRow(row, tc);" ], "header": "@@ -5796,7 +5771,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tti.insertRow(row, tc, true);" ] }, { "added": [ "\t\t\t\t\t\t\t\ttc);" ], "header": "@@ -7309,8 +7284,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\t\t\ttc,", "\t\t\t\t\t\t\t\ttrue);" ] }, { "added": [ "\t\tint insertRetCode = ti.insertRow(row, tc);" ], "header": "@@ -7949,7 +7923,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tint insertRetCode = ti.insertRow(row, tc, true);" ] }, { "added": [ "\t\t\taddSPSDescriptor(spsd, tc);" ], "header": "@@ -9388,7 +9362,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\taddSPSDescriptor(spsd, tc, true);" ] }, { "added": [ " int insertRetCode = ti.insertRow(row, tc);" ], "header": "@@ -11834,7 +11808,7 @@ public final class\tDataDictionaryImpl", "removed": [ " int insertRetCode = ti.insertRow(row, tc, true /* wait */);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java", "hunks": [ { "added": [ "\tint insertRow( ExecRow row, TransactionController tc)", "\t\treturn insertRowListImpl(new ExecRow[] {row},tc,notUsed);" ], "header": "@@ -413,19 +413,18 @@ class TabInfoImpl", "removed": [ "\t *\t@param\twait\t\tto wait on lock or quickly TIMEOUT", "\tint insertRow( ExecRow row, TransactionController tc, boolean wait)", "\t\treturn insertRowListImpl(new ExecRow[] {row},tc,notUsed, wait);" ] }, { "added": [ "\t\treturn insertRowListImpl(rowList,tc,notUsed);" ], "header": "@@ -446,7 +445,7 @@ class TabInfoImpl", "removed": [ "\t\treturn insertRowListImpl(rowList,tc,notUsed, true);" ] }, { "added": [ "\tprivate int insertRowListImpl(ExecRow[] rowList, TransactionController tc,", " RowLocation[] rowLocationOut)" ], "header": "@@ -461,12 +460,11 @@ class TabInfoImpl", "removed": [ "\t @param wait to wait on lock or quickly TIMEOUT", "\tprivate int insertRowListImpl(ExecRow[] rowList, TransactionController tc, RowLocation[] rowLocationOut,", "\t\t\t\t\t\t\t\t boolean wait)" ] }, { "added": [ "\t\t\t\tTransactionController.OPENMODE_FORUPDATE," ], "header": "@@ -482,8 +480,7 @@ class TabInfoImpl", "removed": [ "\t\t\t\t(TransactionController.OPENMODE_FORUPDATE |", " ((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT))," ] }, { "added": [ "\t\t\t\t\t\tTransactionController.OPENMODE_FORUPDATE," ], "header": "@@ -504,8 +501,7 @@ class TabInfoImpl", "removed": [ "\t\t\t\t\t\t(TransactionController.OPENMODE_FORUPDATE |", " \t\t((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT))," ] } ] }, { "file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java", "hunks": [ { "added": [ "\t\t\tTransactionController tc) throws StandardException {", "\t\t\tboolean recompile, boolean updateSYSCOLUMNS," ], "header": "@@ -450,13 +450,13 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {", "removed": [ "\t\t\tTransactionController tc, boolean wait) throws StandardException {", "\t\t\tboolean recompile, boolean updateSYSCOLUMNS, boolean wait," ] }, { "added": [], "header": "@@ -794,12 +794,6 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {", "removed": [ "\tpublic void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent,", "\t\t\tint catalogNumber, boolean allowsDuplicates,", "\t\t\tTransactionController tc, boolean wait) throws StandardException {", "\t}", "", "" ] } ] } ]
derby-DERBY-3693-85e3e123
DERBY-3693: Deadlocks accessing DB metadata Make sure that the nested transaction used to recompile meta-data queries does not wait for locks to prevent hangs when there's a lock conflict between the nested transaction and the user transaction. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@688274 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/locks/AbstractPool.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.locks.LockOwner;" ], "header": "@@ -39,6 +39,8 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ " SanityManager.ASSERT(noLockWait(timeout, compatibilitySpace),", " \"timeout not NO_WAIT\");", "", " // If this is a timed wait, we should behave as if we timed out", " // and throw a LOCK_TIMEOUT.", " if (timeout == C_LockFactory.TIMED_WAIT) {", " throw StandardException.newException(SQLState.LOCK_TIMEOUT);", " }", "" ], "header": "@@ -120,8 +122,16 @@ abstract class AbstractPool implements LockFactory", "removed": [ "\t\t\t\tSanityManager.ASSERT(timeout == C_LockFactory.NO_WAIT, \"timeout not NO_WAIT\");" ] }, { "added": [ "\tpublic CompatibilitySpace createCompatibilitySpace(LockOwner owner) {" ], "header": "@@ -145,7 +155,7 @@ abstract class AbstractPool implements LockFactory", "removed": [ "\tpublic CompatibilitySpace createCompatibilitySpace(Object owner) {" ] }, { "added": [ "\t\tboolean success = lockTable.zeroDurationLockObject(", "", " if (!success) {", "", " // zeroDurationLockObject should only return false if we have", " // requested that we shouldn't wait for locks. Otherwise, an", " // exception should have been thrown.", " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(noLockWait(timeout, compatibilitySpace),", " \"Should have timed out\");", " }", "", " // If this is a timed wait, we should behave as if we timed out and", " // throw LOCK_TIMEOUT.", " if (timeout == C_LockFactory.TIMED_WAIT) {", " throw StandardException.newException(SQLState.LOCK_TIMEOUT);", " }", " }", "", " return success;" ], "header": "@@ -284,8 +294,27 @@ abstract class AbstractPool implements LockFactory", "removed": [ "\t\treturn lockTable.zeroDurationLockObject(" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java", "hunks": [ { "added": [ "\t\t\tif (AbstractPool.noLockWait(timeout, compatibilitySpace)) {" ], "header": "@@ -355,7 +355,7 @@ final class ConcurrentLockSet implements LockTable {", "removed": [ "\t\t\tif (timeout == C_LockFactory.NO_WAIT) {" ] }, { "added": [ " * {@inheritDoc}" ], "header": "@@ -792,22 +792,7 @@ forever:\tfor (;;) {", "removed": [ " * Lock an object and release the lock immediately. Equivalent to", " * <pre>", " * Lock lock = lockTable.lockObject(space, ref, qualifier, timeout);", " * lockTable.unlock(lock, 1);", " * </pre>", " * except that the implementation is more efficient.", " *", " * @param space the compatibility space", " * @param ref a reference to the locked object", " * @param qualifier qualifier of the lock", " * @param timeout maximum time to wait in milliseconds", " * (<code>LockFactory.NO_WAIT</code> means don't wait)", " * @return <code>true</code> if the object was locked, or", " * <code>false</code>if the timeout was <code>NO_WAIT</code> and the lock", " * couldn't be obtained immediately", " * @exception StandardException if the lock could not be obtained" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/LockSet.java", "hunks": [ { "added": [ "\t\t\tif (AbstractPool.noLockWait(timeout, compatibilitySpace)) {" ], "header": "@@ -183,7 +183,7 @@ final class LockSet implements LockTable {", "removed": [ "\t\t\tif (timeout == C_LockFactory.NO_WAIT) {" ] }, { "added": [ " * {@inheritDoc}" ], "header": "@@ -579,22 +579,7 @@ forever:\tfor (;;) {", "removed": [ " * Lock an object and release the lock immediately. Equivalent to", " * <pre>", " * Lock lock = lockTable.lockObject(space, ref, qualifier, timeout);", " * lockTable.unlock(lock, 1);", " * </pre>", " * except that the implementation is more efficient.", " *", " * @param space the compatibility space", " * @param ref a reference to the locked object", " * @param qualifier qualifier of the lock", " * @param timeout maximum time to wait in milliseconds", " * (<code>LockFactory.NO_WAIT</code> means don't wait)", " * @return <code>true</code> if the object was locked, or", " * <code>false</code>if the timeout was <code>NO_WAIT</code> and the lock", " * couldn't be obtained immediately", " * @exception StandardException if the lock could not be obtained" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/LockSpace.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.locks.LockOwner;" ], "header": "@@ -32,6 +32,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "\tprivate final LockOwner owner;" ], "header": "@@ -53,7 +54,7 @@ final class LockSpace implements CompatibilitySpace {", "removed": [ "\tprivate final Object owner;" ] }, { "added": [ "\tLockSpace(LockOwner owner) {" ], "header": "@@ -68,7 +69,7 @@ final class LockSpace implements CompatibilitySpace {", "removed": [ "\tLockSpace(Object owner) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/LockTable.java", "hunks": [ { "added": [ " * ({@code C_LockFactory.NO_WAIT} means don't wait)", " * @return a reference to the lock, or <code>null</code> if the lock", " * couldn't be obtained immediately and the timeout was {@code NO_WAIT}", " * or {@code LockOwner} had the {@code noWait} flag set" ], "header": "@@ -39,9 +39,10 @@ interface LockTable {", "removed": [ " * (<code>LockFactory.NO_WAIT</code> means don't wait)", " * @return a reference to the lock, or <code>null</code> if the timeout was", " * <code>NO_WAIT</code> and the lock couldn't be obtained immediately" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java", "hunks": [ { "added": [], "header": "@@ -23,7 +23,6 @@ package org.apache.derby.impl.services.reflect;", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;" ] }, { "added": [ "import org.apache.derby.iapi.services.locks.LockOwner;" ], "header": "@@ -46,6 +45,7 @@ import org.apache.derby.iapi.reference.MessageId;", "removed": [] }, { "added": [ "final class UpdateLoader implements LockOwner {" ], "header": "@@ -62,7 +62,7 @@ import org.apache.derby.iapi.services.locks.CompatibilitySpace;", "removed": [ "final class UpdateLoader {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/Xact.java", "hunks": [ { "added": [], "header": "@@ -58,8 +58,6 @@ import org.apache.derby.iapi.types.DataValueFactory;", "removed": [ "import org.apache.derby.catalog.UUID;", "" ] }, { "added": [ "import org.apache.derby.iapi.services.locks.LockOwner;" ], "header": "@@ -76,11 +74,9 @@ import org.apache.derby.iapi.services.locks.CompatibilitySpace;", "removed": [ "import org.apache.derby.impl.store.raw.log.LogToFile;", "", "import org.apache.derby.iapi.services.context.ContextService;" ] }, { "added": [ "public class Xact extends RawTransaction implements Limit, LockOwner {" ], "header": "@@ -98,7 +94,7 @@ import org.apache.derby.iapi.services.context.ContextService;", "removed": [ "public class Xact extends RawTransaction implements Limit {" ] }, { "added": [ " /**", " * Tells if lock requests should time out immediately if they cannot be", " * granted without waiting.", " */", " private boolean dontWaitForLocks;" ], "header": "@@ -252,6 +248,11 @@ public class Xact extends RawTransaction implements Limit {", "removed": [] } ] } ]
derby-DERBY-3693-a9215529
DERBY-3850: Remove unneeded workarounds for DERBY-177 and DERBY-3693 Removed the wait parameter from TabInfoImpl.updateRow(). The method only had two callers, both of which called it with wait=true. updateRow() passed the parameter on to openForUpdate() in RowChanger, but that method is sometimes called with wait=false, so the parameter couldn't be removed from that method. Also removed an unused variable and some unused imports. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@695244 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java", "hunks": [ { "added": [], "header": "@@ -22,18 +22,14 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextService;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;" ] }, { "added": [], "header": "@@ -46,11 +42,8 @@ import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;", "removed": [ "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.catalog.UUID;", "import java.util.Enumeration;" ] }, { "added": [ "\t\tupdateRow(key, newRows, indexNumber, indicesToUpdate, colsToUpdate, tc);" ], "header": "@@ -936,7 +929,7 @@ class TabInfoImpl", "removed": [ "\t\tupdateRow(key, newRows, indexNumber, indicesToUpdate, colsToUpdate, tc, true);" ] }, { "added": [], "header": "@@ -963,46 +956,11 @@ class TabInfoImpl", "removed": [ "\t{", "\t\tupdateRow(key, newRows, indexNumber, indicesToUpdate, colsToUpdate, tc, true);", "\t}", "", "\t/**", "\t * Updates a set of base rows in a catalog with the same key on an index", "\t * and updates all the corresponding index rows. If parameter wait is true,", "\t * then the caller wants to wait for locks. When using a nested user xaction", "\t * we want to timeout right away if the parent holds the lock.", "\t *", "\t *\t@param\tkey\t\t\tkey row", "\t *\t@param\tnewRows\t\tnew version of the array of rows", "\t *\t@param\tindexNumber\tindex that key operates", "\t *\t@param\tindicesToUpdate\tarray of booleans, one for each index on the catalog.", "\t *\t\t\t\t\t\t\tif a boolean is true, that means we must update the", "\t *\t\t\t\t\t\t\tcorresponding index because changes in the newRow", "\t *\t\t\t\t\t\t\taffect it.", "\t *\t@param colsToUpdate\tarray of ints indicating which columns (1 based)", "\t *\t\t\t\t\t\t\tto update. If null, do all.", "\t *\t@param\ttc\t\t\ttransaction controller", "\t *\t@param wait\t\tIf true, then the caller wants to wait for locks. When", "\t *\t\t\t\t\t\t\tusing a nested user xaction we want to timeout right away", "\t *\t\t\t\t\t\t\tif the parent holds the lock. (bug 4821)", "\t *", "\t * @exception StandardException\t\tThrown on failure", "\t */", "\tprivate void updateRow( ExecIndexRow\t\t\t\tkey,", "\t\t\t\t\t\t ExecRow[]\t\t\t\tnewRows,", "\t\t\t\t\t\t int\t\t\t\t\t\tindexNumber,", "\t\t\t\t\t\t boolean[]\t\t\t\tindicesToUpdate,", "\t\t\t\t\t\t int[]\t\t\t\t\tcolsToUpdate,", "\t\t\t\t\t\t TransactionController\ttc,", "\t\t\t\t\t\t boolean wait)", "\t\tthrows StandardException", "\t\tExecIndexRow\t\t\t\ttemplateRow;" ] }, { "added": [ "\t\trc.openForUpdate(indicesToUpdate, TransactionController.MODE_RECORD, true);", " TransactionController.OPENMODE_FORUPDATE,", "\t\t\tTransactionController.OPENMODE_FORUPDATE," ], "header": "@@ -1014,22 +972,20 @@ class TabInfoImpl", "removed": [ "\t\trc.openForUpdate(indicesToUpdate, TransactionController.MODE_RECORD, wait); ", " (TransactionController.OPENMODE_FORUPDATE |", " ((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT)),", "\t\t\t(TransactionController.OPENMODE_FORUPDATE |", " ((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT)), " ] } ] } ]
derby-DERBY-3695-8a4e363f
DERBY-3695: NullPointerException when invoking statement event listeners if one of the listeners is null Made addStatementEventListener(null) a no-op on the client to match embedded. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@661292 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3696-015b39a6
DERBY-3696: Delete superfluous test lang/longStringColumn.java. Patch file: derby-3696-1a-delete_longStringColumn_test.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@663062 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3701-1bc76745
DERBY-3701: Fixed indentation git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@664530 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/Session.java", "hunks": [ { "added": [ " this.nsctrl = nsctrl;" ], "header": "@@ -88,7 +88,7 @@ class Session", "removed": [ " this.nsctrl = nsctrl;" ] }, { "added": [ " * @param throwException - true if we should throw an exception if", " * turning on tracing fails. We do this", " * for NetworkServerControl API commands." ], "header": "@@ -127,8 +127,9 @@ class Session", "removed": [ " * @param throwException - true if we should throw an exception if turning on tracing fails.", " * We do this for NetworkServerControl API commands." ] }, { "added": [ " try {", " dssTrace.startComBufferTrace(traceFileName);", " traceOn = true;", " } catch (Exception e) { ", " if (throwException) {", " throw e;", " }", " // If there is an error starting tracing for the session,", " // log to the console and derby.log and do not turn tracing on.", " // let connection continue.", " nsctrl.consoleExceptionPrintTrace(e);", " } " ], "header": "@@ -141,18 +142,18 @@ class Session", "removed": [ " try {", " dssTrace.startComBufferTrace (traceFileName);", " traceOn = true;", " } catch (Exception e)", " { ", " if (throwException)", " throw e;", " // If there is an error starting tracing for the session,", " // log to the console and derby.log and do not turn tracing on.", " // let connection continue.", " nsctrl.consoleExceptionPrintTrace(e);", " } " ] } ] } ]
derby-DERBY-3701-45680ff9
DERBY-3701 java.lang.Exception: DRDA_UnableToAccept.S:Unable to accept connections and client hang if tracing is turned on but traceDirectory does not exist - attempt to create directory if it does not exist. - log an error but do not hang the client if session tracing file cannot be created. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@664124 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DssTrace.java", "hunks": [ { "added": [ "import java.io.File;", "import org.apache.derby.iapi.util.PrivilegedFileOps;", "" ], "header": "@@ -20,12 +20,15 @@", "removed": [] }, { "added": [ " protected void startComBufferTrace (final String fileName) throws Exception ", " // Attempt to make the trace directory if it does not exist.", " // If we can't create the directory the exception will occur ", " // when trying to create the trace file.", " File traceDirectory = new File(fileName).getParentFile();", " if (!PrivilegedFileOps.exists(traceDirectory))", " {", " PrivilegedFileOps.mkdirs(traceDirectory);", " }", " // The writer will be buffered for effeciency." ], "header": "@@ -167,14 +170,21 @@ public class DssTrace", "removed": [ " protected void startComBufferTrace (final String fileName) throws IOException ", " // The writer will be buffered for effeciency.", " " ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\tsession.setTraceOn(traceDirectory,true);" ], "header": "@@ -3502,7 +3502,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\tsession.setTraceOn(traceDirectory);" ] }, { "added": [ "\t\t\t\t\t\tsession.setTraceOn(traceDirectory,true);" ], "header": "@@ -3522,7 +3522,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\tsession.setTraceOn(traceDirectory);" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/Session.java", "hunks": [ { "added": [ "\tprivate NetworkServerControlImpl nsctrl; // NetworkServerControlImpl needed for logging", " // message if tracing fails.", " " ], "header": "@@ -70,6 +70,9 @@ class Session", "removed": [] }, { "added": [ "\tSession (NetworkServerControlImpl nsctrl, int connNum, Socket clientSocket, String traceDirectory,", "\t\t\tboolean traceOn) throws Exception", " this.nsctrl = nsctrl;" ], "header": "@@ -82,9 +85,10 @@ class Session", "removed": [ "\tSession (int connNum, Socket clientSocket, String traceDirectory,", "\t\t\tboolean traceOn) throws IOException" ] }, { "added": [ " * @param throwException - true if we should throw an exception if turning on tracing fails.", " * We do this for NetworkServerControl API commands.", "\tprotected void initTrace(String traceDirectory, boolean throwException) throws Exception" ], "header": "@@ -123,9 +127,11 @@ class Session", "removed": [ "\tprotected void initTrace(String traceDirectory) throws IOException " ] }, { "added": [ " try {", " dssTrace.startComBufferTrace (traceFileName);", " traceOn = true;", " } catch (Exception e)", " { ", " if (throwException)", " throw e;", " // If there is an error starting tracing for the session,", " // log to the console and derby.log and do not turn tracing on.", " // let connection continue.", " nsctrl.consoleExceptionPrintTrace(e);", " } ", "\t * @throws Exception ", "\tprotected void setTraceOn(String traceDirectory, boolean throwException) throws Exception", "\t\tinitTrace(traceDirectory, throwException); " ], "header": "@@ -135,21 +141,31 @@ class Session", "removed": [ "\t\tdssTrace.startComBufferTrace (traceFileName);", "\t\ttraceOn = true;", "\t * @throws IOException ", "\tprotected void setTraceOn(String traceDirectory) throws IOException", "\t\tinitTrace(traceDirectory); " ] } ] } ]
derby-DERBY-3704-1ba604e3
DERBY-3704 If an IOException is encountered during establishment of the connection, Network Server should print the root exception to the console instead of a generic message git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@662876 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/ClientThread.java", "hunks": [ { "added": [ " parent.consoleExceptionPrintTrace(ioe);", " if (clientSocket != null)", " clientSocket.close();" ], "header": "@@ -113,7 +113,9 @@ final class ClientThread extends Thread {", "removed": [ " parent.consolePropertyMessage(\"DRDA_UnableToAccept.S\");" ] }, { "added": [ " try {", " if (clientSocket != null)", " clientSocket.close();", " } catch (IOException closeioe)", " {", " parent.consoleExceptionPrintTrace(closeioe);", " }" ], "header": "@@ -122,6 +124,13 @@ final class ClientThread extends Thread {", "removed": [] } ] } ]
derby-DERBY-3705-5e717f9f
DERBY-3705: In Net Client mode, negative values for stream length are accepted without an exception for PreparedStatement.setAsciiStream(). Added check to disallow specified stream length to be negative. Refactored specified length checking into a single method. Patch file: derby-3705-2b.diff Patch contributed by Suran Jayathilaka. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@666174 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/PreparedStatement.java", "hunks": [ { "added": [ " checkStreamLength(length);" ], "header": "@@ -1022,11 +1022,7 @@ public class PreparedStatement extends Statement", "removed": [ " if(length > Integer.MAX_VALUE) {", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),", " new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();", " }" ] }, { "added": [ " agent_.logWriter_.traceEntry(this, \"setAsciiStream\",", " parameterIndex, \"<input stream>\", new Long(length));" ], "header": "@@ -1088,7 +1084,8 @@ public class PreparedStatement extends Statement", "removed": [ " agent_.logWriter_.traceEntry(this, \"setAsciiStream\", parameterIndex, \"<input stream>\", new Long(length));" ] }, { "added": [ " checkStreamLength(length);" ], "header": "@@ -1098,11 +1095,7 @@ public class PreparedStatement extends Statement", "removed": [ " if(length > Integer.MAX_VALUE) {", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),", " new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();", " }" ] }, { "added": [ " /**", " * Check the length passed in for the stream that is to be set. If length is", " * larger than Integer.MAX_VALUE or smaller that 0, we fail by throwing an ", " * SQLException.", " * @param length The length of the stream being set", " * @throws SQLException Thrown for a negative or too large length.", " */", " private void checkStreamLength(long length) throws SQLException {", " if(length > Integer.MAX_VALUE) {", " throw new SqlException(", " agent_.logWriter_,", " new ClientMessageId(", " SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),", " new Long(length),", " new Integer(Integer.MAX_VALUE)", " ).getSQLException();", " } else if (length < 0) {", " throw new SqlException(", " agent_.logWriter_,", " new ClientMessageId(SQLState.NEGATIVE_STREAM_LENGTH)", " ).getSQLException();", " }", " }", " " ], "header": "@@ -1127,7 +1120,30 @@ public class PreparedStatement extends Statement", "removed": [ "" ] }, { "added": [ " checkStreamLength(length);" ], "header": "@@ -1276,11 +1292,7 @@ public class PreparedStatement extends Statement", "removed": [ " if(length > Integer.MAX_VALUE) {", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),", " new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();", " }" ] } ] } ]
derby-DERBY-3706-00077a4f
DERBY-3706 NetworkServer console messages should print a time stamp Contributed by Suran Jayathilaka git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@674354 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\tconsoleMessage(msg, true);" ], "header": "@@ -538,7 +538,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tconsoleMessage(msg);" ] }, { "added": [ "\t\tconsoleMessage(e.getMessage(), true);" ], "header": "@@ -564,7 +564,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tconsoleMessage(e.getMessage());" ] }, { "added": [ " * @param printTimeStamp Whether to prepend a timestamp to the message or not", "\tpublic void consoleMessage(String msg, boolean printTimeStamp)", " if (printTimeStamp) {", " lw.println(getFormattedTimestamp() + \" : \" + msg);", " } else {", " lw.println(msg); ", " }" ], "header": "@@ -593,15 +593,20 @@ public final class NetworkServerControlImpl {", "removed": [ "\tpublic void consoleMessage(String msg)", "\t\t\t\tlw.println(msg);" ] }, { "added": [ "\t\t\t\tif (printTimeStamp) {", " Monitor.logMessage(getFormattedTimestamp() + \" : \" + msg);", " } else {", " Monitor.logMessage(msg);", " }" ], "header": "@@ -609,7 +614,11 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\tMonitor.logMessage(msg);" ] }, { "added": [ "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString});", "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString});", "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString});" ], "header": "@@ -743,18 +752,15 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString,", "\t\t\t\t getFormattedTimestamp()});", "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString,", "\t\t\t\t getFormattedTimestamp()});", "\t\t\t\t{Integer.toString(portNumber), att_srvclsnm, versionString,", "\t\t\t\t getFormattedTimestamp()});" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_ListenerClose.S\", true);" ], "header": "@@ -844,7 +850,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_ListenerClose.S\");" ] }, { "added": [ "\t\t\t\t\t\t {att_srvclsnm, versionString});" ], "header": "@@ -889,8 +895,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t {att_srvclsnm, versionString, ", "\t\t\t\t\t\t\t\tgetFormattedTimestamp()});" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_Usage\"+i+\".I\", false);" ], "header": "@@ -1304,7 +1309,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_Usage\"+i+\".I\");" ] }, { "added": [ "\t * @param printTimeStamp whether to prepend a timestamp to the message", " *", " * @throws Exception if an error occurs", "\tprotected void consolePropertyMessage(String msgProp, boolean printTimeStamp)", "\t\tconsolePropertyMessageWork(msgProp, null, printTimeStamp);" ], "header": "@@ -1820,13 +1825,14 @@ public final class NetworkServerControlImpl {", "removed": [ "\t *", "\t * @throws Exception if an error occurs", "\tprotected void consolePropertyMessage(String msgProp)", "\t\tconsolePropertyMessageWork(msgProp, null);" ] }, { "added": [ "\t\tconsolePropertyMessageWork(msgProp, new String [] {arg}, true);" ], "header": "@@ -1839,7 +1845,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tconsolePropertyMessageWork(msgProp, new String [] {arg});" ] }, { "added": [ "\t\tconsolePropertyMessageWork(msgProp, args, true);" ], "header": "@@ -1852,7 +1858,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tconsolePropertyMessageWork(msgProp, args);" ] }, { "added": [ " consolePropertyMessage(\"DRDA_NoCommand.U\", true);" ], "header": "@@ -2106,7 +2112,7 @@ public final class NetworkServerControlImpl {", "removed": [ " consolePropertyMessage(\"DRDA_NoCommand.U\");" ] }, { "added": [ "\t\t\t\t\t\t\t\t{att_srvclsnm, versionString});" ], "header": "@@ -2144,8 +2150,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\t\t{att_srvclsnm, versionString, ", "\t\t\t\t\t\t\t\tgetFormattedTimestamp()});" ] }, { "added": [ "\t\t\t\t\tconsoleMessage(info, false);" ], "header": "@@ -2174,7 +2179,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\tconsoleMessage(info);" ] }, { "added": [ "\t\t\t\tconsoleMessage(reply, false);" ], "header": "@@ -2193,7 +2198,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\tconsoleMessage(reply);" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_NoInputStream.I\", true);" ], "header": "@@ -2510,7 +2515,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_NoInputStream.I\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2703,7 +2708,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(message, true);" ], "header": "@@ -2714,7 +2719,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(message);" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2763,7 +2768,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2793,7 +2798,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2805,7 +2810,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(msgKey, true);" ], "header": "@@ -2825,7 +2830,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(msgKey);" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2844,7 +2849,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t\t\tconsolePropertyMessage(msgKey, true);" ], "header": "@@ -2863,7 +2868,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(msgKey);" ] }, { "added": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\", true);" ], "header": "@@ -2878,7 +2883,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tconsolePropertyMessage(\"DRDA_InvalidReplyTooShort.S\");" ] }, { "added": [ "\t * @param printTimeStamp whether to prepend a timestamp to the message", " *", " * @throws Exception if an error occurs", "\tprivate void consolePropertyMessageWork(String messageKey, String [] args, boolean printTimeStamp)" ], "header": "@@ -3133,10 +3138,11 @@ public final class NetworkServerControlImpl {", "removed": [ "\t *", "\t * @throws Exception if an error occurs", "\tprivate void consolePropertyMessageWork(String messageKey, String [] args)" ] } ] } ]
derby-DERBY-3708-ea9b68b4
DERBY-3708 setting tracedirectory from the command line does not work git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@669243 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3709-d2291224
DERBY-3709 Changes the replication test to ensure that the failure due to failover being started before replication is booted is not hidden Patch Contributor: Ole Soldberg git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@666006 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3710-9d7aba6f
DERBY-3710: For AES encryption, store checksum that is computed on padded key rather than unpadded key. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@800773 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/jce/JCECipherFactory.java", "hunks": [ { "added": [ "\tprivate EncryptedKeyResult encryptKey(byte[] secretKey, byte[] bootPassword)" ], "header": "@@ -187,7 +187,7 @@ public final class JCECipherFactory implements CipherFactory, java.security.Priv", "removed": [ "\tprivate String encryptKey(byte[] secretKey, byte[] bootPassword)" ] }, { "added": [ "\t\tString hexOutput = org.apache.derby.iapi.util.StringUtil.toHexString(result, 0, result.length);", "", " return new EncryptedKeyResult( hexOutput, secretKey );" ], "header": "@@ -215,7 +215,9 @@ public final class JCECipherFactory implements CipherFactory, java.security.Priv", "removed": [ "\t\treturn org.apache.derby.iapi.util.StringUtil.toHexString(result, 0, result.length);" ] }, { "added": [ "\t\tEncryptedKeyResult ekr = encryptKey(secretKey, bootPassword);", "\t\tString encryptedKey = ekr.hexOutput;", "\t\tint verifyKey = digest(ekr.paddedInputKey);" ], "header": "@@ -749,11 +751,12 @@ public final class JCECipherFactory implements CipherFactory, java.security.Priv", "removed": [ "\t\tString encryptedKey = encryptKey(secretKey, bootPassword);", "\t\tint verifyKey = digest(secretKey);" ] } ] } ]
derby-DERBY-3718-90701f7b
DERBY-3718 Derby has an internal datatype called REF. For REF datatypes, we associate Types.OTHER as it's type. This association of Types.OTHER for REF datatype is causing NPE when a row level trigger is fired in the test case provided in DERBY-3718. This NPE happens only in 10.4 and trunk. This is because starting 10.4(DERBY-2917 revision r619995), rather than saving the TypeId of the DataTypeDescriptor (in DataTypeDescriptor.writeExternal method), we rely on reconstructing TypeId (in readExternal) by using the Types.xxx associated with a type. This approach does not work for internal datatype REF, because we use Types.OTHER for REF datatypes. Types.OTHER is not enough to know that the type to be constructed is REF. Since we are dealing with the internal type which will be assigned a Types.OTHER type then we can't rely on Types.xxx to get us the correct data type. This fix relies on using the name of the data type rather than it's Type.xxx to construct the correct TypeId. This is being accomplised by changing DataTypeDescriptor.readExternal to use this.getTypeName rather than this.getJDBCTypeId to construct the TypeId. In addition to this change, I had to change DataTypeDescriptor.getTypeName() to use TypeDescriptor to get the type name rather than TypeId. This is because TypeId is not available when DataTypeDescriptor.readExternal calls DataTypeDescriptor.getTypeName. This will match how we already implement DataTypeDescriptor.getJDBCTypeId(). Junit and old harness suite have run with no new regressions. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@670778 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ "\t\treturn typeDescriptor.getTypeName();" ], "header": "@@ -1036,7 +1036,7 @@ public final class DataTypeDescriptor implements Formatable", "removed": [ "\t\treturn typeId.getSQLTypeName();" ] } ] } ]
derby-DERBY-3723-818ef2ab
DERBY-3723: Reset current schema to default (user name) when creating a new logical connection in the client driver. Resets the schema to the associated user name for the physical connection when creating a new logical connection (which is currently implemented as resetting the physical connection). Also made 'Connection.user_' final. Patch file: derby-3723-1a-client_schema_reset.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@671128 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " protected final String user_;" ], "header": "@@ -61,7 +61,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " public transient String user_;" ] }, { "added": [ " this.user_ = user;", " initConnection(logWriter, dataSource);" ], "header": "@@ -171,7 +171,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " initConnection(logWriter, user, dataSource);" ] }, { "added": [ " this.user_ = user;", " initConnection(logWriter, dataSource);" ], "header": "@@ -180,21 +181,19 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " initConnection(logWriter, user, dataSource);", " String user,", " user_ = user;", "" ] }, { "added": [ " // DERBY-3723: Reset schema to user name.", " currentSchemaName_ = this.user_;" ], "header": "@@ -280,7 +279,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " currentSchemaName_ = null;" ] } ] } ]
derby-DERBY-3726-9b54b81f
DERBY-3726: Don't call RAFContainer.padFile() from instances of RAFContainer4 When we create a new container, allocate a byte array that is large enough to hold an entire page so that we don't need to pad the file after writing the array to disk. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@670534 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [ "", " // Allocating AllocPage.MAX_BORROWED_SPACE bytes for the", " // embryonic page should be enough, but we want to leave", " // the end of the file at a page boundary. This is to work", " // around bugs in the EPOC jvm where a seek beyond the end", " // of a file does not throw an exception but just moves", " // the offset to the end of the file. This only occurs", " // when the second page is written after the header has", " // been written, ending up with the page at the incorrect", " // offset.", "", " epage = new byte[pageSize];" ], "header": "@@ -675,7 +675,18 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t\t\tepage = getEmbryonicPage((DataInput)null); " ] }, { "added": [], "header": "@@ -686,16 +697,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t\t// leave the end of the file at a page boundry. This", "\t\t// is to work around bugs in the EPOC jvm where a seek", "\t\t// beyond the end of a file does not throw an exception", "\t\t// but just moves the offset to the end of the file. This only", "\t\t// occurs when the second page is written after the header has", "\t\t// been written, ending up with the page at the incorrect offset.", "\t\tif (create) {", "\t\t\tpadFile(file, pageSize);", "\t\t}", "" ] }, { "added": [], "header": "@@ -710,8 +711,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "", "\t\tepage = null;" ] } ] } ]
derby-DERBY-3727-30c9f828
DERBY-3727 Improve error information reported when encountering "ERROR XSDB3: Container information cannot change once written: was 103, now 80" Added error reporting of the container id when an error is encountered while writing the container header information. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@959378 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java", "hunks": [ { "added": [ "\tprotected void writeHeader(", " Object identity, ", " byte[] pageData)", " try", " {", " catch (StandardException se)", " {", "\t\t\tthrow StandardException.newException(", " SQLState.DATA_BAD_CONTAINERINFO_WRITE, se, identity);", " }", "\t}" ], "header": "@@ -841,15 +841,25 @@ abstract class FileContainer", "removed": [ "\tprotected void writeHeader(byte[] pageData)" ] }, { "added": [ "\tprotected void writeHeader(", " Object identity,", " StorageRandomAccessFile file,", " boolean create, ", " byte[] epage)" ], "header": "@@ -862,8 +872,11 @@ abstract class FileContainer", "removed": [ "\tprotected void writeHeader(StorageRandomAccessFile file,", " boolean create, byte[] epage)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [ " writeHeader(getIdentity(), pageData);" ], "header": "@@ -386,7 +386,7 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " writeHeader(pageData);" ] }, { "added": [ " writeRAFHeader(", " getIdentity(),", " fileData," ], "header": "@@ -531,7 +531,9 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t\t\t\t\twriteRAFHeader(fileData," ] }, { "added": [ " private void writeRAFHeader(", " Object identity,", " StorageRandomAccessFile file, ", " boolean create, " ], "header": "@@ -667,7 +669,10 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\tprivate void writeRAFHeader(StorageRandomAccessFile file, boolean create, " ] }, { "added": [ " writeHeader(identity, file, create, epage);" ], "header": "@@ -695,7 +700,7 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t\twriteHeader(file, create, epage);" ] }, { "added": [ " byte[] dataToWrite = ", " updatePageArray(", " pageNumber, ", " encryptionBuf, ", " false);" ], "header": "@@ -1091,9 +1096,12 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " byte[] dataToWrite = updatePageArray(pageNumber, ", " encryptionBuf, false);" ] }, { "added": [ " // allocation page and the container information is stored ", " // within it. The allocation page needs to be somewhat ", " // formatted because if the system crashed after the create ", " // container log operation is written, it needs to be well ", " // formed enough to get the container information back out of", " // it.", " // Don't try to go thru the page cache here because the ", " // container object cannot be found in the container cache at", " // this point yet. However, if we use the page cache to store", " // the first allocation page, then in order to write itself ", " // out, it needs to ask the container to do so, which is going", " // to create a deadlock. The allocation page cannot write ", " // itself out without going thru the container because it ", " // doesn't know where its offset is. Here we effectively ", " // hardwire page 0 at offset 0 of the container file to be ", " // the first allocation page.", "", " // create an embryonic page - if this is not a temporary ", " // container, synchronously write out the file header.", " writeRAFHeader(", " actionIdentity, fileData, true, ", " (actionIdentity.getSegmentId() != ", " ContainerHandle.TEMPORARY_SEGMENT));" ], "header": "@@ -1316,26 +1324,30 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " // allocation page and the container information is stored within", " // it. The allocation page needs to be somewhat formatted", " // because if the system crashed after the create container log", " // operation is written, it needs to be well formed enough to get", " // the container information back out of it.", " // Don't try to go thru the page cache here because the container", " // object cannot be found in the container cache at this point", " // yet. However, if we use the page cache to store the first", " // allocation page, then in order to write itself out, it needs to", " // ask the container to do so, which is going to create a", " // deadlock. The allocation page cannot write itself out without", " // going thru the container because it doesn't know where its", " // offset is. Here we effectively hardwired page 0 at offset 0 of", " // the container file to be the first allocation page.", "", " // create an embryonic page - if this is not a temporary container,", " // synchronously write out the file header.", " writeRAFHeader(fileData, true,", " (actionIdentity.getSegmentId() != ContainerHandle.TEMPORARY_SEGMENT));" ] } ] } ]
derby-DERBY-3728-e906df8e
DERBY-3728: Fix error handling in PrivilegedFileOpsForTests. Removed unnecessary throws clauses (replaced PrivilegedExceptionAction with PrivilegedAction) and the possibility for a ClassCastException. Fixed some documentation. Patch file: derby-3728-1a.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@702518 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3731-2365e789
DERBY-3731: Improve calculation of refSize in ClassSize.java. Changed implementation to get the value for refSize through system properties. If that doesn't work due to missing privileges or unknown values, we fall back to the heuristic. The system properties consulted are "sun.arch.data.model" and "os.arch". Patch file: derby-3731-1c-refsize_from_properties.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@679690 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/cache/ClassSize.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import java.util.Arrays;" ], "header": "@@ -23,11 +23,11 @@ package org.apache.derby.iapi.services.cache;", "removed": [ "import java.lang.Class;", "import java.lang.Runtime;", "import java.lang.InterruptedException;" ] }, { "added": [ " catch( Exception e){}", " int tmpRefSize = fetchRefSizeFromSystemProperties();", " // If we didn't understand the properties, or were not allowed to read", " // them, use a heuristic.", " if (tmpRefSize < 4) {", " Runtime runtime = Runtime.getRuntime();", " runtime.gc();", " runtime.runFinalization();", " long memBase = runtime.totalMemory() - runtime.freeMemory();", " Object[] junk = new Object[10000];", " runtime.gc();", " runtime.runFinalization();", " long memUsed = runtime.totalMemory() - runtime.freeMemory() - memBase;", " int sz = (int)((memUsed + junk.length/2)/junk.length);", " tmpRefSize = ( 4 > sz) ? 4 : sz;", " }", " // Assign what we have found to the final variable.", " refSize = tmpRefSize;" ], "header": "@@ -67,19 +67,26 @@ public class ClassSize", "removed": [ " catch( Exception e){};", " Runtime runtime = Runtime.getRuntime();", " runtime.gc();", " runtime.runFinalization();", " long memBase = runtime.totalMemory() - runtime.freeMemory();", " Object[] junk = new Object[10000];", " runtime.gc();", " runtime.runFinalization();", " long memUsed = runtime.totalMemory() - runtime.freeMemory() - memBase;", " int sz = (int)((memUsed + junk.length/2)/junk.length);", " refSize = ( 4 > sz) ? 4 : sz;" ] } ] } ]
derby-DERBY-3732-146fd5c0
DERBY-3732 SQL Length function materializes BLOB into memory git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@672818 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SQLBinary.java", "hunks": [ { "added": [ "\t\t\tthrowStreamingIOException(ioe);" ], "header": "@@ -229,7 +229,7 @@ abstract class SQLBinary", "removed": [ "\t\t\tthrow StandardException.newException(SQLState.LANG_STREAMING_COLUMN_I_O_EXCEPTION, ioe, getTypeName());" ] } ] } ]
derby-DERBY-3734-054acc3b
DERBY-3734 Changing the undocumented property derby.storage.fileCacheSize to allow any maximum setting, previously it limited the setting to a maximum of 100. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@671240 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ " // Initialize the page cache" ], "header": "@@ -377,6 +377,7 @@ public class BaseDataFileFactory", "removed": [] }, { "added": [ " cf.newCacheManager(", " this, \"PageCache\", pageCacheSize / 2, pageCacheSize);", " // Initialize the container cache", " RawStoreFactory.CONTAINER_CACHE_SIZE_PARAMETER,", " RawStoreFactory.CONTAINER_CACHE_SIZE_DEFAULT,", " RawStoreFactory.CONTAINER_CACHE_SIZE_MINIMUM,", " RawStoreFactory.CONTAINER_CACHE_SIZE_MAXIMUM);" ], "header": "@@ -385,17 +386,16 @@ public class BaseDataFileFactory", "removed": [ "\t\t\t\tcf.newCacheManager(this,", " \"PageCache\",", " pageCacheSize / 2,", " pageCacheSize);", "\t\t\t\t\t\"derby.storage.fileCacheSize\",", " 100,", " 2,", " 100);" ] }, { "added": [], "header": "@@ -408,7 +408,6 @@ public class BaseDataFileFactory", "removed": [ "" ] } ] } ]
derby-DERBY-3735-18fca03d
DERBY-3735: Incorrect position calculation in PositionedStoreStream with read(byte[],...). Fixed calculation by only adding positive integers (not allowing -1). Added a general test and a regression test. Made LoopingAlphabetStream implement Resetable to allow it to be used for testing where a resetable stream is expected. Patch file: derby-3735-1b.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@671840 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/PositionedStoreStream.java", "hunks": [ { "added": [ " return read(b, 0, b.length);" ], "header": "@@ -96,9 +96,7 @@ public class PositionedStoreStream", "removed": [ " int ret = this.stream.read(b);", " this.pos += ret;", " return ret;" ] }, { "added": [ " if (ret > 0) {", " this.pos += ret;", " }" ], "header": "@@ -112,7 +110,9 @@ public class PositionedStoreStream", "removed": [ " this.pos += ret;" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/streams/LoopingAlphabetStream.java", "hunks": [ { "added": [ "", "import org.apache.derby.iapi.types.Resetable;", " extends InputStream", " implements Resetable {" ], "header": "@@ -22,14 +22,16 @@", "removed": [ "import java.io.IOException;", " extends InputStream {" ] }, { "added": [ " /**", " * Creates a looping alphabet stream with the specified length, in which the", " * last characters are blanks.", " *", " * @param length total length of the stream", " * @param trailingBlanks number of trailing blanks", " */", " if (trailingBlanks > length) {", " throw new IllegalArgumentException(\"Number of trailing blanks \" +", " \"cannot be greater than the total length.\");", " }" ], "header": "@@ -56,7 +58,18 @@ public class LoopingAlphabetStream", "removed": [] }, { "added": [ "", " // Resetable interface", "", " public void resetStream() {", " reset();", " }", "", " public void initStream() {", " reset();", " }", "", " public void closeStream() {", " // Does nothing for this stream.", " }" ], "header": "@@ -184,4 +197,18 @@ public class LoopingAlphabetStream", "removed": [] } ] } ]
derby-DERBY-3736-0eb97d9e
DERBY-3736 Revoking a column level privilege from a user, a prepared statement relying on that privilege can still be executed Patch derby-3736b, which fixes this issue, and adds a new testcase. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@674808 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3739-33fa3208
DERBY-3739: Skip and read methods in ArrayInputStream may overflow Changed checks in read() and in readFully() so that they are not vulnerable to integer overflow. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@673610 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java", "hunks": [ { "added": [ " final int available = available();", " if (len > available) {", " // attempted to read more bytes than available", " if (available == 0) {", " // no bytes available, return -1 to report end of file", " return -1;", " }", " // read all the available bytes", " len = available;", " }" ], "header": "@@ -105,15 +105,19 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ "\t\tif ((position + len) > end) {", "\t\t\tlen = end - position;", "\t\t\tif (len == 0) {", "\t\t\t\treturn -1; // end of file", "\t\t\t}", "\t\t}" ] }, { "added": [ "\t\tif (len > available()) {" ], "header": "@@ -214,8 +218,7 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ "\t\tif ((position + len) > end) {", "" ] } ] } ]
derby-DERBY-3739-50af3048
DERBY-3739: Skip and read methods in ArrayInputStream may overflow Fixed problems with negative byte count and overflow in skip() and skipBytes(), and added a unit test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@673026 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java", "hunks": [ { "added": [ " /**", " * Skip as many bytes as possible, but no more than {@code count}.", " *", " * @param count the number of bytes to skip", " * @return the number of bytes that were skipped", " */", " // return 0 on non-positive count, per javadoc for", " // InputStream.skip(long)", " if (count <= 0) {", " return 0;", " }", " // don't skip more bytes than we have available", " long toSkip = Math.min(count, available());", " position += toSkip;", " return toSkip;" ], "header": "@@ -120,19 +120,24 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ "\t\tif ((position + count) > end) {", "", "\t\t\tcount = end - position;", "", "\t\t\tif (count == 0)", "\t\t\t\treturn 0; // end of file", "\t\t}", "", "\t\tposition += count;", "\t\treturn count;" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java", "hunks": [ { "added": [ " suite.addTest(ArrayInputStreamTest.suite());" ], "header": "@@ -46,6 +46,7 @@ public class _Suite extends BaseTestCase {", "removed": [] } ] } ]
derby-DERBY-374-a36fdb78
DERBY-374 Invalid URL with Derby Client when connecting to Network Server causes protocol exception. This patch does the following: 1. Network server used to give NPE when InternalDriver returns null connection for certain malformed URLs. With this patch, network server checks for null connections returned by InternalDriver and returns RDBAFLRM and SQLCARD with null SQLException. 2. The client parses the SQLCARD and if finds null SQLException, it sets connectionNull variable in NetConnection to true. 3. ClientDriver connect method, which calls the constructor of NetConnection, gets back an object with connectionNull set to true. And it inturn returns null connection. 4. Added tests to checkDriver.java for more Client URLs. Contributed by Deepa Remesh git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@292917 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/NetConnection.java", "hunks": [ { "added": [ " ", " //If Network Server gets null connection from the embedded driver, ", " //it sends RDBAFLRM followed by SQLCARD with null SQLException.", " //Client will parse the SQLCARD and set connectionNull to true if the", " //SQLCARD is empty. If connectionNull=true, connect method in ", " //ClientDriver will in turn return null connection.", " private boolean connectionNull = false;" ], "header": "@@ -128,6 +128,13 @@ public class NetConnection extends org.apache.derby.client.am.Connection {", "removed": [] }, { "added": [ " if(!isConnectionNull())", " \tcompleteConnect();" ], "header": "@@ -186,7 +193,8 @@ public class NetConnection extends org.apache.derby.client.am.Connection {", "removed": [ " completeConnect();" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t\t//If network server gets a null connection form InternalDriver, reply with", "\t\t//RDBAFLRM and SQLCARD with null SQLException ", "\t\tif(database.getConnection() == null && databaseAccessException == null){", "\t\t\twriteRDBfailure(CodePoint.RDBAFLRM);", "\t\t\treturn false;", "\t\t}\t\t", "\t\t" ], "header": "@@ -973,6 +973,13 @@ public class DRDAConnThread extends Thread {", "removed": [] }, { "added": [], "header": "@@ -983,43 +990,16 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\twriteSQLCARD(databaseAccessException,", "\t\t\t\t\tCodePoint.SVRCOD_ERROR,0,0);", "", "\t\t\t\t// RDBAFLRM requires TYPDEFNAM and TYPDEFOVR", "\t\t\t\twriter.createDssObject();", "\t\t\t\twriter.writeScalarString(CodePoint.TYPDEFNAM,", "\t\t\t\t\t\t\t\t\t\t CodePoint.TYPDEFNAM_QTDSQLASC);", "\t\t\t\twriteTYPDEFOVR();", "\t\t\t\twriter.endDss();", "", "\t\t\t\t// Finally, per DDM spec, \"an SQLCARD always follows", "\t\t\t\t// the RDBAFLRM\".", "\t\t\t\twriteSQLCARD(databaseAccessException,", "\t\t\t\t\t\t\t CodePoint.SVRCOD_ERROR,0,0);", "", "\t\t\t// Ignore anything that was chained to the ACCRDB.", "\t\t\tskipRemainder(false);", "", "\t\t\t// Finalize chain state for whatever we wrote in", "\t\t\t// response to ACCRDB.", "\t\t\tfinalizeChain();", "", "\t\t\t// Ignore anything that was chained to the ACCRDB.", "\t\t\tskipRemainder(false);", "", "\t\t\t// Finalize chain state for RDBACCRM", "\t\t\tfinalizeChain();" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/Database.java", "hunks": [ { "added": [ "\t\tif(conn != null)", "\t\t\tdefaultStatement.setStatement(conn);" ], "header": "@@ -116,7 +116,8 @@ class Database", "removed": [ "\t\tdefaultStatement.setStatement(conn);" ] } ] } ]
derby-DERBY-3740-3149593e
DERBY-3740 BlobClob4BlobTest.testLockingWithLongRowBlob fails with .AssertionFailedError: FAIL - statement should timeout The 2 tests that were failing intermittently (testLockingWithLongRowBlob and testLockingBlob) would both select a target blob known to be returned as a stream, and assign it to a variable. The expectation was that until the end of the routine Derby would maintain a read lock on the blob. The problem was that it looks like some JVMs/JITs would recognize that the variable was never used and call finalize before the test executed the code to get an expected lock timeout on updating the blob in another connection. Fixed by adding references to the variable in code executed after the expected timeout. Before the fix test was failing about 1/2 time in my environment, after the fix the test ran 100 times without a failure. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1240521 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3742-373cb84f
DERBY-3742: Move test code from CompressedNumber to a unit test Added a JUnit test with the test code and removed it from CompressedNumber. Contributed by Junjie Peng <pjj.ccce@gmail.com>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@673057 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3742-d241e83d
DERBY-3742: Move test code from CompressedNumber to a unit test * Added CompressedNumberTest to the JUnit suite * Made checkInt() and checkLong() verify the compressed length Contributed by Junjie Peng <pjj.ccce@gmail.com>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@673328 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java", "hunks": [ { "added": [ " suite.addTestSuite(CompressedNumberTest.class);" ], "header": "@@ -50,6 +50,7 @@ public class _Suite extends BaseTestCase {", "removed": [] } ] } ]
derby-DERBY-3743-1a63d73f
DERBY-3743 Revoking EXECUTE privilege on a function if used in a CHECK constraint: implementation problem Patch derby-3743, which changes the implementation and adds a test case to verify that the change doesn't break the current behavior. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@675129 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java", "hunks": [ { "added": [ "\t\t case DependencyManager.INTERNAL_RECOMPILE_REQUEST:" ], "header": "@@ -557,6 +557,7 @@ public abstract class ConstraintDescriptor", "removed": [] } ] } ]
derby-DERBY-3743-8875d690
DERBY-3743 Revoking EXECUTE privilege on a function if used in a CHECK constraint: implementation problem Patch derby-3743b-2, which is a follow-up to the first patch of this issue. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@685526 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java", "hunks": [ { "added": [ "\t\t\t\t\t(activation, conDesc, null, providerInfo);" ], "header": "@@ -329,7 +329,7 @@ public class CreateConstraintConstantAction extends ConstraintConstantAction", "removed": [ "\t\t\t\t\t(activation, conDesc, null);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.depend.ProviderInfo;" ], "header": "@@ -35,6 +35,7 @@ import org.apache.derby.iapi.sql.conn.Authorizer;", "removed": [] }, { "added": [ "\t *", "\t * where as constraints only depend on REFERENCES privilege on a table", "\t * (FOREIGN KEY constraints) or EXECUTE privileges on one or more", "\t * functions (CHECK constraints).", "\t *" ], "header": "@@ -265,8 +266,12 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ "\t * where as constraints only depend on REFERENCES privilege on a table." ] }, { "added": [ "\t * @param providers set of providers for this constraint", "\t\tActivation activation,", "\t\tDependent dependent,", "\t\tUUID refTableUUID,", "\t\tProviderInfo[] providers)", "\t\t\tthrows StandardException" ], "header": "@@ -282,12 +287,15 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ "\t *", "\t\t\tActivation activation, Dependent dependent, UUID refTableUUID)", "\tthrows StandardException" ] }, { "added": [ "\t\t\t// Now, it is time to add into dependency system, constraint's", "\t\t\t// dependency on REFERENCES or, if it is a CHECK constraint, any", "\t\t\t// EXECUTE privileges. If the REFERENCES is revoked from the", "\t\t\t// constraint owner, the constraint will get dropped automatically.", "" ], "header": "@@ -299,11 +307,12 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ "\t\t\t//Now, it is time to add into dependency system, constraint's ", "\t\t\t//dependency on REFERENCES privilege. If the REFERENCES privilege is ", "\t\t\t//revoked from the constraint owner, the constraint will get ", "\t\t\t//dropped automatically." ] }, { "added": [ "\t\t\t\t\t} else {", "\t\t\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\t\t\tSanityManager.ASSERT(", "\t\t\t\t\t\t\t\tstatPerm instanceof StatementRoutinePermission,", "\t\t\t\t\t\t\t\t\"only StatementRoutinePermission expected\");", "\t\t\t\t\t\t}", "", "\t\t\t\t\t\t// skip if this permission concerns a function not", "\t\t\t\t\t\t// referenced by this constraint", "\t\t\t\t\t\tStatementRoutinePermission rp =", "\t\t\t\t\t\t\t(StatementRoutinePermission)statPerm;", "\t\t\t\t\t\tif (!inProviderSet(providers, rp.getRoutineUUID())) {", "\t\t\t\t\t\t\tcontinue;", "\t\t\t\t\t\t}", "", "", "\t\t\t\t\t// We know that we are working with a REFERENCES or EXECUTE", "\t\t\t\t\t// privilege. Find all the PermissionDescriptors for this", "\t\t\t\t\t// privilege and make constraint depend on it through", "\t\t\t\t\t// dependency manager. The REFERENCES privilege could be", "\t\t\t\t\t// defined at the table level or it could be defined at", "\t\t\t\t\t// individual column levels. In addition, individual column", "\t\t\t\t\t// REFERENCES privilege could be available at the user", "\t\t\t\t\t// level, PUBLIC or role level. EXECUTE privilege could be", "\t\t\t\t\t// available at the user or PUBLIC level." ], "header": "@@ -329,16 +338,32 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ "\t\t\t\t\t//We know that we are working with a REFERENCES ", "\t\t\t\t\t//privilege. Find all the PermissionDescriptors for", "\t\t\t\t\t//this privilege and make constraint depend on it", "\t\t\t\t\t//through dependency manager.", "\t\t\t\t\t//The REFERENCES privilege could be defined at the", "\t\t\t\t\t//table level or it could be defined at individual", "\t\t\t\t\t//column levels. In addition, individual column", "\t\t\t\t\t//REFERENCES privilege could be available at the", "\t\t\t\t\t//user level or PUBLIC level." ] }, { "added": [ "", "\t\t\t\t\tif (statPerm instanceof StatementTablePermission) {", "\t\t\t\t\t\t//We have found the REFERENCES privilege for all the", "\t\t\t\t\t\t//columns in foreign key constraint and we don't", "\t\t\t\t\t\t//need to go through the rest of the privileges", "\t\t\t\t\t\t//for this sql statement.", "\t\t\t\t\t\tbreak;", "\t\t\t\t\t}" ], "header": "@@ -375,11 +400,14 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ "\t\t\t\t\t//We have found the REFERENCES privilege for all the", "\t\t\t\t\t//columns in foreign key constraint and we don't ", "\t\t\t\t\t//need to go through the rest of the privileges", "\t\t\t\t\t//for this sql statement.", "\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" ] } ] } ]
derby-DERBY-3745-3ea4878b
DERBY-3745 Derby can leak classloaders in an app server environment git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@675956 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ], "header": "@@ -41,6 +41,7 @@ import org.apache.derby.iapi.services.jmx.ManagementService;", "removed": [] }, { "added": [ " //DERBY-3745 We want to avoid the timer leaking class loaders, so we make", " // sure the context class loader is null before we start the MBean", " // server which will create threads that we want to have a null context", " // class loader", " ClassLoader savecl = null;", " boolean hasGetClassLoaderPerms=false;", " try {", " savecl = PrivilegedThreadOps.getContextClassLoader(Thread.currentThread());", " hasGetClassLoaderPerms = true;", " } catch (SecurityException se) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require getClassloader permissions.", " // We may leak class loaders if we are not able to get this, but ", " // cannot just fail. ", " }", " if (hasGetClassLoaderPerms)", " PrivilegedThreadOps.setContextClassLoaderIfPrivileged(Thread.", " currentThread(), null);" ], "header": "@@ -163,7 +164,24 @@ public final class JMXManagementService implements ManagementService, ModuleCont", "removed": [ " " ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ], "header": "@@ -56,6 +56,7 @@ import org.apache.derby.iapi.services.loader.ClassInfo;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ], "header": "@@ -23,7 +23,7 @@ package org.apache.derby.impl.services.timer;", "removed": [ "" ] } ] } ]
derby-DERBY-3745-493b80e2
DERBY-6619 After silently swallowing SecurityExceptions, Derby can leak class loaders Patch derby-6619-2. The fix introduced in DERBY-3745 correctly is there in order to protect against the case where the thread that starts Derby, has a context class loader that is different from the system class loader. In such cases, if the timer thread inherits the context class loader, the context class loader will stay in memory until the Derby engine is shut down, even if all other references to the class loader are gone. If the context class loader is the same as the system class loader, on the other hand, such a "leak" would not be a problem, since the system class loader will stay in memory until the JVM is shut down anyway. We take advantage of this and only attempt to change the context class loader if it is different from the system class loader. With this patch, no warning is printed to derby.log when starting the server from the command line, and there's no warning when starting the server using the API with a security manager installed when the context class loader hasn't been changed from the default. However, if the server is started using the API with a non-default context class loader, we do see warnings in derby.log if a security manager is installed and the permission to set the class loader is missing. Added tests for this behavior. Moved utility methods from UpgradeClassLoader to ClassLoaderTestSetup, a new decorator. It seemed more logical to put them there to allow reuse. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1620379 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/ClassLoaderTestSetup.java", "hunks": [ { "added": [ "/*", " * Derby - Class org.apache.derbyTesting.junit.ClassLoaderTestSetup", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing,", " * software distributed under the License is distributed on an", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,", " * either express or implied. See the License for the specific", " * language governing permissions and limitations under the License.", " */", "", "package org.apache.derbyTesting.junit;", "", "import java.net.URL;", "import java.net.URLClassLoader;", "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import junit.framework.Test;", "import org.apache.derbyTesting.functionTests.tests.upgradeTests.UpgradeClassLoader;", "", "/**", " * A decorator that changes the context class loader for the current", " * configuration and resets it afterwards.", " */", "public class ClassLoaderTestSetup extends BaseJDBCTestSetup {", "", " private ClassLoader oldLoader;", "", " /**", " * Create a decorator that makes {@code test} run with non-default", " * class loader. It also shuts down the engine so Derby classes will", " * be loaded with the new class loader.", " *", " * @param test the test to decorate", " */", " public ClassLoaderTestSetup(Test test) {", " super(test);", " }", "", " private static ClassLoader makeClassLoader(final ClassLoader old) {", " return AccessController.doPrivileged(", " new PrivilegedAction<URLClassLoader>() {", " @Override", " public URLClassLoader run() {", " URL[] jars = ((URLClassLoader)old).getURLs();", " return new URLClassLoader(jars, null);", " }", " });", " }", "", " @Override", " protected void setUp() throws Exception {", " super.setUp();", " TestConfiguration.getCurrent().shutdownEngine();", " oldLoader = getThreadLoader();", " setThreadLoader(makeClassLoader(oldLoader));", " }", "", " @Override", " protected void tearDown() throws Exception {", " setThreadLoader(oldLoader);", " super.tearDown();", " }", "", " /**", " * Force this thread to use a specific class loader.", " * @param which class loader to set", " *", " * @throws SecurityException", " * if the current thread cannot set the context ClassLoader", " */", " public static void setThreadLoader(final ClassLoader which) {", " AccessController.doPrivileged(new PrivilegedAction<Void>() {", " @Override", " public Void run() {", " java.lang.Thread.currentThread().setContextClassLoader(which);", " return null;", " }", " });", " }", "", " /**", " * <p>", " * Retrieve the class loader currently being used by this thread.", " * </p>", " * @return the current context class loader", " */", " public static ClassLoader getThreadLoader() {", " return AccessController.doPrivileged(", " new PrivilegedAction<ClassLoader>() {", " public ClassLoader run() {", " return Thread.currentThread().getContextClassLoader();", " }", " });", " }", "", "}" ], "header": "@@ -0,0 +1,105 @@", "removed": [] } ] } ]
derby-DERBY-3745-7f4445db
DERBY-3887 Embedded Derby fails under JBoss because of JMX-related conflicts Backed out JMX related changes for DERBY-3745. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@784831 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java", "hunks": [ { "added": [], "header": "@@ -163,43 +163,7 @@ public final class JMXManagementService implements ManagementService, ModuleCont", "removed": [ " //DERBY-3745 We want to avoid the timer leaking class loaders, so we make", " // sure the context class loader is null before we start the MBean", " // server which will create threads that we want to have a null context", " // class loader", " boolean hasGetClassLoaderPerms=false;", " ClassLoader savecl = null;", " try {", " savecl = (ClassLoader)AccessController.doPrivileged(", " new PrivilegedAction<ClassLoader>() {", " public ClassLoader run() {", " return Thread.currentThread().getContextClassLoader();", " }", " });", " hasGetClassLoaderPerms = true;", " } catch (SecurityException se) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require getClassloader permissions.", " // We may leak class loaders if we are not able to get this, but ", " // cannot just fail. ", " }", " if (hasGetClassLoaderPerms)", " try {", " AccessController.doPrivileged(", " new PrivilegedAction<Object>() {", " public Object run() {", " Thread.", " currentThread().setContextClassLoader(null);", " return null;", " }", " });", " } catch (SecurityException se1) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require setContextClassloader permissions.", " // We may leak class loaders if we are not able to set this, but ", " // cannot just fail.", " }" ] }, { "added": [], "header": "@@ -216,22 +180,6 @@ public final class JMXManagementService implements ManagementService, ModuleCont", "removed": [ " if (hasGetClassLoaderPerms)", " try {", " final ClassLoader tmpsavecl = savecl;", " AccessController.doPrivileged(", " new PrivilegedAction<Object>() {", " public Object run() {", " Thread.currentThread().setContextClassLoader(tmpsavecl);", " return null;", " }", " });", " } catch (SecurityException se) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require setContextClassloader permissions.", " // We may leak class loaders if we are not able to set this, but ", " // cannot just fail.", " }" ] } ] } ]
derby-DERBY-3745-921e39ea
DERBY-6619 After silently swallowing SecurityExceptions, Derby can leak class loaders Patch derby-6619-2-refinement which implements the following refinements to the test to avoid changing the context class loader in SingletonTimerFactory (suggested by Knut): The orginal test tested against the system class loader. This new patch will: 1) Check if the context class loader is the same as the loader of the SingletonTimerFactory class (that is, the class loader from which Derby classes are loaded). Even if this isn't the same as the system class loader, it would be safe to skip the workaround for DERBY-3745, since the class loader for the Derby classes would not be eligible for garbage collection until the engine is shut down anyway. This would prevent some more false positives from being reported in derby.log. I'd assume this is a kind of false positive that could easily occur in an application server environment where the Derby classes are not found on the system class loader. 2) Check against Thread.class.getClassLoader() instead of ClassLoader.getSystemClassLoader(). Normally, those two checks would be identical. If however the setup is such that they aren't identical, we'd still know that the class loader actually used for system classes such as the Thread class would have to stay in memory for as long as the timer thread is alive, regardless of the context class loader of the thread, so the workaround for DERBY-3745 can be skipped if it's the same as the context class loader. The check will be a bit more specific this way. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1620385 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java", "hunks": [ { "added": [ " if (cl == getClass().getClassLoader() ||", " cl == Thread.class.getClassLoader()) {", " // If the context class loader is the same as any of", " // these class loaders, we are not worried that the", " // timer thread will lead a class loader. These", " // class loaders will stay in memory for the", " // that the timer thread keeps a reference to it." ], "header": "@@ -175,13 +175,14 @@ public class SingletonTimerFactory", "removed": [ " if (cl == ClassLoader.getSystemClassLoader()) {", " // If the context class loader is the same as the", " // system class loader, we are not worried that the", " // timer thread will lead a class loader. (The", " // system class loader will stay in memory for the", " // that the timer thread keeps a reference to it.)" ] } ] } ]
derby-DERBY-3745-9e91a063
DERBY-3803 fix 'org.apache.derbyTesting.functionTests.tests.lang.XMLTypeAndOpsTest' failures after checkin for DERBY-3745 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681104 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/daemon/SingleThreadDaemonFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.services.daemon.DaemonFactory;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "\t\t// DERBY-3745. setContextClassLoader for thread to null to avoid", "\t\t// leaking class loaders.", "\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\tdontGCthread, null);", "" ], "header": "@@ -276,6 +276,11 @@ abstract class BaseMonitor", "removed": [] }, { "added": [], "header": "@@ -2080,11 +2085,6 @@ nextModule:", "removed": [ "\t\t// DERBY-3745. setContextClassLoader for thread to null to avoid", "\t\t// leaking class loaders.", "\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\t\t t, null);", "" ] } ] } ]
derby-DERBY-3745-c34c8e09
DERBY-3745 inline doPrivileged blocks instead of using utility methods which can be a security risk. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@685674 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/daemon/SingleThreadDaemonFactory.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "", "" ], "header": "@@ -21,12 +21,15 @@", "removed": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java", "hunks": [ { "added": [], "header": "@@ -41,7 +41,6 @@ import org.apache.derby.iapi.services.jmx.ManagementService;", "removed": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ] }, { "added": [ " ", " ClassLoader savecl = null;", " savecl = (ClassLoader)AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " return Thread.currentThread().getContextClassLoader();", " }", " });" ], "header": "@@ -168,10 +167,16 @@ public final class JMXManagementService implements ManagementService, ModuleCont", "removed": [ " ClassLoader savecl = null;", " savecl = PrivilegedThreadOps.getContextClassLoader(Thread.currentThread());" ] }, { "added": [ " try {", " AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " Thread.", " currentThread().setContextClassLoader(null);", " return null;", " }", " });", " } catch (SecurityException se1) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require setContextClassloader permissions.", " // We may leak class loaders if we are not able to set this, but ", " // cannot just fail.", " }" ], "header": "@@ -180,8 +185,21 @@ public final class JMXManagementService implements ManagementService, ModuleCont", "removed": [ " PrivilegedThreadOps.setContextClassLoaderIfPrivileged(Thread.", " currentThread(), null);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "" ], "header": "@@ -56,7 +56,7 @@ import org.apache.derby.iapi.services.loader.ClassInfo;", "removed": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ] }, { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -96,6 +96,7 @@ import java.lang.reflect.Modifier;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -23,9 +23,10 @@ package org.apache.derby.impl.services.timer;", "removed": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ] }, { "added": [ " savecl = (ClassLoader)AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " return Thread.currentThread().getContextClassLoader();", " }", " });" ], "header": "@@ -67,8 +68,12 @@ public class SingletonTimerFactory", "removed": [ " savecl = PrivilegedThreadOps.getContextClassLoader(", " Thread.currentThread());" ] }, { "added": [ " try {", " AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " Thread.currentThread().setContextClassLoader(null);", " return null;", " }", " });", " } catch (SecurityException se) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require setContextClassloader permissions.", " // We may leak class loaders if we are not able to set this, but ", " // cannot just fail.", " }", " try {", " final ClassLoader tmpsavecl = savecl;", " AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " Thread.currentThread().setContextClassLoader(tmpsavecl);", " return null;", " }", " });", " } catch (SecurityException se) {", " // ignore security exception. Earlier versions of Derby, before the ", " // DERBY-3745 fix did not require setContextClassloader permissions.", " // We may leak class loaders if we are not able to set this, but ", " // cannot just fail.", " }" ], "header": "@@ -77,12 +82,37 @@ public class SingletonTimerFactory", "removed": [ " PrivilegedThreadOps.setContextClassLoaderIfPrivileged(", " Thread.currentThread(), null);", " PrivilegedThreadOps.setContextClassLoaderIfPrivileged(", " Thread.currentThread(), savecl);" ] } ] } ]
derby-DERBY-3745-eab02c20
DERBY-3745 Derby can leak classloaders in an app server environment Cleanup change to set context class loader for newly created threads directly rather than setting the context classloader of the current thread before creation. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@679620 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "\t\t// DERBY-3745. setContextClassLoader for thread to null to avoid", "\t\t// leaking class loaders.", "\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\t\t t, null);" ], "header": "@@ -2079,27 +2079,11 @@ nextModule:", "removed": [ "\t\t// DERBY-3745 We want to avoid the thread leaking class loaders,", "\t\t// so we make the context class loader null before we create the", "\t\t// thread.", "\t\tClassLoader savecl = null;", "\t\tboolean hasGetClassLoaderPerms = false;", "\t\ttry {", "\t\t\tsavecl = PrivilegedThreadOps.getContextClassLoader(Thread.currentThread());", "\t\t\thasGetClassLoaderPerms = true;", "\t\t} catch (SecurityException se) {", "\t\t\t// ignore security exception. Earlier versions of Derby, before", "\t\t\t// the DERBY-3745 fix did not require getClassLoader permissions.", "\t\t\t// We may leak class loaders if we are not able to get the ", "\t\t\t// class loader, but we cannot just fail.", "\t\t}", "\t\tif (hasGetClassLoaderPerms)", "\t\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\t\t\t Thread.currentThread(), null);", "\t\tif (hasGetClassLoaderPerms)", "\t\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\t\t Thread.currentThread(), savecl);" ] } ] } ]
derby-DERBY-375-09150393
DERBY-375 Specification of incomplete server properties on command line causes NPE with NetworkServerControl when starting the server. The patch does the following: 1. Moves the call to 'init', which initializes 'langUtil', before the call to 'getPropertyInfo' method in the constructors of NetworkServerControlImpl. 2. If the system properties are specified without values, use defaults for them. 3. For 'derby.drda.traceDirectory' property following is mentioned in the doc - "If the derby.system.home property has been set, it is the default. Otherwise, the default is the current directory.". 'getPropertyInfo' was getting the value of 'derby.system.home' but not using it as default for 'derby.drda.traceDirectory'. So the current directory was always getting used as default. Changed this. 4. When I added the default for 'derby.drda.traceDirectory', the tests derbynet/getCurrentProperties.java and derbynet/sysinfo.java had additional lines for derby.drda.traceDirectory in their outputs. Since the directory listed is dependent on the test directory, I have sed out 'traceDirectory' lines for these tests. 5. Adds tests to derbynet/testProperties.java. 6. Fixes javadoc for 'traceDirectory' in NetworkServerControl. Contributed by Deepa Remesh git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@321274 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\tgetPropertyInfo();" ], "header": "@@ -285,8 +285,8 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tgetPropertyInfo();" ] }, { "added": [ "\t\tinit();" ], "header": "@@ -299,12 +299,12 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tinit();" ] }, { "added": [ "\t\t//If the derby.system.home property has been set, it is the default. ", "\t\t//Otherwise, the default is the current directory. ", "\t\t//If derby.system.home is not set, directory will be null and trace files will get", "\t\t//created in current directory.", "\t\tpropval = PropertyUtil.getSystemProperty(Property.DRDA_PROP_TRACEDIRECTORY,directory);", "\t\tif(propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\tpropval = directory;", "\t\t\tsetTraceDirectory(propval);", "\t\t}", "\t\t//DERBY-375 If a system property is specified without any value, getProperty returns ", "\t\t//an empty string. Use default values in such cases.", "\t\tif (propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\tpropval = \"0\";", "\t\t}", "\t\tif (propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\tpropval = \"0\";", "\t\t}", "\t\tif (propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\tpropval = \"0\";", "\t\t}", "\t\tif (propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\tpropval = String.valueOf(NetworkServerControl.DEFAULT_PORTNUMBER);", "\t\t}" ], "header": "@@ -2448,29 +2448,51 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tsetTraceDirectory(PropertyUtil.getSystemProperty( ", "\t\t\tProperty.DRDA_PROP_TRACEDIRECTORY));", "\t\tif (propval != null)", "\t\tif (propval != null)", "\t\tif (propval != null)", "\t\tif (propval != null)" ] }, { "added": [ "\t\tif (propval != null){", "\t\t\tif(propval.equals(\"\"))", "\t\t\t\thostArg = DEFAULT_HOST; ", "\t\t\telse", "\t\t\t\thostArg = propval;", "\t\t}\t" ], "header": "@@ -2480,9 +2502,12 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\tif (propval != null)", "\t\t\thostArg = propval;", "" ] } ] } ]
derby-DERBY-3754-01d6da33
DERBY-3754 Convert "org.apache.derbyTesting.functionTests.tests.lang.connect.sql" to junit Contributed by Junjie Peng git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@676970 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3757-f8b521a5
DERBY-4365 For JOIN, we were doing a no-op in the method bindUntypedNullsToResultColumns(ResultColumnList) rather than checking for untyped nulls for the left and right resultsets. The changes through this commit now checks for untyped nulls for joins. Added couple more tests (including where a CAST of NULL values should work fine). The derbyall and junit suites ran fine with the exception of known intermittent (DERBY-3757) 'ASSERT FAILED transaction table has null entry when running new StressMultiTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@833430 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3763-cd1bd2a0
DERBY-3763: Rename BaseJDBCTestCase.usingDerbyNet. Renamed to usingDB2Client. Patch file: derby-3763-1b-usingDB2Client.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677848 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBCClient.java", "hunks": [ { "added": [ " * AKA: JCC or DB2 client (was called DerbyNet earlier, the \"old net\"", " * client for Derby).", " \"DB2Client\"," ], "header": "@@ -104,11 +104,11 @@ public final class JDBCClient {", "removed": [ " * AKA: JCC or DerbyNet.", " * (the \"old net\" client for Derby).", " \"DerbyNet\"," ] } ] } ]
derby-DERBY-3764-0255faae
DERBY-3764: Union Query fail on Derby 10.4.1.3 A SetOperatorNode inherits the result column list from its left operand. This patch makes sure that all generated grouping columns are removed from the SetOperatorNode's column list to prevent it from seeing extra columns that cause confusion when the set operation is performed. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@678668 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\"visibleSize() = (\" +", "\t\t\t\t\t\t\tvisibleSize() +", "\t\t\t\t\t\t\t\") is expected to equal otherRCL.visibleSize (\" +", "\t\t\t\t\t\t\totherRCL.visibleSize() +", "", " // Generated grouping columns should have been removed for the RCL", " // of a SetOperatorNode, so that size and visible size are equal", " // (DERBY-3764).", " SanityManager.ASSERT(size() == visibleSize(),", " \"size() and visibleSize() should be equal\");" ], "header": "@@ -2216,12 +2216,18 @@ public class ResultColumnList extends QueryTreeNodeVector", "removed": [ "\t\t\t\t\t\t\t\"size() = (\" +", "\t\t\t\t\t\t\tsize() +", "\t\t\t\t\t\t\t\") is expected to equal otherRCL.size (\" +", "\t\t\t\t\t\t\totherRCL.size() +" ] } ] } ]
derby-DERBY-3764-17f3832c
DERBY-3764: Union Query fail on Derby 10.4.1.3 Only look at the visible columns when checking that the expressions in a UNION query are compatible. This prevents ArrayIndexOutOfBoundsException from being thrown when preparing some queries that contain GROUP BY clauses. It is only a partial fix, since some of the queries run into other problems later in the execution. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@676819 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java", "hunks": [ { "added": [ "\t\tint size = visibleSize();" ], "header": "@@ -2233,7 +2233,7 @@ public class ResultColumnList extends QueryTreeNodeVector", "removed": [ "\t\tint size = size();" ] } ] } ]
derby-DERBY-3766-846a5335
DERBY-3766 (partial): EmbedBlob.setPosition is highly ineffective for streams. A preparation patch for the main fix, addressing several minor issues: a) Change type of 'myStream' from InputStream to PositionedStoreStream. This includes removing superfluous casts. b) Fixed typo in JavaDoc for 'streamLength' c) Improved JavaDoc for 'read()' d) Made exception in 'truncate' use the correct position argument. e) Added/updated a few comments. Patch file: derby-3766-1a-preparations.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677619 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ " /**", " * The underlying positionable store stream, if any.", " * <p>", " * If {@link #materialized} is {@code true}, the stream is {@code null}.", " */", " private PositionedStoreStream myStream;" ], "header": "@@ -78,7 +78,12 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " private InputStream myStream;" ] }, { "added": [ " * Set to -1 when the stream has been {@link #materialized} or" ], "header": "@@ -91,7 +96,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " * Set to -1 when the stream has been materialized {@link #materialized} or" ] }, { "added": [ " InputStream dvdStream = dvd.getStream();", " if (dvdStream == null)" ], "header": "@@ -152,8 +157,8 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " myStream = dvd.getStream();", " if (myStream == null)" ] }, { "added": [ " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(dvdStream instanceof Resetable);", " }", " // Create a position aware stream on top of dvdStream so we can", " // more easily move back and forth in the Blob.", " myStream = new PositionedStoreStream(dvdStream);", " myStream.initStream();" ], "header": "@@ -186,12 +191,14 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " if (SanityManager.DEBUG)", " SanityManager.ASSERT(myStream instanceof Resetable);", " //make myStream a position aware stream", " myStream = new PositionedStoreStream (myStream);", " ((Resetable) myStream).initStream();" ] }, { "added": [ " /**", " * Reads one byte from the Blob at the specified position.", " * <p>", " * Depending on the representation, this might result in a read from a byte", " * array, a temporary file on disk or from a Derby store stream.", " *", " * @param pos the 0-based position in the Blob to read", " * @return The byte at the specified position.", " * @throws IOException if reading from the underlying data representation", " * fails", " */" ], "header": "@@ -246,9 +253,17 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " /*", " Reads one byte, either from the byte array or else from the stream.", " */" ] }, { "added": [ " // Reset stream, because AutoPositionigStream wants to read", " // the encoded length bytes.", " myStream.resetStream();" ], "header": "@@ -482,7 +497,9 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " ((Resetable)myStream).resetStream();" ] }, { "added": [ " myStream.closeStream();" ], "header": "@@ -748,7 +765,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " ((Resetable)myStream).closeStream();" ] }, { "added": [ " SQLState.BLOB_LENGTH_TOO_LONG, new Long(len));" ], "header": "@@ -889,7 +906,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " SQLState.BLOB_LENGTH_TOO_LONG, new Long(pos));" ] }, { "added": [ " if (!materialized) {", " myStream.closeStream();", " myStream = null;", " } else {" ], "header": "@@ -943,9 +960,10 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " if (!materialized)", " ((Resetable)myStream).closeStream();", " else {" ] } ] } ]
derby-DERBY-3766-cd7ef76f
DERBY-3766: EmbedBlob.setPosition is highly ineffective for streams. a) Removed the 'pos' and 'biStream' variables. A "global" Blob position is no longer maintained by EmbedBlob. b) Introduced 'streamPositionOffset' to account for the encoded length bytes. Only used when the Blob is represented by a store stream. Set to Integer.MIN_VALUE when unused. Otherwise, the offset is obtained in the constructor, where the Blob length is saved for later use as well if it is known (the stream is not skipped to find length). c) Removed 'BLOB_BUF_SIZE' and 'buf', they're no longer needed. d) Renamed 'setPosition' to 'setBlobPosition' and rewrote the method. The method now relies on PositionedStoreStream to do the repositioning. In some cases this will lead to using the same algorithm as earlier, otherwise it will be more effective because the stream isn't reset. Note the addition of 'streamPositionOffset' to the logical zero-based Blob position. Also note that another SQLState is used. The method also returns the new position (this is only for convenience). e) Changes in read(); added pos argument, don't throw SQLException, use the correct stream. f) Updated length() to reflect changes. g) Rewrote the two 'position' methods to maintain a local position variable. Also removed special handling for the BLOB_LENGTH_TOO_LONG exception. h) Updated JavaDoc and added position argument for the two 'checkMatch' methods. i) Added one new test in BlobClob4BlobTest. Patch file: derby-3766-2a-position_fix.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681359 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ "import java.io.EOFException;" ], "header": "@@ -33,6 +33,7 @@ import org.apache.derby.iapi.services.io.InputStreamUtil;", "removed": [] }, { "added": [ " /**", " * Position offset for the stream representing the Blob, if any.", " * <p>", " * This offset accounts for the bytes encoding the stream length at the", " * head of the stream. Data byte {@code pos} is at", " * {@code pos + streamPositionOffset} in the underlying stream.", " * Set to {@code Integer.MIN_VALUE} if the Blob isn't represented by a", " * store stream.", " */", " private final int streamPositionOffset;" ], "header": "@@ -101,16 +102,17 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " // note: cannot control position of the stream since user can do a getBinaryStream", " private long pos;", " // this stream sits on top of myStream", " private BinaryToRawStream biStream;", " // buffer for reading in blobs from a stream (long column)", " // and trashing them (to set the position of the stream etc.)", " private static int BLOB_BUF_SIZE = 4096;", " private byte buf[];", " " ] }, { "added": [ " streamPositionOffset = Integer.MIN_VALUE;" ], "header": "@@ -133,6 +135,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " streamPositionOffset = Integer.MIN_VALUE;" ], "header": "@@ -161,6 +164,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " try {", " // The BinaryToRawStream will read the encoded length bytes.", " BinaryToRawStream tmpStream =", " new BinaryToRawStream(myStream, con);", " streamPositionOffset = (int)myStream.getPosition();", " // Check up front if the stream length is specified.", " streamLength = tmpStream.getLength();", " tmpStream.close();", " } catch (IOException ioe) {", " throw StandardException.newException(", " SQLState.LANG_STREAMING_COLUMN_I_O_EXCEPTION, ioe);", " }", " /**", " * Sets the position of the Blob to {@code logicalPos}, where position 0 is", " * the beginning of the Blob content.", " * <p>", " * The position is only guaranteed to be valid from the time this method is", " * invoked until the synchronization monitor is released, or until the next", " * invokation of this method.", " * <p>", " * The position is logical in the sense that it specifies the requested", " * position in the Blob content. This position might be at a different", " * position in the underlying representation, for instance the Derby store", " * stream prepends the Blob content with a length field.", " *", " * @param logicalPos requested Blob position, 0-based", " * @return The new position, which will be equal to the requested position.", " * @throws IOException if reading/accessing the Blob fails", " * @throws StandardException throws BLOB_POSITION_TOO_LARGE if the requested", " * position is larger than the Blob length, throws other SQL states if", " * resetting the stream fails", " */", " //@GuardedBy(getConnectionSynchronization())", " private long setBlobPosition(long logicalPos)", " SanityManager.ASSERT(logicalPos >= 0);", " if (materialized) {", " // Nothing to do here, except checking if the position is valid.", " if (logicalPos >= control.getLength()) {", " throw StandardException.newException(", " SQLState.BLOB_POSITION_TOO_LARGE, new Long(logicalPos));", " }", " } else {", " // Reposition the store stream, account for the length field offset.", " try {", " this.myStream.reposition(", " logicalPos + this.streamPositionOffset);", " } catch (EOFException eofe) {", " throw StandardException.newException(", " SQLState.BLOB_POSITION_TOO_LARGE, eofe,", " new Long(logicalPos));", " return logicalPos;" ], "header": "@@ -203,49 +207,69 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " // set up the buffer for trashing the bytes to set the position of", " // the", " // stream, only need a buffer when we have a long column", " buf = new byte[BLOB_BUF_SIZE];", " pos = 0;", " /*", " Sets the position of the stream to position newPos, where position 0 is", " the beginning of the stream.", "", " @param newPos the position to set to", " @exception StandardException (BLOB_SETPOSITION_FAILED) throws this if", " the stream runs out before we get to newPos", " */", " private void setPosition(long newPos)", " SanityManager.ASSERT(newPos >= 0);", " if (materialized)", " pos = newPos;", " else {", " // Always resets the stream to the beginning first, because user can", " // influence the state of the stream without letting us know.", " ((Resetable)myStream).resetStream();", " // PT could try to save creating a new object each time", " biStream = new BinaryToRawStream(myStream, this);", " pos = 0;", " while (pos < newPos)", " {", " int size = biStream.read(", " buf,0,(int) Math.min((newPos-pos), (long) BLOB_BUF_SIZE));", " if (size <= 0) // ran out of stream", " throw StandardException.newException(SQLState.BLOB_LENGTH_TOO_LONG);", " pos += size;" ] }, { "added": [ " private int read(long pos)", " throws IOException, StandardException {", " if (materialized) {", " if (pos >= control.getLength())", " return -1;", " else", " c = control.read (pos);", " } else {", " // Make sure we're at the right position.", " this.myStream.reposition(pos + this.streamPositionOffset);", " // Read one byte from the stream.", " c = this.myStream.read();" ], "header": "@@ -260,23 +284,20 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " private int read() throws IOException, SQLException {", " if (materialized)", " {", " try {", " if (pos >= control.getLength())", " return -1;", " else", " c = control.read (pos);", " }", " catch (StandardException se) {", " throw Util.generateCsSQLException (se);", " }", " else", " c = biStream.read();", " pos++;" ] }, { "added": [ " // We have to read the entire stream!", " myStream.resetStream();", " BinaryToRawStream tmpStream =", " new BinaryToRawStream(myStream, this);", " streamLength = 0;", " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(tmpStream.getLength() == -1);", "", " long skipped = tmpStream.skip(Limits.DB2_LOB_MAXWIDTH);", " streamLength += skipped;", " if (tmpStream.read() == -1) {", " streamLength++;", " tmpStream.close();", " return streamLength;" ], "header": "@@ -314,35 +335,34 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " setPosition(0);", " // If possible get the length from the encoded", " // length at the front of the raw stream.", " if ((streamLength = biStream.getLength()) != -1) {", " biStream.close();", " return streamLength;", " ", " // Otherwise have to read the entire stream!", " long skipped = biStream.skip(Limits.DB2_LOB_MAXWIDTH);", " pos += skipped;", " if (biStream.read() == -1) {", " pos++;", " streamLength = pos;", " biStream.close();", " return pos;" ] }, { "added": [ " setBlobPosition(startPos-1);", " int n = InputStreamUtil.readLoop(myStream,result,0,length);" ], "header": "@@ -418,11 +438,10 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " setPosition(startPos-1);", " int n = InputStreamUtil.readLoop(biStream,result,0,length);", " pos += n;" ] }, { "added": [ " long pos = setBlobPosition(start -1);", " c = read(pos++); // Note the position increment.", " if (checkMatch(pattern, pos))", " pos = setBlobPosition(curPos);", " catch (StandardException e) {", " throw handleMyExceptions(e);" ], "header": "@@ -550,33 +569,29 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " setPosition(start-1);", " c = read();", " if (checkMatch(pattern))", " setPosition(curPos);", " catch (StandardException e)", " { // if this is a setPosition exception then not found", " if (e.getMessageId().equals(SQLState.BLOB_LENGTH_TOO_LONG))", " return -1;", " else", " throw handleMyExceptions(e);" ] }, { "added": [ " /**", " * Checks if the pattern (starting from the second byte) appears inside", " * the Blob content.", " * <p>", " * At this point, the first byte of the pattern must already have been", " * matched, and {@code pos} must be pointing at the second byte to compare.", " *", " * @param pattern the byte array to search for, passed in by the user", " * @param pos the position in the Blob content to start searching from", " * @return {@code true} if a match is found, {@code false} if not.", " private boolean checkMatch(byte[] pattern, long pos)", " throws IOException, StandardException {", " int b = read(pos++);" ], "header": "@@ -590,21 +605,24 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ "", " /*", " check whether pattern (starting from the second byte) appears inside", " posStream (at the current position)", " @param posStream the stream to search inside", " @param pattern the byte array passed in by the user to search with", " @return true if match, false otherwise", " private boolean checkMatch(byte[] pattern)", " throws IOException, SQLException {", " int b = read();" ] }, { "added": [ " long pos = setBlobPosition(start-1);" ], "header": "@@ -645,7 +663,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " setPosition(start-1);" ] }, { "added": [ " c = read(pos++); // Note the position increment.", " if (checkMatch(pattern, pos))", " pos = setBlobPosition(curPos);", " catch (StandardException e) {", " throw handleMyExceptions(e);" ], "header": "@@ -663,26 +681,22 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " c = read();", " if (checkMatch(pattern))", " setPosition(curPos);", " catch (StandardException e)", " { // if this is a setPosition exception then not found", " if (e.getMessageId().equals(SQLState.BLOB_LENGTH_TOO_LONG))", " return -1;", " else", " throw handleMyExceptions(e);" ] }, { "added": [ " /**", " * Checks if the pattern (starting from the second byte) appears inside", " * the Blob content.", " *", " * @param pattern the Blob to search for, passed in by the user", " * @param pos the position in the Blob (this) content to start searching", " * @return {@code true} if a match is found, {@code false} if not.", " private boolean checkMatch(Blob pattern, long pos)", " throws IOException, StandardException {" ], "header": "@@ -697,16 +711,16 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " /*", " check whether pattern (starting from the second byte) appears inside", " posStream (at the current position)", " @param posStream the stream to search inside", " @param pattern the blob passed in by the user to search with", " @return true if match, false otherwise", " private boolean checkMatch(Blob pattern)", " throws IOException, SQLException", " {" ] } ] } ]
derby-DERBY-3767-4293daff
DERBY-3767 Convert "org.apache.derbyTesting.functionTests.tests.lang.nulls.sql" to junit. Forgot to svn add test. Contributed by Junjie Peng git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@684848 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3768-37ae69e3
DERBY-3768: Make EmbedBlob.length use skip instead of read. Replaced read loop with a skip loop (potential optimization). Note the verification of EOF when skip returns zero, which seems safer (due to the somewhat relaxed contract of InputStream.skip). Patch file: derby-3768-1b-length_skip.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@675169 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -25,18 +25,15 @@ package org.apache.derby.impl.jdbc;", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.io.NewByteArrayInputStream;", "import org.apache.derby.iapi.services.io.ArrayInputStream;", "import java.io.EOFException;" ] }, { "added": [ " long skipped = biStream.skip(Limits.DB2_LOB_MAXWIDTH);", " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(skipped >= 0);", " }", " pos += skipped;", " // If skip reports zero bytes skipped, verify EOF.", " if (skipped == 0) {", " if (biStream.read() == -1) {", " break; // Exit the loop, no more data.", " } else {", " pos++;", " }", " }" ], "header": "@@ -299,10 +296,19 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " int size = biStream.read(buf);", " if (size == -1)", " break;", " pos += size;" ] } ] } ]
derby-DERBY-3768-b526e7fe
DERBY-3768: Make EmbedBlob.length use skip instead of read. - JavaDoc improvements - set locator value explicitly to indicate default value (must not be a valid locator) - renamed 'myLength' to 'streamLength' - keep variables 'materialized' and 'streamLength' in sync - throw exception in second constructor (mistakenly swallowed) - only clear LOB mapping if a mapping has been created Patch file: derby-3768-2a-misc_fixes.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@676571 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ " /**", " * Tells whether the Blob has been materialized or not.", " * <p>", " * Materialization happens when the Blob is updated by the user. A", " * materialized Blob is represented either in memory or in a temporary file", " * on disk, depending on size.", " * <p>", " * A Blob that has not been materialized is represented by a stream into the", " * Derby store, and is read-only.", " */", " /**", " * Locator value for this Blob, used as a handle by the client driver to", " * map operations to the correct Blob on the server side.", " *", " * @see #getLocator()", " */", " private int locator = 0;", " /**", " * Length of the stream representing the Blob.", " * <p>", " * Set to -1 when the stream has been materialized {@link #materialized} or", " * the length of the stream is not currently known.", " private long streamLength = -1;" ], "header": "@@ -67,18 +67,34 @@ import java.io.IOException;", "removed": [ " // blob is either materialized or still in stream", " // locator key for lob. used by Network Server.", " private int locator;", " /*", " * Length of the BLOB if known. Set to -1 if", " * the current length of the BLOB is not known.", " private long myLength = -1;" ] }, { "added": [ " } else {", " throw se;" ], "header": "@@ -180,6 +196,8 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " if (streamLength != -1)", " return streamLength;" ], "header": "@@ -272,8 +290,8 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " if (myLength != -1)", " return myLength;" ] }, { "added": [ " if ((streamLength = biStream.getLength()) != -1) {", " return streamLength;" ], "header": "@@ -288,9 +306,9 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " if ((myLength = biStream.getLength()) != -1) {", " return myLength;" ] }, { "added": [ " streamLength = pos;" ], "header": "@@ -311,7 +329,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " myLength = pos;" ] }, { "added": [ " streamLength = -1;" ], "header": "@@ -801,6 +819,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " streamLength = -1;" ], "header": "@@ -841,6 +860,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " streamLength = -1;" ], "header": "@@ -878,6 +898,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [] }, { "added": [ " // Remove entry from connection if a locator has been created.", " if (this.locator != 0) {", " localConn.removeLOBMapping(locator);", " }", " streamLength = -1;" ], "header": "@@ -912,10 +933,12 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB", "removed": [ " //remove entry from connection", " localConn.removeLOBMapping(locator);", " myLength = -1;" ] } ] } ]
derby-DERBY-3769-1028de4a
DERBY-3769: Make LOBStoredProcedure on the server side smarter about the read buffer size. Adjusts the maximum return size in characters for the CLOB stored procedure to 10890 (DB2_VARCHAR_MAXWIDTH / 3). This potentially results in anything from 10890 to 10890*3 bytes to be returned to the client in one round-trip, depending on the bytes per char ratio (determined by the modified UTF8 encoding). This fix is sub-optimal for Clobs with ASCII contents, but improves performance for Clobs with contents requiring 2 or 3 bytes per char dramatically. Patch file: derby-3769-2b-clob_buffer_size_adjustment.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@707097 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java", "hunks": [ { "added": [ " * The maximum length of the data returned from the BLOB stored procedures.", " public static final int MAX_BLOB_RETURN_LEN = Limits.DB2_VARCHAR_MAXWIDTH;", "", " /**", " * The maximum length of the data returned from the CLOB stored procedures.", " * <p>", " * This value is currently dictated by the maximum length of", " * VARCHAR/VARBINARY, because these are the return types of the stored", " * procedures, and the modified UTF8 encoding used for CLOB data. This", " * threshold value could be higher (equal to {@code MAX_BLOB_RETURN_LEN}),", " * but then the procedure fetching data from the CLOB must be rewritten to", " * have more logic.", " * <p>", " * For now we use the defensive assumption that all characters are", " * represented by three bytes.", " */", " public static final int MAX_CLOB_RETURN_LEN = MAX_BLOB_RETURN_LEN / 3;" ], "header": "@@ -37,13 +37,28 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ " * The maximum length of the data returned from the LOB stored procedures.", " public static final int MAX_RETURN_LENGTH = Limits.DB2_VARCHAR_MAXWIDTH;" ] }, { "added": [ " * required (see {@link #MAX_CLOB_RETURN_LEN})." ], "header": "@@ -148,7 +163,7 @@ public class LOBStoredProcedure {", "removed": [ " * required (see {@link #MAX_RETURN_LENGTH})." ] }, { "added": [ " len = Math.min(len, MAX_CLOB_RETURN_LEN);" ], "header": "@@ -157,7 +172,7 @@ public class LOBStoredProcedure {", "removed": [ " len = Math.min(len, MAX_RETURN_LENGTH);" ] }, { "added": [ " * (see {@link #MAX_BLOB_RETURN_LEN})." ], "header": "@@ -303,7 +318,7 @@ public class LOBStoredProcedure {", "removed": [ " * (see {@link #MAX_RETURN_LENGTH})." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " LOBStoredProcedure.MAX_CLOB_RETURN_LEN)," ], "header": "@@ -11078,7 +11078,7 @@ public final class\tDataDictionaryImpl", "removed": [ " LOBStoredProcedure.MAX_RETURN_LENGTH)," ] }, { "added": [ " LOBStoredProcedure.MAX_BLOB_RETURN_LEN)," ], "header": "@@ -11266,7 +11266,7 @@ public final class\tDataDictionaryImpl", "removed": [ " LOBStoredProcedure.MAX_RETURN_LENGTH)," ] } ] } ]
derby-DERBY-3769-46244ea2
DERBY-3769: Make LOBStoredProcedure on the server side smarter about the read buffer size. Adjust amount of data to fetch (and thus read) if it is greater then the maximum allowed return length of the LOB stored procedures (width of VARBINARY/VARCHAR). Reading/fetching more data caused the stream position to be advanced too far and resulted in a stream reset followed by skipping of data until at the correct position again. Patch file: derby-3769-1b-buffer_size_adjustment.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@676912 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -27,6 +27,7 @@ import java.sql.DriverManager;", "removed": [] }, { "added": [ " /**", " * The maximum length of the data returned from the LOB stored procedures.", " * <p>", " * This value is currently dictated by the maximum length of", " * VARCHAR/VARBINARY, because these are the return types of the stored", " * procedures.", " */", " public static final int MAX_RETURN_LENGTH = Limits.DB2_VARCHAR_MAXWIDTH;", "" ], "header": "@@ -35,6 +36,15 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [] }, { "added": [ " * Returns the {@code String} starting from {@code pos} and consisting of", " * up to {@code len} consecutive characters from the {@code Clob}", " * corresponding to {@code LOCATOR}.", " *", " * @param len an integer representing the maximum length of the substring.", " * The value will be reduced to the maximum allowed return length if", " * required (see {@link #MAX_RETURN_LENGTH}).", " * @return A substring from the {@code Clob} starting at the given position,", " * not longer than {@code len} characters.", " // Don't read more than what we can represent as a VARCHAR.", " // See DERBY-3769.", " len = Math.min(len, MAX_RETURN_LENGTH);" ], "header": "@@ -128,19 +138,26 @@ public class LOBStoredProcedure {", "removed": [ " * returns the String starting from pos and of len length", " * from the LOB corresponding to LOCATOR.", " * @param len an integer that represents the length of the substring.", " * @return the substring conforming to the indexes we requested for from", " * inside the LOB." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [], "header": "@@ -81,7 +81,6 @@ import org.apache.derby.iapi.types.NumberDataValue;", "removed": [ "import org.apache.derby.iapi.types.TypeId;" ] }, { "added": [], "header": "@@ -136,11 +135,9 @@ import org.apache.derby.iapi.services.io.FormatableBitSet;", "removed": [ "import org.apache.derby.iapi.util.StringUtil;", "import java.util.Date;" ] }, { "added": [ "// LOBStoredProcedure is imported only to get hold of a constant.", "import org.apache.derby.impl.jdbc.LOBStoredProcedure;", "" ], "header": "@@ -157,6 +154,9 @@ import java.io.IOException;", "removed": [] }, { "added": [ " Types.VARCHAR,", " LOBStoredProcedure.MAX_RETURN_LENGTH)," ], "header": "@@ -11050,7 +11050,8 @@ public final class\tDataDictionaryImpl", "removed": [ " Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH)," ] }, { "added": [ " Types.VARBINARY,", " LOBStoredProcedure.MAX_RETURN_LENGTH)," ], "header": "@@ -11229,7 +11230,8 @@ public final class\tDataDictionaryImpl", "removed": [ " Types.VARBINARY, Limits.DB2_VARCHAR_MAXWIDTH)," ] } ] } ]
derby-DERBY-3770-27628a01
DERBY-3770: Create a utility class for skipping data in an InputStream Moved helper methods from iapi/util to iapi/services/io and reduced the number of calls to skipPersistent() from skipUntilEOF(). Patch contributed by Junjie Peng <pjj.ccce@gmail.com>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@691253 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/InputStreamUtil.java", "hunks": [ { "added": [ " private static final int SKIP_FRAGMENT_SIZE = Integer.MAX_VALUE;" ], "header": "@@ -29,6 +29,7 @@ import java.io.*;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/util/UTF8Util.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.io.InputStreamUtil;", "" ], "header": "@@ -27,6 +27,8 @@ import java.io.IOException;", "removed": [] }, { "added": [ " if (InputStreamUtil.skipPersistent(in, 1L) != 1L) {" ], "header": "@@ -118,7 +120,7 @@ public final class UTF8Util {", "removed": [ " if (StreamUtil.skipPersistent(in, 1L) != 1L) {" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java", "hunks": [ { "added": [ " suite.addTest(InputStreamUtilTest.suite());" ], "header": "@@ -52,7 +52,7 @@ public class _Suite extends BaseTestCase {", "removed": [ " suite.addTest(StreamUtilTest.suite());" ] } ] } ]
derby-DERBY-3770-a1c1356a
DERBY-3770: Create a utility class for skipping data in an InputStream Replaced skip loops with calls to the new utility methods in - EmbedBlob.length() - PositionedStoreStream.reposition() - UpdatableBlobStream.updateIfRequired() - SQLBinary.getLength() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@709856 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SQLBinary.java", "hunks": [ { "added": [], "header": "@@ -25,32 +25,22 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.io.NewByteArrayInputStream;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.types.VariableSizeDataValue;", "import org.apache.derby.iapi.services.io.FormatIdUtil;", "import org.apache.derby.iapi.services.io.StreamStorable;", "import org.apache.derby.iapi.types.StringDataValue;", "import org.apache.derby.iapi.util.StringUtil;" ] }, { "added": [ "import org.apache.derby.iapi.services.io.InputStreamUtil;" ], "header": "@@ -59,9 +49,9 @@ import java.io.ObjectInput;", "removed": [ "import java.sql.ResultSet;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [], "header": "@@ -25,7 +25,6 @@ package org.apache.derby.impl.jdbc;", "removed": [ "import org.apache.derby.iapi.reference.Limits;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/PositionedStoreStream.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.io.InputStreamUtil;" ], "header": "@@ -27,6 +27,7 @@ import java.io.IOException;", "removed": [] }, { "added": [ " InputStreamUtil.skipFully(stream, requestedPos - pos);" ], "header": "@@ -199,7 +200,7 @@ public class PositionedStoreStream", "removed": [ " skipFully(requestedPos - this.pos);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/UpdatableBlobStream.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.io.InputStreamUtil;" ], "header": "@@ -26,8 +26,7 @@ package org.apache.derby.impl.jdbc;", "removed": [ "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.i18n.MessageService;" ] }, { "added": [ " InputStreamUtil.skipFully(stream, pos);" ], "header": "@@ -112,22 +111,7 @@ class UpdatableBlobStream extends InputStream {", "removed": [ " long leftToSkip = pos;", " while (leftToSkip > 0) {", " long skipped = stream.skip (leftToSkip);", " if (skipped == 0) {", " //skipping zero byte check stream has reached eof", " if (stream.read() < 0) {", " throw new IOException (", " MessageService.getCompleteMessage (", " SQLState.STREAM_EOF, new Object [0]));", " }", " else {", " skipped = 1;", " }", " }", " leftToSkip -= skipped;", " }" ] } ] } ]
derby-DERBY-3770-cd822ebe
DERBY-3770: Create a utility class for skipping data in an InputStream Removed these unused methods from CompressedNumber: - readIntAndReturnIntPlusOverhead(byte[], int) - skipInt(DataInput) - skipInt(InputStream) - skipLong(DataInput) - skipLong(InputStream) The skip methods were buggy because they didn't check the return value from InputStream.skip() or DataInput.skipBytes() and could possibly skip too few bytes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@709900 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/CompressedNumber.java", "hunks": [ { "added": [], "header": "@@ -257,137 +257,11 @@ public abstract class CompressedNumber {", "removed": [ " /**", " * Return the compressed Int value + stored size of the length + 1", " * <p>", " * Given offset in array to beginning of compressed int, return the ", " * value of the compressed int + the number of bytes used to store the", " * length.", " * <p>", " * So 1 byte lengths will return: length + 1 + 1", " * So 2 byte lengths will return: length + 2 + 1", " * So 4 byte lengths will return: length + 4 + 1", " * <p>", " * Note that this routine will not work for lengths MAX_INT - (MAX_INT - 5).", " * <p>", " * This routine is currently used by the StorePage code to skip fields", " * as efficiently as possible. Since the page size is less than ", " * (MAX_INT - 5) it is all right to use this routine.", " *", "\t * @return compressed int value + length used to store the length.", " *", " * @param data byte array containing the field.", " * @param offset offset to beginning of field, ie. data[offset] contains", " * 1st byte of the compressed int.", " **/", "\tpublic static final int readIntAndReturnIntPlusOverhead(", " byte[] data,", " int offset)", " {", " int value = data[offset];", "", " if ((value & ~0x3f) == 0)", " {", " // length is stored in this byte, we also know that the 0x80 bit", " // was not set, so no need to mask off the sign extension from", " // the byte to int conversion.", "", " // account for 1 byte stored length of field + 1 for all returns", " return(value + 2);", " }", "\t\telse if ((value & 0x80) == 0)", "\t\t{", " // length is stored in 2 bytes. only use low 6 bits from 1st byte.", "", " if (SanityManager.DEBUG)", " {", " SanityManager.ASSERT((value & 0x40) == 0x40);", " }", "", " // top 8 bits of 2 byte length is stored in this byte, we also ", " // know that the 0x80 bit was not set, so no need to mask off the ", " // sign extension from the 1st byte to int conversion. Need to", " // mask the byte in data[offset + 1] to account for possible sign", " // extension.", "", " // add 3 to account for 2 byte length + 1 added to all returns", "", " return((((value & 0x3f) << 8) | (data[offset + 1] & 0xff)) + 3);", "\t\t}", " else", " {", " // length is stored in 4 bytes. only use low 7 bits from 1st byte.", "", " if (SanityManager.DEBUG)", " {", " SanityManager.ASSERT((value & 0x80) == 0x80);", " }", "", " // top 8 bits of 4 byte length is stored in this byte, we also ", " // know that the 0x80 bit was set, so need to mask off the ", " // sign extension from the 1st byte to int conversion. Need to", " // mask the bytes from the next 3 bytes data[offset + 1,2,3] to ", " // account for possible sign extension.", "", "", " // add 5 to account for 4 byte length + 1 added to all returns", " return(", " (((value & 0x7f) << 24) |", " ((data[offset + 1] & 0xff) << 16) |", " ((data[offset + 2] & 0xff) << 8) |", " (data[offset + 3] & 0xff)) + 5);", " }", "\t}", "", "", "\t/**", "\t\tSkip an integer previously written by writeInt().", "", "\t\t@exception IOException an exception was thrown by a method on in.", "\t*/", "\tpublic static final int skipInt(DataInput in) throws IOException {", "", "\t\tint value = in.readUnsignedByte();", "", "\t\tif ((value & 0x80) == 0x80) {", "\t\t\tin.skipBytes(3);", "\t\t\treturn 4;", "\t\t}", "", "\t\tif ((value & 0x40) == 0x40) {", "\t\t\tin.skipBytes(1);", "\t\t\treturn 2;", "\t\t}", "", "\t\treturn 1;", "\t}", "", "\tpublic static final int skipInt(InputStream in) throws IOException {", "", "\t\tint value = InputStreamUtil.readUnsignedByte(in);", "", "\t\tint skipBytes = 0;", "", "\t\tif ((value & 0x80) == 0x80) {", "\t\t\tskipBytes = 3;", "\t\t}", "\t\telse if ((value & 0x40) == 0x40) {", "\t\t\tskipBytes = 1;", "\t\t}", "", "\t\tif (skipBytes != 0) {", "\t\t\tif (in.skip(skipBytes) != skipBytes)", "\t\t\t\tthrow new EOFException();", "\t\t}", "", "", "\t\treturn skipBytes + 1;", "\t}" ] } ] } ]
derby-DERBY-3771-7d66c732
DERBY-3771 testClasspathChecker under SysinfoCPCheckTest failed on Zos git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@675669 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3775-25378cb2
DERBY-3775 BlobStoredProcedureTest failed on Zos The test expected the number of bytes in String.getBytes() to match the number of characters in the string. Used US-ASCII encoding so this would be true. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@676014 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-378-3568cea1
DERBY-378 (partial) This patch adds some code required to support import/exoprt of lob data. 1) Addded code to read clob data using getCharacterStream() instead of getString() while importing clob data from an extern file. (Note: Clobs are read using getString() until DERBY-2465 is fixed). 2) Made some code changes to make each lob column has it it's own file handle to the lob file to read the data, otherwise streams can get corrupted when there are more than one clob/blob type column in the table. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@520197 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java", "hunks": [ { "added": [ " if (isColumnInExtFile(columnIndex)) {", "\t\t\tval = importReadData.getClobColumnFromExtFileAsString(val, ", " columnIndex);" ], "header": "@@ -145,12 +145,13 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [ "\t\tif (isColumnInExtFile(columnIndex)) {", "\t\t\tval = importReadData.getClobColumnFromExtFile(val);" ] }, { "added": [ "", " /**", " * Returns <code> java.sql.Clob </code> type object that ", " * contains the columnn data from the import file. ", " * @param columnIndex number of the column. starts at 1.", " * @exception SQLException if any occurs during create of the clob object.", " */", "\tpublic java.sql.Clob getClob(int columnIndex) throws SQLException {", "", " java.sql.Clob clob = null;", "\t\tif (lobsInExtFile) ", " {", " // lob data is in another file, read from the external file.", " clob = importReadData.getClobColumnFromExtFile(", " nextRow[columnIndex-1], columnIndex);", " } else {", " // data is in the main export file.", " String data = nextRow[columnIndex-1];", " if (data != null) {", " clob = new ImportClob(data); ", " }", " }", " ", " wasNull = (clob == null);", " return clob;", "\t}", "" ], "header": "@@ -160,6 +161,33 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [] }, { "added": [ " nextRow[columnIndex-1], columnIndex);" ], "header": "@@ -174,7 +202,7 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [ " nextRow[columnIndex-1]);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportLobFile.java", "hunks": [ { "added": [ " " ], "header": "@@ -91,13 +91,7 @@ class ImportLobFile", "removed": [ "", " // setup a reader on top of the stream, so that calls ", " // to read the clob data from the file can read the ", " // with approapriate data code set. ", " lobReader = dataCodeset == null ?", " \t\tnew InputStreamReader(lobLimitIn) : ", " new InputStreamReader(lobLimitIn, dataCodeset); " ] }, { "added": [ " ", " // wrap a reader on top of the stream, so that calls ", " // to read the clob data from the file can read the ", " // with approapriate data code set. ", " lobReader = dataCodeset == null ?", " \t\tnew InputStreamReader(lobLimitIn) : ", " new InputStreamReader(lobLimitIn, dataCodeset); " ], "header": "@@ -128,6 +122,13 @@ class ImportLobFile", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportReadData.java", "hunks": [ { "added": [ " private ImportLobFile[] lobFileHandles; // lob file handle object " ], "header": "@@ -105,7 +105,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " private ImportLobFile lobFile; // lob file object " ] }, { "added": [ "", " lobFileHandles = new ImportLobFile[numberOfColumns];", "" ], "header": "@@ -153,6 +153,9 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [] }, { "added": [ " if (lobFileHandles != null) {", " for (int i = 0 ; i < numberOfColumns ; i++) ", " {", " if(lobFileHandles[i] != null) ", " lobFileHandles[i].close();", " }", "" ], "header": "@@ -281,9 +284,14 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " if (lobFile !=null) {", " lobFile.close();" ] }, { "added": [ " ", " * @param colIndex number of the column. starts at 1. ", " String getClobColumnFromExtFileAsString(String lobLocationStr, int colIndex) ", " initExternalLobFile(lobLocationStr, colIndex);", " return lobFileHandles[colIndex-1].getString(lobOffset,lobLength);", " }", " ", "\t\t}catch(Exception ex) {", "\t\t\tthrow LoadError.unexpectedError(ex);", "\t\t}", "\t}", "", "", " /**", " * Returns a clob columnn data stored at the specified location as", " * a java.sql.Clob object. ", " * @param lobLocationStr location of the clob data.", " * @param colIndex number of the column. starts at 1. ", " * @exception SQLException on any errors. ", " */", " java.sql.Clob getClobColumnFromExtFile(String lobLocationStr, int colIndex) ", " throws SQLException ", " {", "\t\ttry {", " initExternalLobFile(lobLocationStr, colIndex);", " if (lobLength == -1 ){", " // lob length -1 indicates columnn value is a NULL, ", " // just return null. ", " return null;", " } else {", " return new ImportClob(lobFileHandles[colIndex -1],", " lobOffset,lobLength);" ], "header": "@@ -934,22 +942,51 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " String getClobColumnFromExtFile(String lobLocationStr) ", " initExternalLobFile(lobLocationStr);", " return lobFile.getString(lobOffset,lobLength);" ] }, { "added": [ " * @param colIndex number of the column. starts at 1. ", " java.sql.Blob getBlobColumnFromExtFile(String lobLocationStr, int colIndex)", " initExternalLobFile(lobLocationStr, colIndex);", " return new ImportBlob(lobFileHandles[colIndex -1], ", " lobOffset, lobLength);" ], "header": "@@ -961,19 +998,21 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " java.sql.Blob getBlobColumnFromExtFile(String lobLocationStr)", " initExternalLobFile(lobLocationStr);", " return new ImportBlob(lobFile, lobOffset, lobLength);" ] }, { "added": [ " * @param colIndex number of the column. starts at 1.", " private void initExternalLobFile(String lobLocationStr, int colIndex) " ], "header": "@@ -983,9 +1022,10 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " private void initExternalLobFile(String lobLocationStr) " ] }, { "added": [ " if (lobFileHandles[colIndex-1] == null) {", " // each lob column in the table has it's own file handle. ", " // separate file handles are must, lob stream objects", " // can not be reused until the whole row is inserted.", " lobFileHandles[colIndex-1] = new ImportLobFile(lobFileName, ", " controlFileReader.getDataCodeset());" ], "header": "@@ -1004,12 +1044,14 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ "", " if (lobFile == null) {", " lobFile = new ImportLobFile(lobFileName, ", " controlFileReader.getDataCodeset());" ] }, { "added": [], "header": "@@ -1020,5 +1062,3 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ "", "" ] } ] } ]
derby-DERBY-378-7c20bd09
DERBY-378 (partial) This patch checks for invalid hex strings in the import file while performing import into a table with CHAR FOR BIT DATA, VARCHAR FOR BIT DATA, LONG VARCHAR FOR BIT DATA data types. Import will throw an exception if it detects any invalid hex strings during import. Tests: Added a new junit test case to ImportExportBinaryDataTest.java to test for the invalid hex strings in the import file. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@516145 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.error.StandardException;", "" ], "header": "@@ -27,6 +27,10 @@ import java.sql.ResultSetMetaData;", "removed": [] } ] } ]
derby-DERBY-378-c8f894e5
DERBY-378 (partial) This patch changes the names of the new system procedures added to support import/export of lob data. New procedure names are : SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(..) SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(..) SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(...) SYSCS_UTIL.SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(..) Removed the test cases added earlier to ieptests.sql test for this issue, now those test cases are covered by the new junit tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@523028 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " * are exported to an external file and the reference to it is written ", " * SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(IN SCHEMANAME VARCHAR(128), ", " public static void SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(" ], "header": "@@ -1135,17 +1135,17 @@ public class SystemProcedures {", "removed": [ " * are exported to a separate file and the reference to it is written ", " * SYSCS_EXPORT_TABLE_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), ", " public static void SYSCS_EXPORT_TABLE_LOBS_IN_EXTFILE(" ] }, { "added": [ " * are exported to an external file and the reference to it is written ", " * SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(IN SELECTSTATEMENT VARCHAR(32672),", " public static void SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(" ], "header": "@@ -1197,18 +1197,18 @@ public class SystemProcedures {", "removed": [ " * are exported to a separate file and the reference to it is written ", " * SYSCS_EXPORT_QUERY_LOBS_IN_EXTFILE(IN SELECTSTATEMENT VARCHAR(32672),", " public static void SYSCS_EXPORT_QUERY_LOBS_IN_EXTFILE(" ] }, { "added": [ " * SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), ", " public static void SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(" ], "header": "@@ -1273,13 +1273,13 @@ public class SystemProcedures {", "removed": [ " * SYSCS_IMPORT_TABLE_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), ", " public static void SYSCS_IMPORT_TABLE_LOBS_IN_EXTFILE(" ] }, { "added": [ " * SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), " ], "header": "@@ -1359,7 +1359,7 @@ public class SystemProcedures {", "removed": [ " * SYSCS_IMPORT_DATA_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), " ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/Export.java", "hunks": [ { "added": [ " * SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE system procedure from ij " ], "header": "@@ -125,7 +125,7 @@ public class Export extends ExportAbstract{", "removed": [ " * SYSCS_EXPORT_TABLE_LOBS_IN_EXTFILE system procedure from ij " ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " /* SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(IN SCHEMANAME VARCHAR(128), " ], "header": "@@ -10453,7 +10453,7 @@ public final class\tDataDictionaryImpl", "removed": [ " /* SYSCS_EXPORT_TABLE_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), " ] }, { "added": [ " \"SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE\"," ], "header": "@@ -10485,7 +10485,7 @@ public final class\tDataDictionaryImpl", "removed": [ " \"SYSCS_EXPORT_TABLE_LOBS_IN_EXTFILE\"," ] }, { "added": [ " /* SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(", " * IN CODESET VARCHAR(128), IN LOBSFILENAME VARCHAR(32672))" ], "header": "@@ -10497,11 +10497,11 @@ public final class\tDataDictionaryImpl", "removed": [ " /* SYSCS_EXPORT_QUERY_LOBS_IN_EXTFILE(", " * IN CODESET VARCHAR(128))" ] }, { "added": [ " \"SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE\"," ], "header": "@@ -10526,7 +10526,7 @@ public final class\tDataDictionaryImpl", "removed": [ " \"SYSCS_EXPORT_QUERY_LOBS_IN_EXTFILE\"," ] }, { "added": [ " /* SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), " ], "header": "@@ -10538,7 +10538,7 @@ public final class\tDataDictionaryImpl", "removed": [ " /* SYSCS_IMPORT_TABLE_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), " ] }, { "added": [ " \"SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE\"," ], "header": "@@ -10568,7 +10568,7 @@ public final class\tDataDictionaryImpl", "removed": [ " \"SYSCS_IMPORT_TABLE_LOBS_IN_EXTFILE\"," ] }, { "added": [ " /* SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE(IN SCHEMANAME VARCHAR(128), " ], "header": "@@ -10579,7 +10579,7 @@ public final class\tDataDictionaryImpl", "removed": [ " /* SYSCS_IMPORT_DATA_LOBS_IN_EXTFILE(IN SCHEMANAME VARCHAR(128), " ] } ] } ]
derby-DERBY-378-e17a43de
DERBY-378 (partial) This patch makes lob file to be created in the same location as main export file , if the specified lob file name is unqualified. i.e fileName string just contains the name of the file. And also improved error messages for couple of user error cases. Added test cases for the above and also modified some existing test cases to perform import/export using different codeset. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@527319 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/Export.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.error.StandardException;", "" ], "header": "@@ -26,6 +26,10 @@ import java.sql.ResultSet;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ExportWriteData.java", "hunks": [ { "added": [ "import java.io.File;" ], "header": "@@ -31,6 +31,7 @@ import java.net.MalformedURLException;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportLobFile.java", "hunks": [ { "added": [ "import java.io.File;", "import java.io.RandomAccessFile;", "import java.io.InputStreamReader;", "import java.io.InputStream;", "import java.io.IOException;", "import java.io.Reader;", "import java.io.FileNotFoundException;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.error.StandardException;" ], "header": "@@ -20,10 +20,19 @@", "removed": [ "import java.io.*;" ] }, { "added": [ " * @param lobFile the file which has the LOB Data.", " * @param dataCodeset the code set to use char data in the file.", " ImportLobFile(File lobFile, String dataCodeset) throws Exception {", " openLobFile(lobFile);", " * @param lobFile the file that contains lob data.", " private void openLobFile(final File lobFile) " ], "header": "@@ -36,28 +45,26 @@ class ImportLobFile", "removed": [ " private String lobFileName;", " * @param fileName the file which gas LOB Data.", " * @param dataCodeset the code set to use char data in the file.", " ImportLobFile(String fileName, String dataCodeset) throws Exception {", " this.lobFileName = fileName;", " openLobFile(lobFileName);", " * @param lobFileName name of the file that contains lob data.", " private void openLobFile(final String lobFileName) " ] }, { "added": [ " return new RandomAccessFile(lobFile, \"r\");" ], "header": "@@ -67,7 +74,7 @@ class ImportLobFile", "removed": [ " return new RandomAccessFile(lobFileName, \"r\");" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportReadData.java", "hunks": [ { "added": [ "import java.io.File;" ], "header": "@@ -27,6 +27,7 @@ import java.io.InputStream;", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java", "hunks": [ { "added": [ "", "", " public static boolean deleteFile(final String fileName) ", " {", " Boolean ret = (Boolean) AccessController.doPrivileged", " (new java.security.PrivilegedAction() {", " ", " public Object run() {", " return Boolean.valueOf((new File(fileName)).delete());", " }", " }", " );", " ", " return ret.booleanValue();", " }" ], "header": "@@ -266,4 +266,19 @@ public class SupportFilesSetup extends TestSetup {", "removed": [] } ] } ]
derby-DERBY-378-fef20ca2
DERBY-378 (partial) This patch adds code required to enable new system procedures added to support import/export of lob data on hard upgrade from versions before 10.3. Added a new test case to the 10.3 upgrade test cases. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@522077 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-378-ffdaf1e6
DERBY-378 (partial) This patch adds code to handles NULL (SQL NULL) data while performing import/export of table with column types blob, clob. Checks for invalid hex strings in the import file while performing import into a table with Blob column. Import will throw an exception if it detects any invalid hex strings in the import file for blob column. Tests: 1) Added a new junit test ImportExportLobTest.java to tests import/export of clobs and blob data. 2) Wrapped BufferInputStream/BufferedReader around the streams used in BaseJDBCTestCase.java:assertEquals() methods to compare clobs/blobs. Without buffering these assert method were really slow. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@518427 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/ExportWriteData.java", "hunks": [ { "added": [ " if (istream != null ) {", " while(noBytes != -1) ", " {", " lobOutBinaryStream.write(byteBuf, 0 , noBytes);", " blobSize += noBytes;", " noBytes = istream.read(byteBuf) ;", " }", " // close the input stream. ", " istream.close();", " // flush the output binary stream. ", " lobOutBinaryStream.flush();", " } else {", " // stream is null, column value must be SQL NULL.", " // set the size to -1, on import columns will ", " // be interepreted as NULL, filename and offset are ", " // ignored.", " blobSize = -1;", " }", " // Format is : <code > <fileName>.<lobOffset>.<size of lob>/ </code>.", " // For a NULL blob, size will be written as -1", "", " String lobLocation = lobsFileName + \".\" + ", " lobFileOffset + \".\" + blobSize + \"/\";", " if (blobSize != -1)", " lobFileOffset += blobSize;" ], "header": "@@ -203,30 +203,41 @@ final class ExportWriteData extends ExportWriteDataAbstract", "removed": [ " noBytes = istream.read(byteBuf) ;", " while(noBytes != -1) ", " {", " lobOutBinaryStream.write(byteBuf, 0 , noBytes);", " blobSize += noBytes;", " }", " // close the input stream. ", " istream.close();", " // flush the output binary stream. ", " lobOutBinaryStream.flush();", " // Format is : <fileName> : <lobOffset> : <size of lob>", " String lobLocation = lobsFileName + \":\" + ", " lobFileOffset + \":\" + blobSize;", " lobFileOffset += blobSize;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java", "hunks": [ { "added": [ " java.sql.Blob blob = null;", " blob = importReadData.getBlobColumnFromExtFile(", " String hexData = nextRow[columnIndex-1];", " byte[] data = null;", " if (hexData != null) {", " // Derby export calls Resultset.getString() method", " // when blob column data is not exported to an ", " // external file. Derby getString() method return ", " // the data in hex format for binary types, by ", " // calling StringUtil.toHexString(). If the data ", " // is being imported from a file that exported ", " // from non-derby source, hex data is expected to be ", " // same format as one written using ", " // StringUtil.toHexString(). StringUtil.fromHexString() ", " // is used to covert the hex data to byte array. ", "", " data = StringUtil.fromHexString(", " hexData, 0, hexData.length());", " // fromHexString() returns null if the hex string ", " // is invalid one. It is invalid if the data string ", " // length is not multiple of 2 or the data string ", " // contains non-hex characters. ", " if (data == null) {", " throw PublicAPI.wrapStandardException(", " StandardException.newException(", " SQLState.IMPORTFILE_HAS_INVALID_HEXSTRING, ", " hexData));", " }", "", " blob = new ImportBlob(data); ", " }", " ", " wasNull = (blob == null);", " return blob;" ], "header": "@@ -169,15 +169,47 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [ " return importReadData.getBlobColumnFromExtFile(", " return new ImportBlob(nextRow[columnIndex-1]);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportReadData.java", "hunks": [ { "added": [ " if (lobLength == -1 ){", " // lob length -1 indicates columnn value is a NULL, ", " // just return null. ", " return null;", " } else {", " return lobFile.getString(lobOffset,lobLength);", " }", " " ], "header": "@@ -944,7 +944,14 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " return lobFile.getString(lobOffset,lobLength);" ] }, { "added": [ " if (lobLength == -1) {", " // lob length -1 indicates columnn value is a NULL, ", " // just return null. ", " return null;", " }", " else {", " return new ImportBlob(lobFile, lobOffset, lobLength);", " }" ], "header": "@@ -960,7 +967,14 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " return new ImportBlob(lobFile, lobOffset, lobLength);" ] } ] } ]
derby-DERBY-3780-c3ff1bd3
DERBY-3780 fix some encoding problems in tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@678063 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3781-634b64f4
DERBY-3781: PositionedStoreStream.reposition(pos) with pos greater than length leaves the stream object in an inconsistent state. Reset the underlying stream and the position to zero after an unsuccessful positioning attempt (requestedPos > length). Patch file: derby-3781-1a-fix_and_test.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677172 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3781-7cba6d5f
DERBY-3781: PositionedStoreStream.reposition(pos) with pos greater than length leaves the stream object in an inconsistent state. Code cleanup, removing an unnecessary convenience variable that can lead to future bugs if used. Patch file: derby-3781-2b-remove_convenience_link.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677281 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/PositionedStoreStream.java", "hunks": [ { "added": [], "header": "@@ -60,9 +60,6 @@ public class PositionedStoreStream", "removed": [ " /** Convenience reference to the stream as a resettable stream. */", " //@GuardedBy(\"EmbedConnection.getConnectionSynchronization()\")", " private final Resetable resettable;" ] }, { "added": [], "header": "@@ -78,12 +75,9 @@ public class PositionedStoreStream", "removed": [ " * @throws ClassCastException if the inputstream does not implement", " * {@link Resetable}", " this.resettable = (Resetable)in;" ] }, { "added": [ " ((Resetable)this.stream).resetStream();" ], "header": "@@ -153,7 +147,7 @@ public class PositionedStoreStream", "removed": [ " this.resettable.resetStream();" ] }, { "added": [ " ((Resetable)this.stream).initStream();" ], "header": "@@ -165,7 +159,7 @@ public class PositionedStoreStream", "removed": [ " this.resettable.initStream();" ] }, { "added": [ " ((Resetable)this.stream).closeStream();" ], "header": "@@ -175,7 +169,7 @@ public class PositionedStoreStream", "removed": [ " this.resettable.closeStream();" ] } ] } ]
derby-DERBY-3783-1c589afd
DERBY-3783: LOBStreamControl shouldn't throw SQLException. Throw StandardException instead of SQLException at this level of the code. Patch file: derby-3783-1a-dont_throw_sqlexception.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677623 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/LOBInputStream.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.impl.jdbc;", "removed": [ "import java.sql.SQLException;" ] }, { "added": [ " } catch (StandardException se) {", " String state = se.getSQLState();", " if (state.equals(ExceptionUtil.getSQLStateFromIdentifier(", " SQLState.BLOB_POSITION_TOO_LARGE))) {", " return -1;", " } else if (state.equals(ExceptionUtil.getSQLStateFromIdentifier(", " SQLState.BLOB_INVALID_OFFSET))) {", " throw new ArrayIndexOutOfBoundsException(se.getMessage());", " } else {", " throw new IOException(se.getMessage());", " }" ], "header": "@@ -123,11 +122,17 @@ public class LOBInputStream extends InputStream {", "removed": [ " } catch (SQLException e) {", " return handleSQLException (e);", " }", " catch (StandardException se) {", " throw new IOException (se.getMessage());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBOutputStream.java", "hunks": [ { "added": [], "header": "@@ -22,10 +22,8 @@", "removed": [ "import java.io.ByteArrayInputStream;", "import java.sql.SQLException;" ] }, { "added": [], "header": "@@ -69,8 +67,6 @@ public class LOBOutputStream extends OutputStream {", "removed": [ " } catch (SQLException e) {", " throw new IOException(e.getMessage());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [], "header": "@@ -29,7 +29,6 @@ import java.io.OutputStream;", "removed": [ "import java.sql.SQLException;" ] }, { "added": [ " throws IOException, StandardException {" ], "header": "@@ -81,7 +80,7 @@ class LOBStreamControl {", "removed": [ " throws IOException, SQLException, StandardException {" ] }, { "added": [ " throws IOException, StandardException {" ], "header": "@@ -89,7 +88,7 @@ class LOBStreamControl {", "removed": [ " throws IOException, SQLException, StandardException {" ] }, { "added": [ " throw (StandardException)e;" ], "header": "@@ -112,11 +111,9 @@ class LOBStreamControl {", "removed": [ " throw Util.generateCsSQLException ((StandardException) e);", " if (e instanceof RuntimeException)", " throw (RuntimeException) e;" ] }, { "added": [ " throws StandardException {" ], "header": "@@ -129,7 +126,7 @@ class LOBStreamControl {", "removed": [ " throws SQLException {" ] }, { "added": [ " throw StandardException.newException(", " throw StandardException.newException(" ], "header": "@@ -138,14 +135,14 @@ class LOBStreamControl {", "removed": [ " throw Util.generateCsSQLException(", " throw Util.generateCsSQLException(" ] }, { "added": [ " throws IOException, StandardException {", " throw StandardException.newException(", " throw StandardException.newException(", " throw StandardException.newException(", " throw StandardException.newException(", " throw StandardException.newException(", " private void isValidOffset(int off, int length) throws StandardException {", " throw StandardException.newException(" ], "header": "@@ -164,32 +161,32 @@ class LOBStreamControl {", "removed": [ " throws SQLException, IOException {", " throw Util.generateCsSQLException(", " throw Util.generateCsSQLException(", " throw Util.generateCsSQLException(", " throw Util.generateCsSQLException(", " throw Util.generateCsSQLException(", " private void isValidOffset(int off, int length) throws SQLException {", " throw Util.generateCsSQLException(" ] }, { "added": [ " * @throws IOException, StandardException", " throws IOException, StandardException {" ], "header": "@@ -198,10 +195,10 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException, StandardException", " throws IOException, SQLException, StandardException {" ] }, { "added": [ " * @throws IOException, StandardException", " throws IOException, StandardException {", " isValidPostion(pos);", " } catch (StandardException e) {" ], "header": "@@ -225,15 +222,14 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException, StandardException", " throws IOException, SQLException, StandardException {", " isValidPostion(pos);", " }", " catch (SQLException e) {" ] }, { "added": [ " * @throws IOException, StandardException", " throws IOException, StandardException {" ], "header": "@@ -257,10 +253,10 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException, StandardException", " throws IOException, SQLException, StandardException {" ] }, { "added": [ " * @throws IOException, StandardException", " throws IOException, StandardException {" ], "header": "@@ -294,10 +290,10 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException, StandardException", " throws IOException, SQLException, StandardException {" ] }, { "added": [ " * @throws IOException", " throws IOException, StandardException {" ], "header": "@@ -339,10 +335,10 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException", " throws IOException, SQLException, StandardException {" ] }, { "added": [ " tmpFile.setLength(size);" ], "header": "@@ -356,12 +352,7 @@ class LOBStreamControl {", "removed": [ " try {", " tmpFile.setLength(size);", " }", " catch (StandardException se) {", " Util.generateCsSQLException (se);", " }" ] }, { "added": [ " * @throws IOException, StandardException", " synchronized void copyData(InputStream inStream, long length)", " throws IOException, StandardException {" ], "header": "@@ -370,10 +361,10 @@ class LOBStreamControl {", "removed": [ " * @throws IOException, SQLException, StandardException", " synchronized void copyData(InputStream inStream,", " long length) throws IOException, SQLException, StandardException {" ] }, { "added": [ " synchronized long replaceBytes (byte [] buf, long stPos, long endPos)", " throws IOException, StandardException {" ], "header": "@@ -437,10 +428,9 @@ class LOBStreamControl {", "removed": [ " * @throws SQLException", " synchronized long replaceBytes (byte [] buf, long stPos, long endPos) ", " throws IOException, SQLException, StandardException {" ] } ] } ]
derby-DERBY-3783-ed0be21a
DERBY-3783: Added utility method that wraps a Throwable in an IOException git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@678388 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/LOBInputStream.java", "hunks": [ { "added": [ " throw Util.newIOException(se);" ], "header": "@@ -131,7 +131,7 @@ public class LOBInputStream extends InputStream {", "removed": [ " throw new IOException(se.getMessage());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBOutputStream.java", "hunks": [ { "added": [ " throw Util.newIOException(se);" ], "header": "@@ -68,7 +68,7 @@ public class LOBOutputStream extends OutputStream {", "removed": [ " throw new IOException (se.getMessage());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [ " throw Util.newIOException(e);" ], "header": "@@ -114,9 +114,7 @@ class LOBStreamControl {", "removed": [ " IOException ioe = new IOException (e.getMessage());", " ioe.initCause (e);", " throw ioe;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java", "hunks": [ { "added": [ " throw Util.newIOException(se);" ], "header": "@@ -142,9 +142,7 @@ public final class UTF8Reader extends Reader", "removed": [ " IOException ioe = new IOException(se.getMessage());", " ioe.initCause(se);", " throw ioe;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/Util.java", "hunks": [ { "added": [ " /**", " * Create an {@code IOException} that wraps another {@code Throwable}.", " *", " * @param cause the underlying cause of the error", " * @return an {@code IOException} linked to {@code cause}", " */", " static IOException newIOException(Throwable cause) {", " IOException ioe = new IOException(cause.getMessage());", " ioe.initCause(cause);", " return ioe;", " }", "" ], "header": "@@ -281,6 +281,18 @@ public abstract class Util {", "removed": [] } ] } ]
derby-DERBY-3784-94d395e2
DERBY-3784: ImportExportTest doesn't detect lack of expected errors Added calls to fail() to ensure that the tests fail if the expected exceptions are not thrown. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@679027 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3786-0bcca1b9
DERBY-3786: Assert failure in CacheEntry.unkeepForRemove when running stress.multi Made sure GenericLanguageConnectionContext didn't call CacheManager.remove() without the proper synchronization dictated by CacheManager's javadoc. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@688027 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [], "header": "@@ -29,7 +29,6 @@ import org.apache.derby.impl.sql.execute.InternalTriggerExecutionContext;", "removed": [ "import org.apache.derby.iapi.sql.Statement;" ] }, { "added": [ " * It should only be called if there is an exception preparing", " * the statement. The caller must have set the flag", " * {@code preparedStmt.compilingStatement} in the {@code GenericStatement}", " * before calling this method in order to prevent race conditions when", " * calling {@link CacheManager#remove(Cacheable)}.", "\tpublic void removeStatement(GenericStatement statement)" ], "header": "@@ -878,13 +877,16 @@ public class GenericLanguageConnectionContext", "removed": [ "\t* It will be called, for example, if there is an exception preparing", "\t* the statement.", "\tpublic void removeStatement(Statement statement)" ] }, { "added": [ " Cacheable cachedItem = statementCache.findCached(statement);", " // No need to do anything if the statement is already removed", " if (cachedItem != null) {", " CachedStatement cs = (CachedStatement) cachedItem;", " if (statement.getPreparedStatement() != cs.getPreparedStatement()) {", " // DERBY-3786: Someone else has removed the statement from", " // the cache, probably because of the same error that brought", " // us here. In addition, someone else has recreated the", " // statement. Since the recreated statement is not the same", " // object as the one we are working on, we don't have the", " // proper guarding (through the synchronized flag", " // GenericStatement.preparedStmt.compilingStatement) to ensure", " // that we're the only ones calling CacheManager.remove() on", " // this statement. Therefore, just release the statement here", " // so that we don't get in the way for the other thread that", " // is trying to compile the same query.", " statementCache.release(cachedItem);", " } else {", " // The statement object that we were trying to compile is still", " // in the cache. Since the compilation failed, remove it.", " statementCache.remove(cachedItem);", " }", " }" ], "header": "@@ -893,9 +895,29 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tCacheable cachedItem = statementCache.findCached(statement);", "\t\t\tif (cachedItem != null)", "\t\t\t\tstatementCache.remove(cachedItem);" ] } ] } ]
derby-DERBY-3788-c2b03c4c
DERBY-3788 and DERBY-269 Adding a new test case which will show that updating the statistics will make a query pickup better index compare to prior to statistics availability + // + //Check statistics update causes most efficient index usage + //Create a table with 2 non-unique indexes on 2 different columns. + //The indexes are created when the table is still empty and hence + //there are no statistics available for them in sys.sysstatistics. + //The table looks as follows + // create table t2(c21 int, c22 char(14), c23 char(200)) + // create index t2i1 on t2(c21) + // create index t2i2 on t2(c22) + //Load the data into the table and running following query will + //pickup index t2i1 on column c21 + // select * from t2 where c21=? and c22=? + //But once you make the statistics available for t2i2, the query + //will pickup index t2i2 on column c22 for the query above git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681085 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java", "hunks": [ { "added": [ "", " /**", " * @param tableName", " * @param indexName", " * @return true if passed indexName was used for Index Scan ResultSet ", " * for the passed tableName", " */", " public boolean usedSpecificIndexForIndexScan(", " \t\tString tableName, String indexName){", " return (statistics.indexOf(\"Index Scan ResultSet for \" + ", " tableName + \" using index \" + indexName)!= -1);", " }", "" ], "header": "@@ -170,6 +170,19 @@ public class RuntimeStatisticsParser {", "removed": [] } ] } ]
derby-DERBY-3790-3574e108
DERBY-3790: Investigate if request for update statistics can be skipped for certain kind of indexes, one instance may be unique indexes based on one column. Minor test improvements: added/improved comments, skipped use of reduced row count, removed unnecessary query execution. Added a new method to wait for the old/current statistics to be replaced, and then fetch the new statistics for the table. Patch file: derby-3790-2a-minor_test_improvements.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1341830 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java", "hunks": [ { "added": [ "import java.util.Arrays;", "import java.util.HashSet;", "import java.util.Set;" ], "header": "@@ -28,9 +28,12 @@ import java.sql.SQLException;", "removed": [] }, { "added": [ " /**", " * Waits for the current statistics to disappear and expects to fetch the", " * same number of new statistics for the table.", " *", " * @param table the table to get statistics for", " * @param currentStats the current statistics", " * @return The new statistics.", " * @throws SQLException if obtaining statistics fails", " */", " public IdxStats[] getNewStatsTable(String table, IdxStats[] currentStats)", " throws SQLException {", " if (timeout == 0) {", " throw new IllegalStateException(", " \"no timeout specified in the constructor\");", " }", " awaitChange(currentStats, timeout);", " return getStatsTable(table, currentStats.length);", " }", "" ], "header": "@@ -241,6 +244,25 @@ public class IndexStatsUtil {", "removed": [] }, { "added": [ " /**", " * Waits until all given statistics entries have been changed, or until", " * the call times out.", " * <p>", " * <em>NOTE</em>: The method is built on the assumption that the UUIDs of", " * statistics objects aren't reused. That is, when statistics are updated,", " * the old row in SYS.SYSSTATISTICS will be dropped and a new row will be", " * inserted.", " *", " * @param current the statistics that must change / be replaced", " * @param timeout maximum number of milliseconds to wait before giving up", " * @throws SQLException if obtaining statistics fails", " */", " private void awaitChange(IdxStats[] current, long timeout)", " throws SQLException {", " Set oldStats = new HashSet(Arrays.asList(current));", " Set newStats = null;", " long start = System.currentTimeMillis();", " // Make sure we run at least once.", " while (System.currentTimeMillis() - start < timeout ||", " newStats == null) {", " newStats = new HashSet(Arrays.asList(getStats()));", " newStats.retainAll(oldStats);", " if (newStats.isEmpty()) {", " return;", " }", " Utilities.sleep(200);", " }", " IdxStats[] outstanding = new IdxStats[newStats.size()];", " newStats.toArray(outstanding);", " Assert.fail(outstanding.length + \" missing statistics changes \" +", " \"(timeout=\" + timeout + \"ms): \" +", " buildStatString(outstanding, \"<unchanged statistics>\"));", " }", "" ], "header": "@@ -448,6 +470,41 @@ public class IndexStatsUtil {", "removed": [] } ] } ]
derby-DERBY-3790-bce78c96
DERBY-3790: Investigate if request for update statistics can be skipped for certain kind of indexes, one instance may be unique indexes based on one column. Make update statistics code skip generation of statistics for single-column unique indexes. This affects the istat daemon, the create index code, and the SYSCS_UTIL.SYSCS_UPDATE_STATISTICS system procedure. As a safe-guard a temporary debug property has been added to allow users to revert to the old behavior in case the changes mess up their query plans. Adjusted tests for the reduced number of statistics entries. Added new tests for the debug property, for upgrade, and for behavior verification. Patch file: derby-3790-1c-skip_stats_scui.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1341481 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;" ], "header": "@@ -45,6 +45,7 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "removed": [] }, { "added": [], "header": "@@ -119,16 +120,6 @@ public class IndexStatisticsDaemonImpl", "removed": [ " /**", " * Tells if the user want us to fall back to pre 10.9 behavior.", " * <p>", " * This means do not drop any disposable statistics, and do not skip", " * statistics for single-column primary key indexes.", " */", " private static final boolean FORCE_OLD_BEHAVIOR =", " PropertyUtil.getSystemBoolean(", " Property.STORAGE_AUTO_INDEX_STATS_DEBUG_FORCE_OLD_BEHAVIOR);", "" ] }, { "added": [ " /**", " * Tells if disposable stats should be generated, which will happen in", " * soft-upgrade mode or when the user asks us to revert to the old behavior.", " * <p>", " * Made public to allow access for CreateIndexConstantAction and", " * FromBaseTable, but this is no longer necessary when the debug property", " * to keep disposable statistics is removed.", " */", " public final boolean skipDisposableStats;" ], "header": "@@ -144,8 +135,15 @@ public class IndexStatisticsDaemonImpl", "removed": [ " /** Tells if the database is older than 10.9 (for soft upgrade). */", " private final boolean dbIsPre10_9;" ] }, { "added": [ "", " // For now allow users to override the new behavior through a debug", " // property. Will be removed or renamed in a future release.", " boolean keepDisposableStats = PropertyUtil.getSystemBoolean(", " Property.STORAGE_AUTO_INDEX_STATS_DEBUG_FORCE_OLD_BEHAVIOR);", " this.skipDisposableStats = dbAtLeast10_9(db) && !keepDisposableStats;" ], "header": "@@ -219,7 +217,12 @@ public class IndexStatisticsDaemonImpl", "removed": [ " this.dbIsPre10_9 = checkIfDbIsPre10_9(db);" ] }, { "added": [ " /** Tells if the database is 10.9 or newer. */", " private boolean dbAtLeast10_9(Database db) {", " return db.getDataDictionary().checkVersion(", " // Not expected to happen, but if it does err on the safe-side.", " return false;" ], "header": "@@ -238,17 +241,17 @@ public class IndexStatisticsDaemonImpl", "removed": [ " /** Tells if the database is older than 10.9. */", " private boolean checkIfDbIsPre10_9(Database db) {", " // Note the negation.", " return !db.getDataDictionary().checkVersion(", " return true;" ] }, { "added": [ " (cds == null && skipDisposableStats);" ], "header": "@@ -412,7 +415,7 @@ public class IndexStatisticsDaemonImpl", "removed": [ " (cds == null && !FORCE_OLD_BEHAVIOR && !dbIsPre10_9);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java", "hunks": [ { "added": [ "// Temporary until user override for disposable stats has been removed.", "import org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl;" ], "header": "@@ -77,6 +77,8 @@ import org.apache.derby.iapi.store.access.TransactionController;", "removed": [] }, { "added": [ " // The case where we have a table with a single-column unique", " // index is pretty common, so avoid engaging the istat", " // daemon if that's the only index on the table.", " if (qualifiesForStatisticsUpdateCheck(tableDescriptor)) {" ], "header": "@@ -928,9 +930,10 @@ public class FromBaseTable extends FromTable", "removed": [ " if (tableDescriptor.getTableType() ==", " TableDescriptor.BASE_TABLE_TYPE &&", " tableDescriptor.getTotalNumberOfIndexes() > 0) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java", "hunks": [ { "added": [ "// Used only to access a debug flag, will be removed or replaced.", "import org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl;", "" ], "header": "@@ -61,6 +61,9 @@ import org.apache.derby.iapi.types.DataValueDescriptor;", "removed": [] }, { "added": [ " if (dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_4, null))" ], "header": "@@ -577,8 +580,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [ "\t\t\tif (lcc.getDataDictionary().checkVersion(", "\t\t\t\tDataDictionary.DD_VERSION_DERBY_10_4, null)) " ] }, { "added": [ " if (dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_4, null))" ], "header": "@@ -612,8 +614,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [ "\t\t\tif (lcc.getDataDictionary().checkVersion(", "\t\t\t\t\tDataDictionary.DD_VERSION_DERBY_10_4, null)) " ] }, { "added": [ "", " long numRows = cCount.getRowCount();", " if (addStatistics(dd, indexRowGenerator, numRows))" ], "header": "@@ -918,8 +919,9 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [ "\t\tlong numRows;", "\t\tif ((numRows = cCount.getRowCount()) > 0)" ] }, { "added": [ " /**", " * Determines if a statistics entry is to be added for the index.", " * <p>", " * As an optimization, it may be better to not write a statistics entry to", " * SYS.SYSSTATISTICS. If it isn't needed by Derby as part of query", " * optimization there is no reason to spend resources keeping the", " * statistics up to date.", " *", " * @param dd the data dictionary", " * @param irg the index row generator", " * @param numRows the number of rows in the index", " * @return {@code true} if statistics should be written to", " * SYS.SYSSTATISTICS, {@code false} otherwise.", " * @throws StandardException if accessing the data dictionary fails", " */", " private boolean addStatistics(DataDictionary dd,", " IndexRowGenerator irg,", " long numRows)", " throws StandardException {", " boolean add = (numRows > 0);", " if (dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_9, null) &&", " // This horrible piece of code will hopefully go away soon!", " ((IndexStatisticsDaemonImpl)dd.getIndexStatsRefresher(false)).", " skipDisposableStats) {", " if (add && irg.isUnique() && irg.numberOfOrderedColumns() == 1) {", " // Do not add statistics for single-column unique indexes.", " add = false;", " }", " }", " return add;", " }", "" ], "header": "@@ -937,6 +939,38 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java", "hunks": [ { "added": [ " public static String buildStatString(IdxStats[] stats, String name) {" ], "header": "@@ -167,7 +167,7 @@ public class IndexStatsUtil {", "removed": [ " private String buildStatString(IdxStats[] stats, String name) {" ] } ] } ]
derby-DERBY-3791-c16a2d03
DERBY-3791: Excessive memory usage when fetching small Clobs. Exploits length information (where available) to reduce memory overhead wrt buffering. This improvement will only affect small Clobs in the range 1 byte to 8 KB, the smaller the Clob the bigger the overhead reduction. Patch file: derby-3791-2a-buffer-adjustments.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681723 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java", "hunks": [ { "added": [ " /** Maximum size in number of chars for the internal character buffer. */", " private static final int MAXIMUM_BUFFER_SIZE = 8*1024; // 8 KB" ], "header": "@@ -55,6 +55,8 @@ import org.apache.derby.iapi.types.Resetable;", "removed": [] }, { "added": [ " private final char[] buffer;" ], "header": "@@ -82,7 +84,7 @@ public final class UTF8Reader extends Reader", "removed": [ " private final char[] buffer = new char[8 * 1024];" ] }, { "added": [ " this.in = in; // Note the possible reassignment below." ], "header": "@@ -131,6 +133,7 @@ public final class UTF8Reader extends Reader", "removed": [] }, { "added": [], "header": "@@ -138,7 +141,6 @@ public final class UTF8Reader extends Reader", "removed": [ " this.in = in;" ] }, { "added": [], "header": "@@ -146,8 +148,6 @@ public final class UTF8Reader extends Reader", "removed": [ " // Buffer this for improved performance.", " this.in = new BufferedInputStream (in);" ] }, { "added": [ " // Setup buffering.", " int bufferSize = calculateBufferSize(utfLen, maxFieldSize);", " this.buffer = new char[bufferSize];", " if (this.positionedIn == null) {", " // Buffer this for improved performance.", " // Note that the stream buffers bytes, whereas the internal buffer", " // buffers characters. In worst case, the stream buffer must be", " // filled three times to fill the internal character buffer.", " this.in = new BufferedInputStream(in, bufferSize);", " }" ], "header": "@@ -160,6 +160,16 @@ public final class UTF8Reader extends Reader", "removed": [] }, { "added": [ " int bufferSize = calculateBufferSize(streamSize, maxFieldSize);", " this.buffer = new char[bufferSize];", " // Note that the stream buffers bytes, whereas the internal buffer", " // buffers characters. In worst case, the stream buffer must be filled", " // three times to fill the internal character buffer.", " this.in = new BufferedInputStream(in, bufferSize);" ], "header": "@@ -192,8 +202,13 @@ public final class UTF8Reader extends Reader", "removed": [ " this.in = new BufferedInputStream(in);" ] }, { "added": [ "", " /**", " * Calculates an optimized buffer size.", " * <p>", " * The maximum size allowed is returned if the specified values don't give", " * enough information to say a smaller buffer size is preferable.", " *", " * @param encodedSize data length in bytes", " * @param maxFieldSize maximum data length in bytes", " * @return An (sub)optimal buffer size.", " */", " private final int calculateBufferSize(long encodedSize, long maxFieldSize) {", " int bufferSize = MAXIMUM_BUFFER_SIZE;", " if (encodedSize > 0 && encodedSize < bufferSize) {", " bufferSize = (int)encodedSize;", " }", " if (maxFieldSize > 0 && maxFieldSize < bufferSize) {", " bufferSize = (int)maxFieldSize;", " }", " return bufferSize;", " }" ], "header": "@@ -587,4 +602,25 @@ readChars:", "removed": [] } ] } ]
derby-DERBY-3793-65e03868
DERBY-3793: Remove unnecessary methods from InternalClob interface. Removed InternalClob.getBytePosition. Patch file: derby-3793-1a-remove_getBytePosition.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@678724 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3793-e8fd6869
DERBY-3793: Remove unnecessary methods from InternalClob interface. Removed method InternalClob.getByteLength. The method can be re-introduced later if beneficial, but due to lacking length information about Clobs it is a very costly operation with the current code and it is not really required (more of a convenience method). Removed existing tests of the method, and added a new test to ensure the Derby specific end-of-stream marker isn't carried along. Patch file: derby-3793-2b-remove_getByteLength.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@691608 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/InternalClob.java", "hunks": [ { "added": [], "header": "@@ -39,15 +39,6 @@ import java.sql.SQLException;", "removed": [ " /**", " * Gets the number of bytes contained in the Clob.", " *", " * @return Number of bytes in the Clob.", " * @throws IOException if accessing underlying I/O resources fail", " * @throws SQLException if accessing underlying resources fail", " */", " long getByteLength() throws IOException, SQLException;", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [ " * <p>", " * Note that specifying the length as {@code Long.MAX_VALUE} results in", " * reading data from the stream until EOF is reached, but no length checking", " * will be performed.", " *", " * @param inStream the stream to copy from", " * @param length number of bytes to be copied, or {@code Long.MAX_VALUE} to", " * copy everything until EOF is reached" ], "header": "@@ -357,8 +357,14 @@ class LOBStreamControl {", "removed": [ " * @param inStream", " * @param length length to be copied" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java", "hunks": [ { "added": [], "header": "@@ -53,9 +53,6 @@ import org.apache.derby.iapi.util.UTF8Util;", "removed": [ " /** Maximum value used when requesting bytes/chars to be skipped. */", " private static final long SKIP_BUFFER_SIZE = 8*1024; // 8 KB", "" ] } ] } ]
derby-DERBY-3799-51ef6db8
DERBY-3799: NullPointerException when accessing a clob through a pooled connection. Verify that the LOB stored procedure statements are open (not only non-null). Patch file: derby-3799-1a-checkIfClosed.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681694 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/CallableLocatorProcedures.java", "hunks": [ { "added": [ " if (blobCreateLocatorCall == null ||", " !blobCreateLocatorCall.openOnClient_) {" ], "header": "@@ -113,7 +113,8 @@ class CallableLocatorProcedures", "removed": [ " if (blobCreateLocatorCall == null) {" ] }, { "added": [ " if (blobReleaseLocatorCall == null ||", " !blobReleaseLocatorCall.openOnClient_) {" ], "header": "@@ -164,7 +165,8 @@ class CallableLocatorProcedures", "removed": [ " if (blobReleaseLocatorCall == null) {" ] }, { "added": [ " if (blobGetPositionFromLocatorCall == null ||", " !blobGetPositionFromLocatorCall.openOnClient_) {" ], "header": "@@ -200,7 +202,8 @@ class CallableLocatorProcedures", "removed": [ " if (blobGetPositionFromLocatorCall == null) {" ] }, { "added": [ " if (blobGetPositionFromBytesCall == null ||", " !blobGetPositionFromBytesCall.openOnClient_) {" ], "header": "@@ -327,7 +330,8 @@ class CallableLocatorProcedures", "removed": [ " if (blobGetPositionFromBytesCall == null) {" ] }, { "added": [ " if (blobGetLengthCall == null || !blobGetLengthCall.openOnClient_) {" ], "header": "@@ -371,7 +375,7 @@ class CallableLocatorProcedures", "removed": [ " if (blobGetLengthCall == null) {" ] }, { "added": [ " if (blobGetBytesCall == null || !blobGetBytesCall.openOnClient_) {" ], "header": "@@ -421,7 +425,7 @@ class CallableLocatorProcedures", "removed": [ " if (blobGetBytesCall == null) {" ] }, { "added": [ " if (blobSetBytesCall == null || !blobSetBytesCall.openOnClient_) {" ], "header": "@@ -495,7 +499,7 @@ class CallableLocatorProcedures", "removed": [ " if (blobSetBytesCall == null) {" ] }, { "added": [ " if (blobTruncateCall == null || !blobTruncateCall.openOnClient_) {" ], "header": "@@ -551,7 +555,7 @@ class CallableLocatorProcedures", "removed": [ " if (blobTruncateCall == null) {" ] }, { "added": [ " if (clobCreateLocatorCall == null ||", " !clobCreateLocatorCall.openOnClient_) {" ], "header": "@@ -590,7 +594,8 @@ class CallableLocatorProcedures", "removed": [ " if (clobCreateLocatorCall == null) {" ] }, { "added": [ " if (clobReleaseLocatorCall == null ||", " !clobReleaseLocatorCall.openOnClient_) {" ], "header": "@@ -641,7 +646,8 @@ class CallableLocatorProcedures", "removed": [ " if (clobReleaseLocatorCall == null) {" ] }, { "added": [ " if (clobGetPositionFromStringCall == null ||", " !clobGetPositionFromStringCall.openOnClient_) {" ], "header": "@@ -760,7 +766,8 @@ class CallableLocatorProcedures", "removed": [ " if (clobGetPositionFromStringCall == null) {" ] }, { "added": [ " if (clobGetPositionFromLocatorCall == null ||", " !clobGetPositionFromLocatorCall.openOnClient_) {" ], "header": "@@ -809,7 +816,8 @@ class CallableLocatorProcedures", "removed": [ " if (clobGetPositionFromLocatorCall == null) {" ] }, { "added": [ " if (clobGetLengthCall == null || !clobGetLengthCall.openOnClient_) {" ], "header": "@@ -843,7 +851,7 @@ class CallableLocatorProcedures", "removed": [ " if (clobGetLengthCall == null) {" ] }, { "added": [ " if (clobGetSubStringCall == null ||", " !clobGetSubStringCall.openOnClient_) {" ], "header": "@@ -893,7 +901,8 @@ class CallableLocatorProcedures", "removed": [ " if (clobGetSubStringCall == null) {" ] }, { "added": [ " if (clobSetStringCall == null || !clobSetStringCall.openOnClient_) {" ], "header": "@@ -969,7 +978,7 @@ class CallableLocatorProcedures", "removed": [ " if (clobSetStringCall == null) {" ] } ] } ]
derby-DERBY-3803-9e91a063
DERBY-3803 fix 'org.apache.derbyTesting.functionTests.tests.lang.XMLTypeAndOpsTest' failures after checkin for DERBY-3745 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681104 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/daemon/SingleThreadDaemonFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.PrivilegedThreadOps;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.services.daemon.DaemonFactory;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "\t\t// DERBY-3745. setContextClassLoader for thread to null to avoid", "\t\t// leaking class loaders.", "\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\tdontGCthread, null);", "" ], "header": "@@ -276,6 +276,11 @@ abstract class BaseMonitor", "removed": [] }, { "added": [], "header": "@@ -2080,11 +2085,6 @@ nextModule:", "removed": [ "\t\t// DERBY-3745. setContextClassLoader for thread to null to avoid", "\t\t// leaking class loaders.", "\t\tPrivilegedThreadOps.setContextClassLoaderIfPrivileged(", "\t\t\t\t\t\t\t t, null);", "" ] } ] } ]