FTP Replicator PostgreSQL Database

PostgreSQL is used to hold the status information for Replication.  The Database name is specified in the Python configuration.  There needs to be an instance of this database on both LOCAL and REMOTE locations.

Transmission Log

This is a PostgreSQL table ‘transmissionlog’ which holds the files that have been previously transmitted. It is used to indicate the files that are about to be transmitted.  The currents timestamp can be checked against the last edit time on a file to indicate whether a file needs to be retransmitted.

It has the following structure:-

 

Field

Type

Holds

Filename

Text

Fully pathed filename.

currentts

Timestamp without time zone

Last time file was modified.

Newts

Timestamp without time zone

Latest time file was modified.

action

Character(1)

Action (A=Addition, U=Update).

locale

Character(1)

Owner of the field (by default R=Remote, L=Local)

 

Status

This is a PostgreSQL table which holds the status of the current run for a location.

 

Field

Type

Holds

running

Bool

Whether a Run is running.

runnumber

Integer

The current/last run number.

status

Text

The status of the current run.

currentts

Timestamp without time zone

Timestamp of action.

exitstatus

Integer

The exit status of the last entity.

nextprocess

Text

The next entity to be run with its full parameter set.

commmode

Text

The communication mode being used, sync or async.

 

The status field is the name of the last part run, used to ensure that if L1->L2->L3 is the order, we do not run L1->L3 and assume we’re fine.  This also contains the fact that a process is currently running ‘L2 running’.

The nextprocess field holds what entity is to be run next when the current finishes with the full parameter set it would use.  This is necessary when running in Asynchronous mode to get the call that a REMOTE entity would have used.

PostgreSQL Configuration

In the pg_hba.conf file the authentication method for local connections needs to be trust, e.g.

Example
host all all 127.0.0.1/32 trust 

Where 127.0.0.1/32 means all connections originating from the PostgreSQL server itself.