2018-01-24 14:28:48 +00:00
|
|
|
|
|
|
|
/*
|
2018-03-12 14:03:15 +00:00
|
|
|
* Odyssey.
|
2018-01-24 14:28:48 +00:00
|
|
|
*
|
2018-04-04 13:19:58 +00:00
|
|
|
* Scalable PostgreSQL connection pooler.
|
2018-01-24 14:28:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2018-08-28 14:43:46 +00:00
|
|
|
#include <ctype.h>
|
2018-01-24 14:28:48 +00:00
|
|
|
#include <inttypes.h>
|
2018-08-28 14:43:46 +00:00
|
|
|
#include <assert.h>
|
2018-01-24 14:28:48 +00:00
|
|
|
|
|
|
|
#include <machinarium.h>
|
2018-08-28 14:43:46 +00:00
|
|
|
#include <kiwi.h>
|
|
|
|
#include <odyssey.h>
|
2018-01-24 14:28:48 +00:00
|
|
|
|
2018-12-12 13:07:25 +00:00
|
|
|
int od_deploy(od_client_t *client, char *context)
|
2018-01-24 14:28:48 +00:00
|
|
|
{
|
2018-12-12 13:07:25 +00:00
|
|
|
od_instance_t *instance = client->global->instance;
|
|
|
|
od_server_t *server = client->server;
|
2019-04-11 09:15:02 +00:00
|
|
|
od_route_t *route = client->route;
|
2018-08-28 14:43:46 +00:00
|
|
|
|
2018-12-12 13:07:25 +00:00
|
|
|
/* compare and set options which are differs from server */
|
2018-12-13 11:18:20 +00:00
|
|
|
int query_count;
|
|
|
|
query_count = 0;
|
|
|
|
|
2018-02-05 13:39:20 +00:00
|
|
|
char query[512];
|
2018-12-12 13:07:25 +00:00
|
|
|
int query_size;
|
2018-12-13 11:18:20 +00:00
|
|
|
query_size = kiwi_vars_cas(&client->vars, &server->vars, query,
|
|
|
|
sizeof(query) - 1);
|
2019-04-11 09:15:02 +00:00
|
|
|
if (query_size > 0 && !route->id.physical_rep)
|
2018-12-12 13:07:25 +00:00
|
|
|
{
|
|
|
|
query[query_size] = 0;
|
|
|
|
query_size++;
|
2018-12-13 11:18:20 +00:00
|
|
|
machine_msg_t *msg;
|
2019-01-23 15:43:52 +00:00
|
|
|
msg = kiwi_fe_write_query(NULL, query, query_size);
|
2018-08-28 14:43:46 +00:00
|
|
|
if (msg == NULL)
|
|
|
|
return -1;
|
2018-12-13 11:18:20 +00:00
|
|
|
int rc;
|
2019-01-23 15:43:52 +00:00
|
|
|
rc = od_write(&server->io, msg);
|
2018-02-05 13:39:20 +00:00
|
|
|
if (rc == -1)
|
|
|
|
return -1;
|
2018-12-12 13:07:25 +00:00
|
|
|
query_count++;
|
|
|
|
|
|
|
|
od_debug(&instance->logger, context, client, server,
|
2018-12-13 11:18:20 +00:00
|
|
|
"deploy: %s", query);
|
2018-02-05 13:39:20 +00:00
|
|
|
}
|
2018-08-28 14:43:46 +00:00
|
|
|
|
2018-02-05 13:39:20 +00:00
|
|
|
return query_count;
|
|
|
|
}
|