|
1 |
| -/* Copyright (C) 2009-2013 Codership Oy <[email protected]> |
| 1 | +/* Copyright (C) 2009-2024 Codership Oy <[email protected]> |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify
|
4 | 4 | it under the terms of the GNU General Public License as published by
|
@@ -1373,6 +1373,68 @@ int wsrep_load(const char* spec, wsrep_t** hptr, wsrep_log_cb_t log_cb);
|
1373 | 1373 | */
|
1374 | 1374 | void wsrep_unload(wsrep_t* hptr);
|
1375 | 1375 |
|
| 1376 | +/*! |
| 1377 | + * A callback struct to pass on calls which may be required to |
| 1378 | + * maintain sequential consistency enforced by the caller. The |
| 1379 | + * provider will call the callback once the sequential consistency |
| 1380 | + * is guaranteed. |
| 1381 | + */ |
| 1382 | +typedef struct wsrep_seq_cb { |
| 1383 | + /*! Pointer to caller defined context. */ |
| 1384 | + void *ctx; |
| 1385 | + /*! Function which will be called by the provider once the sequential |
| 1386 | + * consistency is guaranteed. |
| 1387 | + * |
| 1388 | + * @param ctx Caller defined context. |
| 1389 | + */ |
| 1390 | + void (*fn)(void *ctx); |
| 1391 | +} wsrep_seq_cb_t; |
| 1392 | + |
| 1393 | +/*! |
| 1394 | + * @brief Certifies transaction with provider. |
| 1395 | + * |
| 1396 | + * Must be called before transaction commit. Returns success code, which |
| 1397 | + * caller must check. |
| 1398 | + * |
| 1399 | + * In case of WSREP_OK, transaction can proceed to commit. |
| 1400 | + * Otherwise transaction must rollback. |
| 1401 | + * |
| 1402 | + * In case of a failure there are two conceptually different situations: |
| 1403 | + * - the writeset was not ordered. In that case meta struct shall contain |
| 1404 | + * undefined GTID: WSREP_UUID_UNDEFINED:WSREP_SEQNO_UNDEFINED. |
| 1405 | + * - the writeset was successfully ordered, but failed certification. |
| 1406 | + * In this case meta struct shall contain a valid GTID. |
| 1407 | + * |
| 1408 | + * Regardless of the return code, if meta struct contains a valid GTID |
| 1409 | + * the commit order critical section must be entered with that GTID. |
| 1410 | + * |
| 1411 | + * This is an extension to the original certify() call with additional seq_cb |
| 1412 | + * parameter. The purpose of the seq_cb is to provide a callback to be |
| 1413 | + * called by the provider after the sequential consistency for the write set |
| 1414 | + * is guaranteed. |
| 1415 | + * |
| 1416 | + * @param wsrep provider handle |
| 1417 | + * @param conn_id connection ID |
| 1418 | + * @param ws_handle writeset of committing transaction |
| 1419 | + * @param flags fine tuning the replication WSREP_FLAG_* |
| 1420 | + * @param meta transaction meta data |
| 1421 | + * @param seq_cb callback for provider to call after ensuring sequential |
| 1422 | + consistency |
| 1423 | + * |
| 1424 | + * @retval WSREP_OK writeset successfully certified, can commit |
| 1425 | + * @retval WSREP_TRX_FAIL must rollback transaction |
| 1426 | + * @retval WSREP_CONN_FAIL must close client connection |
| 1427 | + * @retval WSREP_NODE_FAIL must close all connections and reinit |
| 1428 | + */ |
| 1429 | + |
| 1430 | +typedef wsrep_status_t (*wsrep_certify_fn_v1)(wsrep_t* wsrep, |
| 1431 | + wsrep_conn_id_t conn_id, |
| 1432 | + wsrep_ws_handle_t* ws_handle, |
| 1433 | + uint32_t flags, |
| 1434 | + wsrep_trx_meta_t* meta, |
| 1435 | + const wsrep_seq_cb_t* seq_cb); |
| 1436 | +#define WSREP_CERTIFY_V1 "wsrep_certify_v1" |
| 1437 | + |
1376 | 1438 | #ifdef __cplusplus
|
1377 | 1439 | }
|
1378 | 1440 | #endif
|
|
0 commit comments