Bug 838190 - Repodata is not being generated correctly. Error: WrappedSQLException: ERROR: column p.installed_size does not exist
Repodata is not being generated correctly. Error: WrappedSQLException: ERROR...
Status: CLOSED NOTABUG
Product: Spacewalk
Classification: Community
Component: Server (Show other bugs)
1.7
All All
medium Severity medium
: ---
: ---
Assigned To: Marcelo Moreira de Mello
Red Hat Satellite QA List
:
Depends On:
Blocks: space18
  Show dependency treegraph
 
Reported: 2012-07-06 22:02 EDT by Marcelo Moreira de Mello
Modified: 2012-11-01 12:23 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-09 15:26:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marcelo Moreira de Mello 2012-07-06 22:02:33 EDT
Description of problem:

Repodata is not being generated as expected due error on SQL used by Taskomatic. 


INFO   | jvm 1    | 2012/07/06 22:46:01 | 2012-07-06 22:46:01,599 [Thread-306] ERROR com.redhat.rhn.taskomatic.task.ChannelRepodata - com.redhat.rhn.common.db.WrappedSQLException: ERROR: column p.installed_size does not exist
INFO   | jvm 1    | 2012/07/06 22:46:04 | 2012-07-06 22:46:04,559 [Thread-305] ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error while processing cached statement sql: SELECT /*+ ORDERED */ p.id, pn.name as name, pevr.epoch as epoch,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          pevr.version as version, pevr.release as release,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          p.summary, p.description, pa.label as arch_label,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          p.build_time, p.path, p.package_size, p.payload_size, p.installed_size,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          p.copyright, p.vendor, p.build_host, p.header_start, p.header_end,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          srpm.name as source_rpm, pg.name as package_group_name,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          cs.checksum, cs.checksum_type as checksum_type,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          prd.primary_xml as primary_xml, prd.filelist as filelist_xml, prd.other as other_xml
INFO   | jvm 1    | 2012/07/06 22:46:04 |     FROM
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnChannelPackage cp,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnPackage p
INFO   | jvm 1    | 2012/07/06 22:46:04 |             LEFT OUTER JOIN rhnPackageGroup pg ON p.package_group = pg.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |             LEFT OUTER JOIN rhnSourceRpm srpm  ON p.source_rpm_id = srpm.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |             LEFT JOIN rhnPackageRepodata prd ON prd.package_id = p.id,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnPackageName pn,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnPackageEvr pevr,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnPackageArch pa,
INFO   | jvm 1    | 2012/07/06 22:46:04 |          rhnChecksumView cs
INFO   | jvm 1    | 2012/07/06 22:46:04 |     WHERE
INFO   | jvm 1    | 2012/07/06 22:46:04 |          cp.package_id = p.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |          AND p.name_id = pn.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |          AND p.evr_id = pevr.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |          AND p.package_arch_id = pa.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |          AND cp.channel_id = ?
INFO   | jvm 1    | 2012/07/06 22:46:04 |          AND p.checksum_id = cs.id
INFO   | jvm 1    | 2012/07/06 22:46:04 |     ORDER by 1
INFO   | jvm 1    | 2012/07/06 22:46:04 | com.redhat.rhn.common.db.WrappedSQLException: ERROR: column p.installed_size does not exist
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.translation.SqlExceptionTranslator.postgreSqlException(SqlExceptionTranslator.java:54)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.translation.SqlExceptionTranslator.sqlException(SqlExceptionTranslator.java:44)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.NamedPreparedStatement.execute(NamedPreparedStatement.java:141)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.CachedStatement.execute(CachedStatement.java:453)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.CachedStatement.execute(CachedStatement.java:430)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.CachedStatement.execute(CachedStatement.java:336)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.CachedStatement.execute(CachedStatement.java:341)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.CachedStatement.execute(CachedStatement.java:281)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.datasource.SelectMode.execute(SelectMode.java:109)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.manager.task.TaskManager.getChannelPackageDtos(TaskManager.java:50)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.taskomatic.task.repomd.RpmRepositoryWriter.writeRepomdFiles(RpmRepositoryWriter.java:170)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.taskomatic.task.repomd.ChannelRepodataWorker.run(ChannelRepodataWorker.java:104)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:761)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at java.lang.Thread.run(Thread.java:679)
INFO   | jvm 1    | 2012/07/06 22:46:04 | Caused by: org.postgresql.util.PSQLException: ERROR: column p.installed_size does not exist
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:343)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:362)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	at com.redhat.rhn.common.db.NamedPreparedStatement.execute(NamedPreparedStatement.java:138)
INFO   | jvm 1    | 2012/07/06 22:46:04 | 	... 11 more
INFO   | jvm 1    | 2012/07/06 22:46:04 | 2012-07-06 22:46:04,559 [Thread-305] ERROR com.redhat.rhn.taskomatic.task.ChannelRepodata - com.redhat.rhn.common.db.WrappedSQLException: ERROR: column p.installed_size does not exist


