MAX-10, Transaction support for MaxScale.

Naive implementation, which routes all statements to master between BEGIN|START TRANSACTION <options> and ROLLBACK|COMMIT
This commit is contained in:
VilhoRaatikka
2014-03-18 23:41:32 +02:00
parent d7e9978ac1
commit d6a9a5c1d0
4 changed files with 82 additions and 22 deletions

View File

@ -390,7 +390,7 @@ static skygw_query_type_t resolve_query_type(
/** SELECT ..INTO variable|OUTFILE|DUMPFILE */
if (lex->result != NULL) {
qtype = QUERY_TYPE_SESSION_WRITE;
goto return_here;
goto return_qtype;
}
/**
* 1:ALTER TABLE, TRUNCATE, REPAIR, OPTIMIZE, ANALYZE, CHECK.
@ -412,7 +412,7 @@ static skygw_query_type_t resolve_query_type(
qtype = QUERY_TYPE_WRITE;
}
goto return_here;
goto return_qtype;
}
/**
@ -428,7 +428,7 @@ static skygw_query_type_t resolve_query_type(
{
qtype = QUERY_TYPE_SESSION_WRITE;
}
goto return_here;
goto return_qtype;
}
/** Try to catch session modifications here */
@ -452,6 +452,21 @@ static skygw_query_type_t resolve_query_type(
qtype = QUERY_TYPE_WRITE;
break;
case SQLCOM_BEGIN:
qtype = QUERY_TYPE_BEGIN_TRX;
goto return_qtype;
break;
case SQLCOM_COMMIT:
qtype = QUERY_TYPE_COMMIT;
goto return_qtype;
break;
case SQLCOM_ROLLBACK:
qtype = QUERY_TYPE_ROLLBACK;
goto return_qtype;
break;
default:
break;
}
@ -603,6 +618,6 @@ static skygw_query_type_t resolve_query_type(
}
} /**< for */
} /**< if */
return_here:
return_qtype:
return qtype;
}

View File

@ -29,12 +29,15 @@ EXTERN_C_BLOCK_BEGIN
* is modified
*/
typedef enum {
QUERY_TYPE_UNKNOWN = 7, /*!< Couln't find out or parse error */
QUERY_TYPE_LOCAL_READ, /*!< Read non-database data, execute in MaxScale */
QUERY_TYPE_READ, /*!< No updates */
QUERY_TYPE_WRITE, /*!< Master data will be modified */
QUERY_TYPE_SESSION_WRITE,/*!< Session data will be modified */
QUERY_TYPE_GLOBAL_WRITE /*!< Global system variable modification */
QUERY_TYPE_UNKNOWN = 7, /*< Couln't find out or parse error */
QUERY_TYPE_LOCAL_READ, /*< Read non-database data, execute in MaxScale */
QUERY_TYPE_READ, /*< No updates */
QUERY_TYPE_WRITE, /*< Master data will be modified */
QUERY_TYPE_SESSION_WRITE,/*< Session data will be modified */
QUERY_TYPE_GLOBAL_WRITE, /*< Global system variable modification */
QUERY_TYPE_BEGIN_TRX, /*< BEGIN or START TRANSACTION */
QUERY_TYPE_ROLLBACK, /*< ROLLBACK */
QUERY_TYPE_COMMIT /*< COMMIT */
} skygw_query_type_t;