5 Commits

Author SHA1 Message Date
Brian Rowe
79fb46456f Rename server to data node
The timescale clustering code so far has been written referring to the
remote databases as 'servers'.  This terminology is a bit overloaded,
and in particular we don't enforce any network topology limitations
that the term 'server' would suggest.  In light of this we've decided
to change to use the term 'node' when referring to the different
databases in a distributed database.  Specifically we refer to the
frontend as an 'access node' and to the backends as 'data nodes',
though we may omit the access or data qualifier where it's unambiguous.

As the vast bulk of the code so far has been written for the case where
there was a single access node, almost all instances of 'server' were
references to data nodes.  This change has updated the code to rename
those instances.
2020-05-27 17:31:09 +02:00
Brian Rowe
5c643e0ac4 Add distributed group id and enforce topology
This change adds a distributed database id to the installation data for a
database.  It also provides a number of utilities that can be used for
getting/setting/clearing this value or using it to determing if a database is
a frontend, backend, or not a member of distributed database.

This change also includes modifications to the add_server and delete_server
functions to check the distributed id to ensure the operation is allowed, and
then update or clear it appropriately.  After this changes it will no longer
be possible to add a database as a backend to multiple frontend databases, nor
will it be possible to add a frontend database as a backend to any other
database.
2020-05-27 17:31:09 +02:00
Dmitry Simonenko
d8982c3e15 Add add_server() support for remote server bootstrapping
This patch adds functionality for automatic database and extension
creation on remote server. New function arguments: bootstrap_database, bootstrap_user
and bootstrap_password.
2020-05-27 17:31:09 +02:00
Matvey Arye
f5a09913e1 Make heal safe to non-timescale prepared txns
To make the heal function safe to non-ts prepared txns we
introduce a prefix "ts" to our prepared txns. This allows
us to separate cases where there is a ts vs non-ts prepared txn
and have heal ignore non-ts txns.

An alternative would be to consider all txns that don't parse
correctly as non-ts transactions. But, that is less robust to
bugs in our parsing/printing code.

One downside to the current approach is that all prepared txns
with a "ts" prefix are considered reserved for ts. That
should be acceptable.
2020-05-27 17:31:09 +02:00
Matvey Arye
e7ba327f4c Add resolve and heal infrastructure for 2PC
This commit adds the ability to resolve whether or not 2PC
transactions have been committed or aborted and also adds a heal
function to resolve transactions that have been prepared but not
committed or rolled back.

This commit also removes the server id of the primary key on the
remote_txn table and adds another index. This was done because the
`remote_txn_persistent_record_exists` should not rely on the server
being contacted but should rather just check for the existance of the
id. This makes the resolution safe to setups where two frontend server
definitions point to the same database. While this may not be a
properly configured setup, it's better if the resolution process is
robust to this case.
2020-05-27 17:31:09 +02:00