Version-Release number of selected component (if applicable):
# rpm -q spacewalk-java
spacewalk-java-1.8.104-1.el6.noarch

# rpm -q spacewalk-schema
spacewalk-schema-1.8.58-1.el6.noarch

# spacewalk-schema-upgrade 
Schema upgrade: [spacewalk-schema-1.8.58-1.el6] -> [spacewalk-schema-1.8.58-1.el6]
Your database schema already matches the schema package version [spacewalk-schema-1.8.58-1.el6].



How reproducible:
100%


Steps to Reproduce:
1.
2.
3.
  
Actual results:

 Repodata is not being generated correctly

Expected results:

  Repodata be generated as expected
Comment 1 Marcelo Moreira de Mello 2012-07-06 22:04:56 EDT
  ** Looking the SQL



java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
---------------------
573 <mode name="repomdgenerator_channel_packages"
574     class="com.redhat.rhn.frontend.dto.PackageDto">
575    <query params="channel_id">
576   SELECT /*+ ORDERED */ p.id, pn.name as name, pevr.epoch as epoch,
577          pevr.version as version, pevr.release as release,
578          p.summary, p.description, pa.label as arch_label,
579          p.build_time, p.path, p.package_size, p.payload_size, p.installed_size,
580          p.copyright, p.vendor, p.build_host, p.header_start, p.header_end,
581          srpm.name as source_rpm, pg.name as package_group_name,
582          cs.checksum, cs.checksum_type as checksum_type,
583          prd.primary_xml as primary_xml, prd.filelist as filelist_xml, prd.other as other_xml
584     FROM
585          rhnChannelPackage cp,
586          rhnPackage p
587             LEFT OUTER JOIN rhnPackageGroup pg ON p.package_group = pg.id
588             LEFT OUTER JOIN rhnSourceRpm srpm  ON p.source_rpm_id = srpm.id
589             LEFT JOIN rhnPackageRepodata prd ON prd.package_id = p.id,
590          rhnPackageName pn,
591          rhnPackageEvr pevr,
592          rhnPackageArch pa,
593          rhnChecksumView cs
594     WHERE
595          cp.package_id = p.id
596          AND p.name_id = pn.id
597          AND p.evr_id = pevr.id
598          AND p.package_arch_id = pa.id
599          AND cp.channel_id = :channel_id
600          AND p.checksum_id = cs.id
601     ORDER by 1
602    </query>
603 </mode>


  Checking the rhnpackage table:

spaceschema=# \d+ rhnpackage;
                                    Table "public.rhnpackage"
     Column      |            Type             |       Modifiers        | Storage  | Description 
-----------------+-----------------------------+------------------------+----------+-------------
 id              | numeric                     | not null               | main     | 
 org_id          | numeric                     |                        | main     | 
 name_id         | numeric                     | not null               | main     | 
 evr_id          | numeric                     | not null               | main     | 
 package_arch_id | numeric                     | not null               | main     | 
 package_group   | numeric                     |                        | main     | 
 rpm_version     | character varying(16)       |                        | extended | 
 description     | character varying(4000)     |                        | extended | 
 summary         | character varying(4000)     |                        | extended | 
 package_size    | numeric                     | not null               | main     | 
 payload_size    | numeric                     |                        | main     | 
 build_host      | character varying(256)      |                        | extended | 
 build_time      | timestamp without time zone |                        | plain    | 
 source_rpm_id   | numeric                     |                        | main     | 
 checksum_id     | numeric                     | not null               | main     | 
 vendor          | character varying(64)       | not null               | extended | 
 payload_format  | character varying(32)       |                        | extended | 
 compat          | smallint                    | default 0              | plain    | 
 path            | character varying(1000)     |                        | extended | 
 header_sig      | character varying(64)       |                        | extended | 
 copyright       | character varying(128)      |                        | extended | 
 cookie          | character varying(128)      |                        | extended | 
 last_modified   | timestamp with time zone    | not null default now() | plain    | 
 created         | timestamp with time zone    | not null default now() | plain    | 
 modified        | timestamp with time zone    | not null default now() | plain    | 
 header_start    | numeric                     | not null default (-1)  | main     | 
 header_end      | numeric                     | not null default (-1)  | main     |
