[ovs-dev] [PATCH v2 6/9] ovsdb: relay: Add support for transaction forwarding.

Ilya Maximets i.maximets at ovn.org
Mon Jul 12 22:59:21 UTC 2021


On 6/25/21 3:34 PM, Dumitru Ceara wrote:
> On 6/12/21 4:00 AM, Ilya Maximets wrote:
>> 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.
>>
>> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
>> ---
> 
> I have a tiny nit below, otherwise:
> 
> Acked-by: Dumitru Ceara <dceara at redhat.com>
> 

Thanks!

> [...]
> 
>> diff --git a/ovsdb/relay.c b/ovsdb/relay.c
>> index 5f423a0b9..ef689c649 100644
>> --- a/ovsdb/relay.c
>> +++ b/ovsdb/relay.c
>> @@ -32,6 +32,7 @@
>>  #include "row.h"
>>  #include "table.h"
>>  #include "transaction.h"
>> +#include "transaction-forward.h"
>>  #include "util.h"
>>  
>>  VLOG_DEFINE_THIS_MODULE(relay);
>> @@ -298,6 +299,7 @@ ovsdb_relay_run(void)
>>          struct relay_ctx *ctx = node->data;
>>          struct ovs_list events;
>>  
>> +        ovsdb_txn_forward_run(ctx->db, ctx->cs);
>>          ovsdb_cs_run(ctx->cs, &events);
>>  
>>          struct ovsdb_cs_event *event;
>> @@ -309,7 +311,9 @@ ovsdb_relay_run(void)
>>  
>>              switch (event->type) {
>>              case OVSDB_CS_EVENT_TYPE_RECONNECT:
>> -                /* Nothing to do. */
>> +                /* Cancelling all the transactions that was already sent but
> 
> Nit: s/was/were/
> 

OK.


More information about the dev mailing list