0% found this document useful (0 votes)
12 views8 pages

Single DB Postgres Investigation and Troubleshooting Guide - V2

The document provides a troubleshooting guide for accessing and using a PostgreSQL database with DBeaver for a Cloud POS system. It outlines installation steps, common issues such as connection problems and RabbitMQ installation, and provides solutions for troubleshooting pending transactions and sales stuck in the database. Additionally, it includes diagnostic commands for RabbitMQ and solutions for TLS issues related to older Windows versions.

Uploaded by

onedan.vekaria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Single DB Postgres Investigation and Troubleshooting Guide - V2

The document provides a troubleshooting guide for accessing and using a PostgreSQL database with DBeaver for a Cloud POS system. It outlines installation steps, common issues such as connection problems and RabbitMQ installation, and provides solutions for troubleshooting pending transactions and sales stuck in the database. Additionally, it includes diagnostic commands for RabbitMQ and solutions for TLS issues related to older Windows versions.

Uploaded by

onedan.vekaria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Single DB Postgres - Cloud POS

Investigation & Troubleshooting Guide

Accessing the Database In Single DB


The database tool we have selected is a multi-platform DB tool called DBeaver. We used PGAdmin previously,
but DBeaver is portable and will be in the next upcoming POS updates as a pre-requisite that automatically
downloads.

In order to install the database UI tool, you can download this


ZIP file for now:
https://ftx-pos-assets.s3.amazonaws.com/DBeaver.zip

You will need to make the below folder in the Prerequisites


folder.
C:\ProgramData\Prerequisites\DBeaver

Once you have made that folder, you will need to now unzip
the contents so you see it appear like the image to the right.

Now you are able to open the EXE file which is a shortcut, and it should open the GUI for Postgres. The
connection details are already connected to localhost:5433 and the DB name ftx_pos.

Using the Database


In order to use the database, you will see the following hierarchy on the sidebar.

postgres -> Databases -> ftx_pos -> Schemas -> ftx_pos -> Tables

Navigation Of Tables
Once you are in here, you can view table details by double clicking, or you can look at specifics by using
arrows on the left of table name.
Running Queries
To run DB queries, you can click on the top navigation SQL
Editor and then press New SQL Script to open a query editor.

You can then type your queries, and you may need to prefix
tables with ftx_pos.table_name

If any column such as iniEntry has a capitalized letter, then


you can do a query like seen below:

select “iniEntry” from ftx_pos.table_name

The non-case queries do not need quotes around them, but they will work still regardless.

Example Query

Example of Double Clicking Table - Column and Table Definitions


Common Troubleshooting Scenarios
Below are some common troubleshooting scenarios based on recent findings on specific machines, or just
common practices you can follow below.

Installation Not Working - Rollback


If installation does not work, or you run into a show stopper or something does not work after finishing, please
uninstall the POS and you can install the version the customer has previously installed. The most recent public
installer is:
https://cc-aws-prod.s3.us-east-2.amazonaws.com/uploads/msi-manager/202308162.msi

If you do not have the other version available, reach out in the group but you can also look in their local
directory in: C:\ProgramData\FasTraxPOS\MsiDownload

NOTE: When rolling back, it is important that you remove the ftx_pos database using DBeaver before retrying
the migration day(s) later.

Postgres Cannot Connect


If the postgres throws an error about a host entry not defined, or the connection is not allowed from a specific
host, there is a chance the BAT file for setting up the host is not run successfully. This could be due to
permissions, or other reasons.

If that does not work, look into C:\Program Files (x86)\FasTraxPOS\FTX POS and see if the file
HostEntryConfig.bat. If the file does not exist, you can download from here:
https://ftx-pos-assets.s3.amazonaws.com/HostEntryConfig.bat

Open this up in the command line or run as administrator, and then restart the service postgres_service and
try again.

RabbitMQ Not Installed


In order for the POS to auto install rabbitMQ, the system can potentially be skipped because it requires admin
privileges. This means you may need to trigger the scripts manually.

There are 4 main files or areas to be aware of:

C:\ProgramData\FTX_RabbitMQ\RabbitMQ
The path above should exist, and have the rabbitMQ portable application inside of it. This is a sign that the
program has unzipped and if you see a db and log folder, it means it has started. This only generates when
the service starts running.

C:\ProgramData\Prerequisites\remove-mq.ps1
This file is used in an administrative powershell prompt, to forcefully remove all traces of RabbitMQ upon a
re-installation if needed. You can generally use this only if the installation script does not succeed by running
again.
C:\Program Files (x86)\FasTraxPOS\FTX POS\rabbitmq-install.bat
This file when ran as an administrator will trigger the installation process of RabbitMQ, but it relies on the ZIP
path to be extracted, as it uses the below folder:

C:\ProgramData\FTX_RabbitMQ\RabbitMQ\rabbitmq_server-3.11.10

Once you run this file, you can see the output in the below log file:

C:\ProgramData\Prerequisites\InstallRabbitMQ.log

C:\ProgramData\Prerequisites\rabbitmq_server-3.11.10.zip
If you look at this file above, if you were to delete it from the Prerequisites folder, it will trigger the POS to
download the file and start Prerequisite mode, which will run the installers again, and also unzips the folder.
You generally just need to open the POS for this process to start.

RabbitMQ Not Working in Background Service


If you see the background service not connecting, you will probably have to check if the service is installed and
opened.

The below error is a common example of a failed connection to RabbitMQ.

FTXCloudBackgroundService.exe Information: 0 : 12/20/2023 [7:17:15 AM] Information ====


RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable --->
System.AggregateException: One or more errors occurred. ---> RabbitMQ.Client.Exceptions.ConnectFailureException:
Connection failed ---> System.Net.Sockets.SocketException: No connection could be made because the target machine
actively refused it 192.168.1.79:5672

When debugging this, you can do the following steps:


1. Check to make sure service is installed
2. Check to make sure FTX_RabbitMQ and sub-folders are present
3. Check to make sure that the host http://localhost:15672/ is accessible
4. Try to login to the host using FTXAdmin / FTXPass and if successful, it's most likely on

If you still face issues after checking this, then I would suggest using the remove-mq.ps1 script and then
running the bat file in Program Files.

Make sure to run both operations as Administrator.

Issue with Sales in Pending Transactions


One of the common issues we found is that sales are stuck in the Transactions folder. If the sale fails to save
to Postgres, the natural course is to save it into the below folder:

C:\ProgramData\FasTraxPOS\Transactions

When a sale is finished saving, it goes into the Archive folder located in:

C:\ProgramData\FasTraxPOS\Transactions\Archive
Dealing with Pending Sales
First thing you need to do is find the source by looking at error logs. In the cases we saw, there was an error
like: “id” cannot be null which appeared in logs. We found this was due to the tmp_sale_item_taxes table.

If you look at the below “Default” section, it was shown empty on the client machines affected. It should look
like below.

If any of the tmp_sale_* tables do not have the default, this is a problem. Most every table actually has this, its
for auto-incrementing.

Fixing Stuck Sale Issue


The steps are fairly simple. They involve running a few queries to create the sequence and assign the default
auto incrementing, and then re-importing the sales.

There are sales in the DB usually with send_status = 3 which indicates a partially written sale. The statuses are
as follows:
Status # Description

0 Ready to Send to ControlCenter - Unsent

1 Successfully Sent to ControlCenter

3 Partially Written, Waiting for Rest of Child Tables (tmp_sale_items, tmp_sale_taxes, tmp_sale_tenders, etc) to write

5 Sale Waiting for Cash Drawerto Close (Smart Till Enabled) - Used to get final till values from drawer before sending
Steps to Repair

1. Run the create sequence query:

CREATE SEQUENCE tmp_sale_items_taxes_id_seq;

2. Go into tmp_sale_item_taxes using double click on the sidebar, and right-click the column
id and choose View Column.

Set the default value to the value below and press Save on the bottom right corner of the screen.

nextval('ftx_pos.tmp_sale_items_taxes_id_seq'::regclass)

3. Run the below queries to clear temp sales which were not fully written

delete from ftx_pos.tmp_sale_items where sale_id in (select id from ftx_pos.tmp_sale where send_status = 3);
delete from ftx_pos.tmp_sale_tender where sale_id in (select id from ftx_pos.tmp_sale where send_status = 3);
delete from ftx_pos.tmp_sale_taxes where sale_id in (select id from ftx_pos.tmp_sale where send_status = 3);
delete from ftx_pos.tmp_sale where send_status = 3;

4. Cut / Paste Archive Folder into Transactions folder

Cut all receipt files from:


C:\ProgramData\FasTraxPOS\Transactions\Archive

Into this folder:


C:\ProgramData\FasTraxPOS\Transactions
5. Open POS and go into POS Panels Screen
During this stage, go into the POS panels as this will trigger the sales to start writing into the local DB again.

You will probably see duplicate errors in the log, that is fine. After 5-10 minutes, sales will start populating in the
system and possibly also in Cloud. Verify that Cloud is receiving the sales on the day you are looking at, or
today.

Once done, all of the sales which finished, will move back into the Archive folder on their own. After a bit of
time, you will need to move all the files still left in the Transactions folder, back to the Archive folder.

RabbitMQ Diagnostics
In order to diagnose issues with RabbitMQ and the services, there are a few techniques to start with. There is
a set of BATCH files located in the below folder:
C:\ProgramData\FTX_RabbitMQ\RabbitMQ\rabbitmq_server-3.11.10\sbin

Diagnostic Command
The below command will be used to check the service status.
C:\ProgramData\FTX_RabbitMQ\RabbitMQ\rabbitmq_server-3.11.10\sbin\rabbitmq-diagnostics.bat
status

A successful response should look like below: Non-successful response should look like below:

Install Service Command


The below command allows you to install the RabbitMQ service on Windows.
C:\ProgramData\FTX_RabbitMQ\RabbitMQ\rabbitmq_server-3.11.10\sbin\rabbitmq-service.bat install

Remove Service Command


The below command allows you to remove the RabbitMQ service from Windows.
C:\ProgramData\FTX_RabbitMQ\RabbitMQ\rabbitmq_server-3.11.10\sbin\rabbitmq-service.bat remove
TLS 1.2 / 1.3 Issues
If you see the below messages when opening the POS and/or the background service, it indicates that TLS
support is out of date on the machine. Usually this is seen with older Windows versions, or x32 bit machines
we’ve noticed.

The request was aborted: Could not create SSL/TLS secure channel.

TLS Solution
The solution for this is added in the below REGISTRY file to download. The file in the link below will make sure
TLS 1.1, 1.2 and 1.3 are in the registry in the format needed from Adem’s findings

https://ftx-pos-assets.s3.amazonaws.com/ftx-tls.reg

Download and execute the registry file to apply the configurations needed to fix this issue. This may not work in
every machine, but should cover the majority of the cases we see this error from.

You might also like