]> andersk Git - moira.git/blobdiff - server/qrtn.qc
Avoid aborting a transaction that has been deadlocked; and
[moira.git] / server / qrtn.qc
index 07d02d848f59569763c9b2cf4569ae793b2b4d1e..12bbfa1d7013bbae91597a5b369ee4a23f53d653 100644 (file)
@@ -16,7 +16,7 @@ static char *rcsid_qrtn_qc = "$Header$";
 
 char *Argv[16];
 
-static int ingres_errno = 0;
+int ingres_errno = 0;
 extern char *whoami;
 extern FILE *journal;
 
@@ -69,6 +69,7 @@ int sms_open_database()
        
     /* open the database */
 ##  ingres sms
+##  set lockmode session where readlock = exclusive
     return ingres_errno;
 }
 
@@ -136,6 +137,7 @@ sms_process_query(cl, name, argc, argv_ro, action, actarg)
     if (q == (struct query *)0) return(SMS_NO_HANDLE);
     v = q->validate;
 
+    ingres_errno = 0;
     if (q->type != RETRIEVE)
 ##      begin transaction
 
@@ -307,7 +309,9 @@ out:
                fflush(journal);
            }
        } else {
-##          abort              /* it never happened */
+           if (status != SMS_DEADLOCK) {
+##             abort           /* it never happened */
+           }
        }
     }
 
@@ -532,6 +536,10 @@ get_client(cl, client_type, client_id)
     int child;
     struct save_queue *sq_create();
 
+    if (!strcmp(strtrim(list_type), strtrim(member_type)) &&
+       list_id == member_id)
+       return(1);
+
     /* see if client is a direct member of list */
 ##  repeat retrieve (exists = any(m.#member_id where 
 ##                               m.#list_id = @list_id and
@@ -773,6 +781,7 @@ set_next_object_id(object, table)
     if (LOG_RES)
         com_err(whoami, 0, "setting ID %s to %d", name, value);
 ##  repeat replace v (#value = @value) where v.#name = @name
+    if (ingres_errno != 0) return(ingres_errno);
     return(SMS_SUCCESS);
 ##}
 
This page took 0.033185 seconds and 4 git commands to generate.