You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2008/10/02 17:29:44 UTC
svn commit: r701156 - in
/db/derby/code/trunk/java/client/org/apache/derby/client/am:
LOBStateTracker.java ResultSet.java
Author: kristwaa
Date: Thu Oct 2 08:29:43 2008
New Revision: 701156
URL: http://svn.apache.org/viewvc?rev=701156&view=rev
Log:
DERBY-3601: Optimize LOBStateTracker for non-locator servers.
>From the Jira comment (improvements implemented);
- LOBStateTracker.checkCurrentRow(): couldn't Arrays.fill() be moved inside the if block?
- should discardState() and markAccessed() check the release flag?
- should ResultSet.createLOBColumnTracker() use LOBStateTracker.NO_OP_TRACKER instead of allocating a new when serverSupportsLocators() returns false?
Patch file: derby-3601-2a-non_locator_optimization.diff
Modified:
db/derby/code/trunk/java/client/org/apache/derby/client/am/LOBStateTracker.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LOBStateTracker.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LOBStateTracker.java?rev=701156&r1=701155&r2=701156&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LOBStateTracker.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LOBStateTracker.java Thu Oct 2 08:29:43 2008
@@ -130,9 +130,9 @@
}
}
}
+ // Reset state for the next row.
+ Arrays.fill(this.published, false);
}
- // Reset state for the next row.
- Arrays.fill(this.published, false);
}
/**
@@ -143,11 +143,13 @@
* to release them from the client side in this case.
*/
void discardState() {
- // Force the state to published for all LOB columns.
- // This will cause checkCurrentRow to ignore all LOBs on the next
- // invocation. The method markAsPublished cannot be called before after
- // checkCurrentRow has been called again.
- Arrays.fill(this.published, true);
+ if (this.doRelease) {
+ // Force the state to published for all LOB columns.
+ // This will cause checkCurrentRow to ignore all LOBs on the next
+ // invocation. The method markAsPublished cannot be called before
+ // after checkCurrentRow has been called again.
+ Arrays.fill(this.published, true);
+ }
}
/**
@@ -160,7 +162,9 @@
* @param index 1-based column index
*/
void markAsPublished(int index) {
- int internalIndex = Arrays.binarySearch(this.columns, index);
- this.published[internalIndex] = true;
+ if (this.doRelease) {
+ int internalIndex = Arrays.binarySearch(this.columns, index);
+ this.published[internalIndex] = true;
+ }
}
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=701156&r1=701155&r2=701156&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Thu Oct 2 08:29:43 2008
@@ -6217,14 +6217,17 @@
/**
* Initializes the LOB state tracker.
* <p>
- * The state tracker is used to free LOB locators on the server.
+ * The state tracker is used to free LOB locators on the server. If the
+ * server doesn't support locators, or there are no LOBs in the result set,
+ * a no-op tracker will be used.
*/
final void createLOBColumnTracker() {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(this.lobState == null,
"LOB state tracker already initialized.");
}
- if (this.resultSetMetaData_.hasLobColumns()) {
+ if (this.connection_.supportsSessionDataCaching() &&
+ this.resultSetMetaData_.hasLobColumns()) {
final int columnCount = this.resultSetMetaData_.columns_;
int lobCount = 0;
int[] tmpIndexes = new int[columnCount];
@@ -6241,8 +6244,7 @@
boolean[] isBlob = new boolean[lobCount];
System.arraycopy(tmpIndexes, 0, lobIndexes, 0, lobCount);
System.arraycopy(tmpIsBlob, 0, isBlob, 0, lobCount);
- this.lobState = new LOBStateTracker(lobIndexes, isBlob,
- this.connection_.serverSupportsLocators());
+ this.lobState = new LOBStateTracker(lobIndexes, isBlob, true);
} else {
// Use a no-op state tracker to simplify code expecting a tracker.
this.lobState = LOBStateTracker.NO_OP_TRACKER;