this patch include 2 part:

  1. take a better checking in if case
  2. commit all transaction whenever user is logging out

both change are just safety checking, and will not change the programming logic. on the other hand, the 2nd change will be much oracle friendly and so increase cross DB compatibility.

Comments

hswong3i’s picture

my partner (mike2854: http://drupal.org/user/31933) report that:

without that line user will can't logout
this seems to be because not yet commit...
after adding that line, user is able to logout
not yet try other solutions, as don't have enough time...

BTW, as the patch is just a safty checking, it seems harmless in current status.

hswong3i’s picture

just setup a drupal-6-dev testbed with MySQL 5.0.38 and PHP 5.2.0-10. test passed: user is able to logout, no harmful reaction.

i will test it under oracle once again afterward ;)

hswong3i’s picture

Status: Needs review » Reviewed & tested by the community

as mike (http://drupal.org/user/31933) provide the original patch, which it is totally not acceptable among different DB, i rework it as current patch, which use db_unlock_table():

diff -urpN drupal-6.x-dev.org/modules/user/user.module drupal-6.x-dev/modules/user/user.module
--- drupal-6.x-dev.org/modules/user/user.module	2007-05-25 20:52:16.000000000 +0800
+++ drupal-6.x-dev/modules/user/user.module	2007-05-29 23:09:13.000000000 +0800
@@ -396,7 +396,9 @@ function user_access($string, $account =
   global $user;
   static $perm = array();
 
-  if (is_null($account)) {
+  // -- checkpoint 02: edit to make aggregator works in oracle
+  if (is_null($account) || !isset($account->uid)) {
+  // -- end 02
     $account = $user;
   }
 
@@ -1165,6 +1167,9 @@ function user_logout() {
 
   // Load the anonymous user
   $user = drupal_anonymous_user();
+  if ($GLOBALS['db_type'] == 'oracle') {
+    OCICommit($active_db);
+  }
 
   drupal_goto();
 }

mike just test my patch once again, and it is also function under oracle. it is now ready to commit ;)

dries’s picture

I don't understand why the patch in #1 is necessary. We're unlocking something which has never been locked to begin with. Maybe this is necessary due to a bug in your Oracle database layer.

I'm not inclined to commit this patch until we understand what is going on. I don't understand what you were saying in #3 but maybe it was part of the answer.

If you could provide a bit more (background) information about why this is necessary, we'd be able to better understand why this is needed. Thanks.

hswong3i’s picture

as like as the case of block.module (http://drupal.org/node/147865): your question is totally correct. it is not happened within mysql, and so we need to take some special handling within oracle, in order to ensure the successful of COMMIT before user logout.

since oracle are expected to run numbers of DML, store within queue, and run them once during COMMIT. before any COMMIT, no change will be taken to DB architecture. on the other hand, user are also able to roll back or give up change before running COMMIT. only DDL will take effect to DB architecture immediately.

within our oracle driver implementation, we force to run COMMIT for every call of db_query(): this will keep the oracle driver functionality as like as mysql, which also more close to the requirement of drupal usage. this is not required by mysql driver, as mysql don't have such concept about COMMIT: every call of db_query() will immediately reflect to DB structure.

and that's why we will need to take some extra handle with this topic :(

hswong3i’s picture

Status: Reviewed & tested by the community » Needs work
hswong3i’s picture

Status: Needs work » Fixed

problem solved!

as mentioned in #5, it should be oracle-driver-only problem. i double check the driver architecture, rewrite db_unlock_tables() as independence with db_query(), rewrite most DB related function to use db_unlock_tables() before return, so force all transaction to be committed.

mike and i check it for many time, and no long have locking during user logout. if this problem never happened among other DB driver, this thread should marked as fixed ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)