prserv nohist mode is broken - suggested fix included
Hi,
I've run into a strange problem where in some cases package version numbers would roll back. Eventually I tracked the issue to prserv apparently not doing the right thing when running in the default nohist mode.
As a simple example, I have this in PRMAIN_nohist:
version pkgarch checksum value
------------------------------------------------------------------------------
"beyonwiz-base-1.3-r0" "all" "d87bfea4ce066ec8b6041a8d3188956b" "43" "beyonwiz-base-1.3-r0" "all" "bba78fccad5b1b5ec9841a4002bd0252" "42"
I think the problem is the primary key used for the nohist table. It should not include the checksum column.
PRMAIN_nohistshould be created only with PRIMARY KEY(version,pkgarch)
To fix up an existing database, the following SQL code can be used:
CREATE TABLE PRMAIN_nohist2 (version TEXT NOT NULL, pkgarch TEXT NOT NULL, checksum TEXT NOT NULL, value INTEGER, PRIMARY KEY(version,pkgarch)); insert or replace into PRMAIN_nohist2 (version, pkgarch, checksum, value) select version, pkgarch, checksum, value from PRMAIN_nohist order by value; drop table PRMAIN_nohist ;
alter table PRMAIN_nohist2 rename to PRMAIN_nohist ;
Cheers,
Peter
Quoted 17 lines · Peter Urbanec
Hi,
I've run into a strange problem where in some cases package version numbers would roll back. Eventually I tracked the issue to prserv apparently not doing the right thing when running in the default nohist mode.
As a simple example, I have this in
PRMAIN_nohist:version pkgarch checksum
value
------------------------------------------------------------------------------
"beyonwiz-base-1.3-r0" "all" "d87bfea4ce066ec8b6041a8d3188956b"
"43"
"beyonwiz-base-1.3-r0" "all" "bba78fccad5b1b5ec9841a4002bd0252"
"42"
Quoted 2 lines
I think the problem is the primary key used for the nohist table. It should not include the checksum column.
I don't understand how the above shows a problem? Can you give an example workload where the version number goes backwards or explain the problem a bit more?
Even though the primary key is (version,pkgarch,checksum), it should do an insert or replace and therefore although that key has to be unique, it should replace an entry with a higher value?
Also, was sstate involved in the state rolling back? I have seen cases where sstate was restored and versions did roll back...
Cheers,
Richard