Skip to content

Commit 9dd8571

Browse files
committed
Merge remote-tracking branch 'origin/v26'
2 parents 17fe7b0 + 65608d3 commit 9dd8571

File tree

3 files changed

+198
-1
lines changed

3 files changed

+198
-1
lines changed

CONTRIBUTORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Authors from Codership Oy:
2121
* Alexey Yurchenko <[email protected]>, Codership Oy
2222
* Mario Karuza <[email protected]>, Codership Oy
2323
* Daniele Sciascia <[email protected]>, Codership Oy
24+
* Jan Lindström <[email protected]>, Codership Oy
2425
[Codership employees, add name and email/username above this line, but leave this line intact]
2526

2627
Other contributors:

wsrep_api.h

+63-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2009-2013 Codership Oy <[email protected]>
1+
/* Copyright (C) 2009-2024 Codership Oy <[email protected]>
22
33
This program is free software; you can redistribute it and/or modify
44
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);
13731373
*/
13741374
void wsrep_unload(wsrep_t* hptr);
13751375

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+
13761438
#ifdef __cplusplus
13771439
}
13781440
#endif

wsrep_connection_monitor_service.h

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
* Copyright (C) 2024-2025 Codership Oy <[email protected]>
3+
*
4+
* This file is part of wsrep-API.
5+
*
6+
* Wsrep-API is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 2 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Wsrep-API is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with wsrep-API. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
/** @file wsrep_connection_monitor_service.h
21+
*
22+
* This file defines interface for connection monitor service
23+
*
24+
* The provider which is capable of using the service interface v1 must
25+
* export the following functions.
26+
*
27+
* int wsrep_init_connection_monitor_service_v1(wsrep_connection_monitor_service_v1_t*)
28+
* void wsrep_deinit_connection_monitor_service_v1()
29+
*
30+
* which can be probed by the application.
31+
*
32+
* The application must initialize the service via above init function
33+
* before the provider is initialized via wsrep->init(). The deinit
34+
* function must be called after the provider side resources have been
35+
* released via wsrep->free().
36+
*/
37+
38+
#ifndef WSREP_CONNECTION_MONITOR_SERVICE_H
39+
#define WSREP_CONNECTION_MONITOR_SERVICE_H
40+
41+
#include "wsrep_api.h"
42+
43+
#ifdef __cplusplus
44+
extern "C"
45+
{
46+
#endif /* __cplusplus */
47+
48+
/**
49+
* Type tag for application defined connection monitoring processing context.
50+
*
51+
* Application may pass pointer to the context when initializing
52+
* the connection monitor service. This pointer is passed a first parameter for
53+
* each service call.
54+
*/
55+
typedef struct wsrep_connection_monitor_context wsrep_connection_monitor_context_t;
56+
57+
typedef const void* wsrep_connection_key_t;
58+
59+
/*
60+
* Connection monitor connection update callbacks.
61+
*
62+
*/
63+
64+
/*
65+
* Connection connect callback.
66+
*
67+
* @param id connection identifier
68+
* @param scheme connection scheme (tcp, ssl)
69+
* @param local_address local address string
70+
* @param remote_address remote address string
71+
*/
72+
typedef void (*wsrep_connection_monitor_connect_cb_t)(
73+
wsrep_connection_monitor_context_t*,
74+
wsrep_connection_key_t id,
75+
const wsrep_buf_t* scheme,
76+
const wsrep_buf_t* local_address,
77+
const wsrep_buf_t* remote_address);
78+
79+
/*
80+
* Connection disconnect callback.
81+
*
82+
* @param id connection identifier
83+
*/
84+
typedef void (*wsrep_connection_monitor_disconnect_cb_t)(
85+
wsrep_connection_monitor_context_t*,
86+
wsrep_connection_key_t id);
87+
88+
/*
89+
* Connection SSL/TLS info callback.
90+
*
91+
* @param id connection identifier
92+
* @param cipher cipher suite name
93+
* @param certificate_subject certificate subject name
94+
* @param certificate_issuer certificate issuer name
95+
* @param version SSL/TLS version string
96+
*/
97+
typedef void (*wsrep_connection_monitor_ssl_info_cb_t)(
98+
wsrep_connection_monitor_context_t*,
99+
wsrep_connection_key_t id,
100+
const wsrep_buf_t* cipher,
101+
const wsrep_buf_t* certificate_subject,
102+
const wsrep_buf_t* certificate_issuer,
103+
const wsrep_buf_t* version);
104+
105+
/**
106+
* Connection monitor service struct.
107+
*
108+
* A pointer to this struct must be passed to the call to
109+
* wsrep_init_connection_monitor_service_v1.
110+
*
111+
* The application must provide implementation to all functions defined
112+
* in this struct.
113+
*/
114+
typedef struct wsrep_connection_monitor_service_v1_st
115+
{
116+
/* Connection monitor connect callback */
117+
wsrep_connection_monitor_connect_cb_t connection_monitor_connect_cb;
118+
/* Connection monitor disconnect callback */
119+
wsrep_connection_monitor_disconnect_cb_t connection_monitor_disconnect_cb;
120+
/* Connection monitor ssl info callback */
121+
wsrep_connection_monitor_ssl_info_cb_t connection_monitor_ssl_info_cb;
122+
/* Pointer to application defined connection monitor context. */
123+
wsrep_connection_monitor_context_t* context;
124+
} wsrep_connection_monitor_service_v1_t;
125+
126+
#ifdef __cplusplus
127+
}
128+
#endif /* __cplusplus */
129+
130+
131+
#define WSREP_CONNECTION_MONITOR_SERVICE_INIT_FUNC_V1 "wsrep_init_connection_monitor_service_v1"
132+
#define WSREP_CONNECTION_MONITOR_SERVICE_DEINIT_FUNC_V1 "wsrep_deinit_connection_monitor_service_v1"
133+
134+
#endif /* WSREP_CONNECTION_MONITOR_SERVICE_H */

0 commit comments

Comments
 (0)