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
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?
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)
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
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…
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
Is your issue resolved?
I am also getting this error, I am not doing migration but first-time deployment to k8s for the 3.15 version.
I am pointing to external postgresDB
time=“2021-06-24T15:35:11.694077275Z” level=fatal msg=“setup storage error: storage: migrate up error: Dirty database version 1. Fix and force version.”
When I look at my chirpstack-application-server.toml file, though, there is no marshaler key in the config file. If it is not set, does it default to “json_v3”? If I need to add it, what subsection should it be located in?