[CalendarServer-changes] [9513] CalendarServer/trunk/lib-patches/cx_Oracle
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 1 13:15:26 PDT 2012
Revision: 9513
http://trac.macosforge.org/projects/calendarserver/changeset/9513
Author: cdaboo at apple.com
Date: 2012-08-01 13:15:25 -0700 (Wed, 01 Aug 2012)
Log Message:
-----------
Fix unwanted DB RTTs when fetching LOBs.
Added Paths:
-----------
CalendarServer/trunk/lib-patches/cx_Oracle/nclob-fixes-and-prefetch.patch
Removed Paths:
-------------
CalendarServer/trunk/lib-patches/cx_Oracle/bytes-per-nclob-character.patch
Deleted: CalendarServer/trunk/lib-patches/cx_Oracle/bytes-per-nclob-character.patch
===================================================================
--- CalendarServer/trunk/lib-patches/cx_Oracle/bytes-per-nclob-character.patch 2012-08-01 19:04:42 UTC (rev 9512)
+++ CalendarServer/trunk/lib-patches/cx_Oracle/bytes-per-nclob-character.patch 2012-08-01 20:15:25 UTC (rev 9513)
@@ -1,17 +0,0 @@
-Index: ExternalLobVar.c
-===================================================================
---- ExternalLobVar.c (revision 355)
-+++ ExternalLobVar.c (working copy)
-@@ -259,10 +259,9 @@
- amount = 1;
- }
- length = amount;
-- if (var->lobVar->type == &vt_CLOB)
-+ if ((var->lobVar->type == &vt_CLOB) ||
-+ (var->lobVar->type == &vt_NCLOB))
- bufferSize = amount * var->lobVar->environment->maxBytesPerCharacter;
-- else if (var->lobVar->type == &vt_NCLOB)
-- bufferSize = amount * 2;
- else bufferSize = amount;
-
- // create a string for retrieving the value
Added: CalendarServer/trunk/lib-patches/cx_Oracle/nclob-fixes-and-prefetch.patch
===================================================================
--- CalendarServer/trunk/lib-patches/cx_Oracle/nclob-fixes-and-prefetch.patch (rev 0)
+++ CalendarServer/trunk/lib-patches/cx_Oracle/nclob-fixes-and-prefetch.patch 2012-08-01 20:15:25 UTC (rev 9513)
@@ -0,0 +1,97 @@
+Index: Connection.c
+===================================================================
+--- Connection.c 2011-03-19 16:05:30.000000000 -0700
++++ Connection.c 2012-08-01 09:22:17.000000000 -0700
+@@ -713,6 +713,19 @@
+ if (newPasswordObj)
+ return Connection_ChangePassword(self, self->password, newPasswordObj);
+
++ /* set lob prefetch attribute to session */
++ ub4 default_lobprefetch_size = 4096; /* Set default size to 4K */
++ status = OCIAttrSet (self->sessionHandle, (ub4) OCI_HTYPE_SESSION,
++ (void *)&default_lobprefetch_size, /* attribute value */
++ 0, /* attribute size; not required to specify; */
++ (ub4) OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE,
++ self->environment->errorHandle);
++ if (Environment_CheckForError(self->environment, status,
++ "Connection_Connect(): OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE") < 0) {
++ self->sessionHandle = NULL;
++ return -1;
++ }
++
+ // begin the session
+ Py_BEGIN_ALLOW_THREADS
+ status = OCISessionBegin(self->handle, self->environment->errorHandle,
+
+Index: Cursor.c
+===================================================================
+--- Cursor.c 2011-03-19 16:05:30.000000000 -0700
++++ Cursor.c 2012-08-01 09:15:53.000000000 -0700
+@@ -1813,8 +1813,8 @@
+ }
+ }
+ Py_BEGIN_ALLOW_THREADS
+- status = OCIStmtFetch(self->handle, self->environment->errorHandle,
+- numRows, OCI_FETCH_NEXT, OCI_DEFAULT);
++ status = OCIStmtFetch2(self->handle, self->environment->errorHandle,
++ numRows, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
+ Py_END_ALLOW_THREADS
+ if (status != OCI_NO_DATA) {
+ if (Environment_CheckForError(self->environment, status,
+
+Index: ExternalLobVar.c
+===================================================================
+--- ExternalLobVar.c 2011-03-19 16:05:30.000000000 -0700
++++ ExternalLobVar.c 2012-07-31 14:26:16.000000000 -0700
+@@ -170,6 +170,8 @@
+ int offset) // offset
+ {
+ sword status;
++ oraub8 blength = 0;
++ oraub8 clength = *length;
+
+ if (var->lobVar->isFile) {
+ Py_BEGIN_ALLOW_THREADS
+@@ -183,11 +185,13 @@
+ }
+
+ Py_BEGIN_ALLOW_THREADS
+- status = OCILobRead(var->lobVar->connection->handle,
++ status = OCILobRead2(var->lobVar->connection->handle,
+ var->lobVar->environment->errorHandle,
+- var->lobVar->data[var->pos], length, offset, buffer,
+- bufferSize, NULL, NULL, 0, var->lobVar->type->charsetForm);
++ var->lobVar->data[var->pos], &blength, &clength, offset, buffer,
++ bufferSize, OCI_ONE_PIECE, NULL, NULL, 0, var->lobVar->type->charsetForm);
+ Py_END_ALLOW_THREADS
++ *length = blength;
++
+ if (Environment_CheckForError(var->lobVar->environment, status,
+ "ExternalLobVar_LobRead()") < 0) {
+ OCILobFileClose(var->lobVar->connection->handle,
+@@ -219,10 +223,10 @@
+ udt_ExternalLobVar *var) // variable to return the size of
+ {
+ sword status;
+- ub4 length;
++ oraub8 length;
+
+ Py_BEGIN_ALLOW_THREADS
+- status = OCILobGetLength(var->lobVar->connection->handle,
++ status = OCILobGetLength2(var->lobVar->connection->handle,
+ var->lobVar->environment->errorHandle,
+ var->lobVar->data[var->pos], &length);
+ Py_END_ALLOW_THREADS
+@@ -259,10 +263,9 @@
+ amount = 1;
+ }
+ length = amount;
+- if (var->lobVar->type == &vt_CLOB)
++ if ((var->lobVar->type == &vt_CLOB) || (var->lobVar->type == &vt_NCLOB))
++ // Always use environment setting for character LOBs
+ bufferSize = amount * var->lobVar->environment->maxBytesPerCharacter;
+- else if (var->lobVar->type == &vt_NCLOB)
+- bufferSize = amount * 2;
+ else bufferSize = amount;
+
+ // create a string for retrieving the value
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120801/f684dda7/attachment-0001.html>
More information about the calendarserver-changes
mailing list