summaryrefslogtreecommitdiff
path: root/ovsdb/ovsdb.h
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2021-04-15 19:05:40 +0200
committerIlya Maximets <i.maximets@ovn.org>2021-07-15 22:38:07 +0200
commit7964ffe7d2bfd35b08c221ad1c3c04dc4403b6f1 (patch)
tree58d6bcee6d997214646d64a08cf2c91cf3905856 /ovsdb/ovsdb.h
parent026c77c58ddba12ad81082ca27564ab9c33986bd (diff)
downloadopenvswitch-7964ffe7d2bfd35b08c221ad1c3c04dc4403b6f1.tar.gz
ovsdb: relay: Add support for transaction forwarding.
Current version of ovsdb relay allows to scale out read-only access to the primary database. However, many clients are not read-only but read-mostly. For example, ovn-controller. In order to scale out database access for this case ovsdb-server need to process transactions that are not read-only. Relay is not allowed to do that, i.e. not allowed to modify the database, but it can act like a proxy and forward transactions that includes database modifications to the primary server and forward replies back to a client. At the same time it may serve read-only transactions and monitor requests by itself greatly reducing the load on primary server. This configuration will slightly increase transaction latency, but it's not very important for read-mostly use cases. Implementation details: With this change instead of creating a trigger to commit the transaction, ovsdb-server will create a trigger for transaction forwarding. Later, ovsdb_relay_run() will send all new transactions to the relay source. Once transaction reply received from the relay source, ovsdb-relay module will update the state of the transaction forwarding with the reply. After that, trigger_run() will complete the trigger and jsonrpc_server_run() will send the reply back to the client. Since transaction reply from the relay source will be received after all the updates, client will receive all the updates before receiving the transaction reply as it is in a normal scenario with other database models. Acked-by: Mark D. Gray <mark.d.gray@redhat.com> Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb/ovsdb.h')
-rw-r--r--ovsdb/ovsdb.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/ovsdb/ovsdb.h b/ovsdb/ovsdb.h
index 16bd5f5ec..4a7bd0f0e 100644
--- a/ovsdb/ovsdb.h
+++ b/ovsdb/ovsdb.h
@@ -93,7 +93,11 @@ struct ovsdb {
struct ovs_list txn_history; /* Contains "struct ovsdb_txn_history_node. */
/* Relay mode. */
- bool is_relay;
+ bool is_relay; /* True, if database is in relay mode. */
+ /* List that holds transactions waiting to be forwarded to the server. */
+ struct ovs_list txn_forward_new;
+ /* Hash map for transactions that are already sent and waits for reply. */
+ struct hmap txn_forward_sent;
};
struct ovsdb *ovsdb_create(struct ovsdb_schema *, struct ovsdb_storage *);
@@ -107,7 +111,7 @@ struct ovsdb_txn *ovsdb_execute_compose(
struct ovsdb *, const struct ovsdb_session *, const struct json *params,
bool read_only, const char *role, const char *id,
long long int elapsed_msec, long long int *timeout_msec,
- bool *durable, struct json **);
+ bool *durable, bool *forwarding_needed, struct json **);
struct json *ovsdb_execute(struct ovsdb *, const struct ovsdb_session *,
const struct json *params, bool read_only,