Bamboo 5.1.0 failing to create constraints on PostgreSQL 9.1
Asked by Igor Cicimov:

Hi all,

I've juts installed Bamboo 5.1.0 on Ubuntu 12.04.2 LTS. I've setup PostgreSQL 9.1 as external database but during the initial setup I'm getting the following errors:

2013-09-16 09:24:22 EST STATEMENT: drop table TRUSTED_APPS_IPS

2013-09-16 09:24:22 EST ERROR: table "password_reset_token" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table password_reset_token

2013-09-16 09:24:22 EST ERROR: table "deployment_version_status" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table DEPLOYMENT_VERSION_STATUS

2013-09-16 09:24:22 EST ERROR: table "deployment_version_jira_issue" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table DEPLOYMENT_VERSION_JIRA_ISSUE

2013-09-16 09:24:22 EST ERROR: table "brs_artifact_link" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table BRS_ARTIFACT_LINK

2013-09-16 09:24:22 EST ERROR: table "deployment_project_item_ba" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table DEPLOYMENT_PROJECT_ITEM_BA

2013-09-16 09:24:22 EST ERROR: table "artifact" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table ARTIFACT

2013-09-16 09:24:22 EST ERROR: table "hibernate_unique_key" does not exist

2013-09-16 09:24:22 EST STATEMENT: drop table hibernate_unique_key

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table DEPLOYMENT_RESULT add constraint FKB7ACDAD7A248FEE7 foreign key (ENVIRONMENT_ID) references DEPLOYMENT_ENVIRONMENT

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table DEPLOYMENT_RESULT add constraint FKB7ACDAD7F4F36A02 foreign key (VERSION_ID) references DEPLOYMENT_VERSION

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table DEPLOYMENT_RESULT add constraint FKB7ACDAD7E3B5B062 foreign key (VARIABLE_CONTEXT_BASELINE_ID) references VARIABLE_CONTEXT_BASELINE

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table DEPLOYMENT_VERSION_ITEM add constraint FKEC5E1747BD9BBC foreign key (DEPLOYMENT_VERSION_ID) references DEPLOYMENT_VERSION

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table ELASTIC_SCHEDULE add constraint FK1C6B30E1581FB731 foreign key (ELASTIC_IMAGE) references ELASTIC_IMAGE

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

2013-09-16 09:24:23 EST STATEMENT: alter table TEST_CLASS_RESULT add constraint FK3521FF712170166F foreign key (TEST_CLASS_ID) references TEST_CLASS

2013-09-16 09:24:23 EST ERROR: could not read block 43 in file "base/63394/11787": read only 0 of 8192 bytes

.

.

and so on, lots of errors about not being able to read the specific database file and thus failing creating constraints. And the database file is really empty:

root@[server:/opt/atlassian-bamboo-5.1.0#](http://ip-172-31-20-42/opt/atlassian-bamboo-5.1.0) ls -l /var/lib/postgresql/9.1/main/base/63394/11787  
-rw------- 1 postgres postgres 0 Sep 16 09:20 /var/lib/postgresql/9.1/main/base/63394/11787

When trying to setup a new build plan we get the same error message in the applciation log, that the above db file is empty.

The database looks ok on first glancef, it has 87 tables and just to chek one of them:

bamboo5=# \\d capability;  
Table "public.capability"  
Column \| Type \| Modifiers   
----------------+-------------------------+-----------  
capability_id \| bigint \| not null  
key_identifier \| character varying(255) \|   
value \| character varying(4000) \|   
capability_set \| bigint \|   
Indexes:  
"capability_pkey" PRIMARY KEY, btree (capability_id)  
"capability_key_index" btree (key_identifier)  
"capability_set_index" btree (capability_set)

bamboo5=# select \* from capability;

capability_id \| key_identifier \| value \| capability_set   
---------------+---------------------------------------------+-------------------------------------------------------------+----------------  
229377 \| system.git.executable \| /usr/bin/git \| 163842  
229378 \| system.jdk.JDK 1.6.0_45 \| /usr/lib/jvm/java-6-oracle \| 163842  
229379 \| system.jdk.JDK 1.6 \| /usr/lib/jvm/java-6-oracle \| 163842  
229380 \| system.builder.node.Node.js 0.10 \| /opt/node-0.10/bin/node \| 163844  
229381 \| system.builder.grailsBuilder.Grails 1.3 \| /opt/grails-1.3 \| 163844  
229382 \| system.builder.mvn3.Maven 3.0 \| /opt/maven-3.0 \| 163844  
229383 \| system.jdk.JDK 1.7 \| /opt/jdk-7 \| 163844  
.

.

We already have bamboo 4.2.1 running on the same server using the same PostgreSQL 9.1 database, different instance though.

Any ideas why is this failing?

Thanks


Answers:
author: Igor Cicimov
body: There is already bamboo-4.2.1 running on the same database without any problems. Anyway, I moved to MySQL now it is working fine.


author: Przemek Bruski
body: It looks like your database files are corrupt, you should probably salvage what you can and set up a new one. Bamboo does not have anything to do with it.