Comment 2 Marcelo Moreira de Mello 2012-07-06 22:08:28 EDT

  Reproducing the issue manually: 

spaceschema-#   SELECT /*+ ORDERED */ p.id, pn.name as name, pevr.epoch as epoch,
spaceschema-#          pevr.version as version, pevr.release as release,
spaceschema-#          p.summary, p.description, pa.label as arch_label,
spaceschema-#          p.build_time, p.path, p.package_size, p.payload_size, p.installed_size,
spaceschema-#          p.copyright, p.vendor, p.build_host, p.header_start, p.header_end,
spaceschema-#          srpm.name as source_rpm, pg.name as package_group_name,
spaceschema-#          cs.checksum, cs.checksum_type as checksum_type,
spaceschema-#          prd.primary_xml as primary_xml, prd.filelist as filelist_xml, prd.other as other_xml
spaceschema-#     FROM
spaceschema-#          rhnChannelPackage cp, 
spaceschema-#          rhnPackage p
spaceschema-#             LEFT OUTER JOIN rhnPackageGroup pg ON p.package_group = pg.id
spaceschema-#             LEFT OUTER JOIN rhnSourceRpm srpm  ON p.source_rpm_id = srpm.id
spaceschema-#             LEFT JOIN rhnPackageRepodata prd ON prd.package_id = p.id,
spaceschema-#          rhnPackageName pn, 
spaceschema-#          rhnPackageEvr pevr,
spaceschema-#          rhnPackageArch pa, 
spaceschema-#          rhnChecksumView cs
spaceschema-#     WHERE
spaceschema-#          cp.package_id = p.id
spaceschema-#          AND p.name_id = pn.id
spaceschema-#          AND p.evr_id = pevr.id
spaceschema-#          AND p.package_arch_id = pa.id
spaceschema-#          AND cp.channel_id = 101
spaceschema-#          AND p.checksum_id = cs.id
spaceschema-#     ORDER by 1;
ERROR:  column p.installed_size does not exist
LINE 4: ...ild_time, p.path, p.package_size, p.payload_size, p.install
Comment 3 Marcelo Moreira de Mello 2012-07-06 22:16:46 EDT

  Investigating the schema changes, installed_size was introduced by commit fd1e71ef69b1c5a7d8b99a836e1b291ab5654f15

commit fd1e71ef69b1c5a7d8b99a836e1b291ab5654f15
Author: Joshua Roys <Joshua.Roys@gtri.gatech.edu>
Date:   Tue May 15 15:01:29 2012 -0400

    712313 - Add installed size to repodata
Comment 4 Marcelo Moreira de Mello 2012-07-06 22:28:28 EDT
 For some reason, the schema-upgrade does not updated my database. I'm investigating it. 

  After update the table manually, the repodata was generated as expected. 

spaceschema=# alter table rhnPackage add column installed_size numeric;
ALTER TABLE

spaceschema=# select count(*) from rhnreporegenqueue;                            
 count 
-------
    96
(1 row)

spaceschema=# delete from rhnreporegenqueue;
DELETE 96

