Database Migration from 3.14 to 3.15

Hi.

I am trying to upgrade to version 3.15 of the application server and I have a database migration issue. All Chirpstack components are running in containers. Previous image tag for the AS was 3.14 and new one is 3.15. Post the upgrade, I get the following error in the logs.

time=“2021-05-26T07:02:46.789333454Z” level=info msg=“integration/postgresql: applying PostgreSQL schema migrations”
time=“2021-05-26T07:02:46.981739838Z” level=fatal msg=“setup integration error: new integration error: integration/postgresql: migrate up error: Dirty database version 2. Fix and force version.”
time=“2021-05-26T07:02:48.522121313Z” level=info msg=“starting ChirpStack Application Server” docs=“https://www.chirpstack.io/” version=3.15.0

If I revert back to 3.14 I dont get the error but there seems to be some compatibility issues between AS 3.14 and NS 3.13 which I am now on. I also cant roll back to NS 3.12 as I get other errors now

Please, how would I go about troubleshooting this and fixing the databse migration to 3.15

Thank you for your help

1 Like

time=“2021-05-26T07:02:46.981739838Z” level=fatal msg=“setup integration error: new integration error: integration/postgresql: migrate up error: Dirty database version 2. Fix and force version.”

Are you using the same database for your PostgreSQL integration as the ChirpStack Application Server?

Hi.

I am using seperate databases for the two. ‘chirpstack_as’ and ‘chirpstack_as_events’ as suggested in the tutorial.

Thank you

Ok, that is good :slightly_smiling_face:

Could you try running migration 2 by hand on the _events database? It is marked as dirty, meaning something failed in the migration process of that migration. If the migration was already partially applied, you might seen an error that one of the columns already exists.

You will find the content of this migration here:

If these changes have been applied, please check the schema_migrations table in the same database.

I expect it looks like this:

chirpstack_as_events=> select * from schema_migrations ;
 version | dirty 
---------+-------
       2| t
(1 row)

Set dirty to f and restart the ChirpStack Application Server. The expected content of this table after a successful migration is:

chirpstack_as_events=> select * from schema_migrations ;
 version | dirty 
---------+-------
       4 | f
(1 row)
1 Like

Great, Thank you.

I did as you suggested and saw an error in the logs due to the the integration user not being an owner on one of the _events tables. This might have broken the previous migration. I fixed it, restarted 3.15 and all is working well. I have set the dirty tag back to f for future system upgrades

Thanks again

1 Like

Hi.

I am postingthis here as I am not sure if it is a carry over of the same issue. If not, I can create a new thread.

I am now getting the below error quite frequently.

time=“2021-05-27T13:35:36.087983118Z” level=error msg=“integration/multi: integration error” ctx_id=82386e9e-1e26-4aac-b0e9-b056a9a5fd14 error=“marshal rx_info error: unknown message type: *gw.UplinkRXInfo” integration="*postgresql.Integration"

Is this related to a bad database migration?

Thank you

Hi.

Did you find the solution to this problem.
I am facing the same issue.

My schema_migrations looks correct, and I got the fields. dev_addr bytea and confirmed_uplink
But I am not seeing any new data stored in the database.
I can see the device under application is getting new data. But it is not stored in the Database.

After update my postgres integration does not work. I would like to know if anyone has the steps to solve this problem. Structure of my dvice_up table…
image

I fixed my problem today.
The error was describes in this thread

Postgre integration / gw.UplinkRXInfo - #4 by miimote
In chirpstack-application-server.toml, if you have
marshaler=“json_v3”
you will get the related error. You must change to
marshaler=“json”
as it was advised in the comments of configuration file.

My problem was that I used locate chirpstack-application-server.toml but I was not Super User.
So I only saw a version in my users home folder. And this was not the one that Chirpstack-application-server was using.
When I did a

sudo locate chirpstack-application-server.toml

This show me a version af the file in
/etc/chirpstack-application-server/chirpstack-application-server.toml

And when I changed marshaler to json and ran

sudo systemctl restart chirpstack-application-server

I then again got the packages saved in the database.

Hopes this helps you

Thanks so much. I will attempt that too.

Regards