Stub remote server latency (WIP)

This commit is contained in:
Rafa de la Torre 2019-11-11 16:37:27 +01:00
parent 944b111bb1
commit 1c27443ff4
2 changed files with 18 additions and 1 deletions

View File

@ -97,6 +97,18 @@ AS $$
$$
LANGUAGE SQL VOLATILE PARALLEL UNSAFE;
--
-- Get the network latency to a remote PG server
--
CREATE OR REPLACE FUNCTION @extschema@.__CDB_FS_Foreign_Server_Latency_PG(server_internal name)
RETURNS float
AS $$
BEGIN
RETURN 0.0;
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
--
-- Collect and return diagnostics info from a remote PG into a jsonb
@ -108,11 +120,13 @@ DECLARE
remote_server_version text := @extschema@.__CDB_FS_Foreign_Server_Version_PG(server_internal);
remote_postgis_version text := @extschema@.__CDB_FS_Foreign_PostGIS_Version_PG(server_internal);
remote_server_options jsonb := @extschema@.__CDB_FS_Foreign_Server_Options_PG(server_internal);
remote_server_latency float := @extschema@.__CDB_FS_Foreign_Server_Latency_PG(server_internal);
BEGIN
RETURN jsonb_build_object(
'server_version', remote_server_version,
'postgis_version', remote_postgis_version,
'server_options', remote_server_options
'server_options', remote_server_options,
'server_latency', remote_server_latency
);
END
$$

View File

@ -57,6 +57,9 @@ SELECT '1.5', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @>
\echo '%% It returns the remote server options'
SELECT '1.6', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @> '{"server_options": {"host": "localhost", "port": "@@PGPORT@@", "updatable": "false", "extensions": "postgis", "fetch_size": "1000", "use_remote_estimate": "true"}}'::jsonb;
\echo '%% It returns the network latency to the remote server'
SELECT '1.7', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @> '{"server_latency": 0.0}'::jsonb;
-- ===================================================================
-- Cleanup