==> /var/log/rhn/rhn_taskomatic_daemon.log <==
INFO   | jvm 1    | 2012/07/06 23:26:00 | 2012-07-06 23:26:00,130 [DefaultQuartzScheduler_Worker-2] INFO  com.redhat.rhn.taskomatic.task.ChannelRepodata - In the queue: 1
INFO   | jvm 1    | 2012/07/06 23:26:14 | 2012-07-06 23:26:14,854 [Thread-470] INFO  com.redhat.rhn.taskomatic.task.repomd.RepositoryWriter - Repository metadata generation for 'centos6_base-x86_64' finished in 74 seconds
INFO   | jvm 1    | 2012/07/06 23:27:00 | 2012-07-06 23:27:00,111 [DefaultQuartzScheduler_Worker-7] INFO  com.redhat.rhn.taskomatic.task.ChannelRepodata - In the queue: 1
INFO   | jvm 1    | 2012/07/06 23:27:00 | 2012-07-06 23:27:00,166 [Thread-475] INFO  com.redhat.rhn.taskomatic.task.repomd.RepositoryWriter - File Modified Date:2012-07-06 08:38:09 BRT
INFO   | jvm 1    | 2012/07/06 23:27:00 | 2012-07-06 23:27:00,166 [Thread-475] INFO  com.redhat.rhn.taskomatic.task.repomd.RepositoryWriter - Channel Modified Date:2012-07-06 08:38:09 BRT
INFO   | jvm 1    | 2012/07/06 23:27:00 | 2012-07-06 23:27:00,261 [Thread-475] INFO  com.redhat.rhn.taskomatic.task.repomd.RepositoryWriter - Generating new repository metadata for channel 'centos6_base-x86_64'(sha1) 7296 packages, 198 errata
INFO   | jvm 1    | 2012/07/06 23:28:00 | 2012-07-06 23:28:00,587 [Thread-475] INFO  com.redhat.rhn.taskomatic.task.repomd.RepositoryWriter - Repository metadata generation for 'centos6_base-x86_64' finished in 60 seconds
Comment 5 Marcelo Moreira de Mello 2012-07-06 22:37:18 EDT
  Investigating it further, it seems that running spacewalk-schema-upgrade does not really updated the information. 

  As we can see the script 104-suseCredentials_create.sql.postgresql should create a table called suseCredentials, but I don't have it on my database. 

# rhn-schema-version 
1.8.58-1.el6

# rpm -aq | grep schema
spacewalk-schema-1.8.58-1.el6.noarch

# rhn-schema-stats output-schema
            label            |  created   |  modified  |       name       | epoch | version | release 
-----------------------------+------------+------------+------------------+-------+---------+---------
 schema-from-20120406-235755 | 2012-04-06 | 2012-04-24 | spacewalk-schema |       | 1.7.55  | 1.el6
 schema-from-20120424-152418 | 2012-04-24 | 2012-04-27 | spacewalk-schema |       | 1.8.19  | 1.el6
 schema-from-20120427-204214 | 2012-04-27 | 2012-05-01 | spacewalk-schema |       | 1.8.24  | 1.el6
 schema-from-20120501-202601 | 2012-05-01 | 2012-05-04 | spacewalk-schema |       | 1.8.28  | 1.el6
 schema-from-20120504-204243 | 2012-05-04 | 2012-05-10 | spacewalk-schema |       | 1.8.29  | 1.el6
 schema-from-20120510-214516 | 2012-05-10 | 2012-05-14 | spacewalk-schema |       | 1.8.31  | 1.el6
 schema-from-20120514-224612 | 2012-05-14 | 2012-05-25 | spacewalk-schema |       | 1.8.33  | 1.el6
 schema-from-20120525-134737 | 2012-05-25 | 2012-06-05 | spacewalk-schema |       | 1.8.40  | 1.el6
 schema-from-20120605-002436 | 2012-06-05 | 2012-06-09 | spacewalk-schema |       | 1.8.47  | 1.el6
 schema-from-20120609-010210 | 2012-06-09 | 2012-07-03 | spacewalk-schema |       | 1.8.50  | 1.el6
 schema-from-20120703-193611 | 2012-07-03 | 2012-07-06 | spacewalk-schema |       | 1.8.57  | 1.el6
 schema                      | 2012-07-06 | 2012-07-06 | spacewalk-schema |       | 1.8.58  | 1.el6
(12 rows)
Comment 6 Marcelo Moreira de Mello 2012-07-09 15:26:56 EDT

  Hello, 

    The issue reported was a locally issue due for downgrading the spacewalk-schema. 

    Closing this as NOTABUG.

Note You need to log in before you can comment on or make changes to this bug.