codership / wsrep-API

Write Set Replication API specification
GNU General Public License v2.0
26 stars 15 forks source link

API v26 - expand enum wsrep_key_type to contain 4 members #31

Closed ayurchen closed 5 years ago

ayurchen commented 6 years ago

This is part of implementation of https://github.com/codership/Engineering/wiki/Foreign_Key_Optimization_Combined Currently (v25) wsrep_key_type looks as follows:

/*! Key type:
 *  EXCLUSIVE conflicts with any key type
 *  SEMI      reserved. If not supported, should be interpreted as EXCLUSIVE
 *  SHARED    conflicts only with EXCLUSIVE keys */
typedef enum wsrep_key_type
{
    WSREP_KEY_SHARED = 0,
    WSREP_KEY_SEMI,
    WSREP_KEY_EXCLUSIVE
} wsrep_key_type_t;

where WSREP_KEY_SEMI was intended to stand for "semi-exclusive" keys, but had to be hijacked to stand for "strictly shared" key type that was needed to solve customer's issues with collision on FKs. For the sake of preserving the API it was not renamed.

Final implementation of https://github.com/codership/Engineering/wiki/Foreign_Key_Optimization_Combined requires 4 key types. Since it involves changing the API we can adopt better, perhaps more intuitive IDs for the members. This is the suggestion:

typedef enum wsrep_key_type
{
    WSREP_KEY_SHARED = 0,
    WSREP_KEY_REFERENCE,
    WSREP_KEY_UPDATE.
    WSREP_KEY_EXCLUSIVE
} wsrep_key_type_t;

where WSREP_KEY_REFERENCE will stand for "strictly shared" and WSREP_KEY_UPDATE - for "semi-exclusive" (notice that both "strictly shared" and "semi-exclusive" were themselves very poorly chosen terms for lack of better ideas)

ayurchen commented 5 years ago

merged into main branch