pass DB DEADLOCK error from lower to upper level of our code
authorMiloš Mulač <mulac@civ.zcu.cz>
Sat, 2 Feb 2008 16:00:04 +0000 (16:00 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Sat, 2 Feb 2008 16:00:04 +0000 (16:00 +0000)
- not tested yet
- supposed to be used in edg_wll_TransNeedRetry()

org.glite.lb.common/interface/context.h
org.glite.lb.server/src/db_supp.c
org.glite.lbjp-common.db/src/db.c

index ad366de..02fe955 100644 (file)
@@ -193,6 +193,7 @@ typedef enum _edg_wll_ErrorCode {
        EDG_WLL_IL_SYS,         /**< Interlogger internal error. */
        EDG_WLL_IL_EVENTS_WAITING, /**< Interlogger still has events pending delivery. */
        EDG_WLL_ERROR_COMPARE_EVENTS, /**< Two compared events differ. */
+       EDG_WLL_ERROR_DB_TRANS_DEADLOCK,        /**< Deadlock detected during DB operation. */
 } edg_wll_ErrorCode;
 
 /**
index 692d833..9c526c6 100644 (file)
@@ -10,6 +10,7 @@ int edg_wll_SetErrorDB(edg_wll_Context ctx) {
 
        if (ctx->dbctx) {
                code = glite_lbu_DBError(ctx->dbctx, NULL, &ed);
+               if (code == EDEADLOCK) code = EDG_WLL_ERROR_DB_TRANS_DEADLOCK;
                edg_wll_SetError(ctx, code, ed);
                free(ed);
        } else {
index 43dfc4b..455740d 100644 (file)
@@ -493,6 +493,10 @@ int glite_lbu_ExecSQL(glite_lbu_DBContext ctx, const char *cmd, glite_lbu_Statem
                                        if (retry_nr <= 0) 
                                                do_reconnect = 1;
                                        break;
+                               case ER_LOCK_DEADLOCK:
+                                       ERR(ctx, EDEADLOCK, db_handle.mysql_error(ctx->mysql));
+                                       return -1;
+                                       break;  
                                default:
                                        MY_ERR(ctx);
                                        return -1;