mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
Bugfix/ACS-1319 fix long running patch (#425)
* REPO-1319 - Migration to remove alf_server table * Updated test schema reference * Renamed test env. schema bootstrap configuration file This is done to avoid test failing due to special spring configuration overrides * [skip ci] Better output from test errors, fixed table patterns for MSSQL support * Now message patterns for migration are case insensitive * Fixed NPE in SchemaDifferenceHelperUnitTest * Fixed path to special test spring configuration * Changes after review * Changes after review Co-authored-by: Nana Insaidoo <insaidoo.nana@yahoo.it>
This commit is contained in:
@@ -78,19 +78,20 @@ public class SchemaDifferenceHelper
|
|||||||
|
|
||||||
public String findPatchCausingDifference(Difference difference)
|
public String findPatchCausingDifference(Difference difference)
|
||||||
{
|
{
|
||||||
for (SchemaUpgradeScriptPatch patch: optionalUpgradePatches)
|
String differenceText = describe(difference);
|
||||||
|
for (SchemaUpgradeScriptPatch patch : optionalUpgradePatches)
|
||||||
{
|
{
|
||||||
if (!isPatchApplied(patch))
|
if (!isPatchApplied(patch))
|
||||||
{
|
{
|
||||||
List<String> problemPatterns = getProblemsPatterns(patch);
|
List<String> problemPatterns = getProblemsPatterns(patch);
|
||||||
for (String problemPattern: problemPatterns)
|
for (String problemPattern : problemPatterns)
|
||||||
{
|
{
|
||||||
if (describe(difference).matches(problemPattern))
|
if (differenceText.matches(problemPattern))
|
||||||
{
|
{
|
||||||
return patch.getId();
|
return patch.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@@ -162,28 +162,16 @@ CREATE TABLE alf_authority_alias
|
|||||||
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
|
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
CREATE TABLE alf_server
|
|
||||||
(
|
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
version BIGINT NOT NULL,
|
|
||||||
ip_address VARCHAR(39) NOT NULL,
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY ip_address (ip_address)
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE alf_transaction
|
CREATE TABLE alf_transaction
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
version BIGINT NOT NULL,
|
version BIGINT NOT NULL,
|
||||||
server_id BIGINT,
|
|
||||||
change_txn_id VARCHAR(56) NOT NULL,
|
change_txn_id VARCHAR(56) NOT NULL,
|
||||||
commit_time_ms BIGINT,
|
commit_time_ms BIGINT,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
KEY idx_alf_txn_ctms (commit_time_ms, id),
|
KEY idx_alf_txn_ctms (commit_time_ms, id),
|
||||||
KEY idx_alf_txn_ctms_sc (commit_time_ms),
|
KEY idx_alf_txn_ctms_sc (commit_time_ms),
|
||||||
key idx_alf_txn_id_ctms (id, commit_time_ms),
|
key idx_alf_txn_id_ctms (id, commit_time_ms)
|
||||||
KEY fk_alf_txn_svr (server_id),
|
|
||||||
CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
|
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
CREATE TABLE alf_store
|
CREATE TABLE alf_store
|
||||||
|
@@ -2474,38 +2474,6 @@
|
|||||||
</index>
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
<table name="alf_server">
|
|
||||||
<columns>
|
|
||||||
<column name="id" order="1">
|
|
||||||
<type>bigint</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>true</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="version" order="2">
|
|
||||||
<type>bigint</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="ip_address" order="3">
|
|
||||||
<type>varchar(39)</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
</columns>
|
|
||||||
<primarykey name="PRIMARY">
|
|
||||||
<columnnames>
|
|
||||||
<columnname order="1">id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</primarykey>
|
|
||||||
<foreignkeys/>
|
|
||||||
<indexes>
|
|
||||||
<index name="ip_address" unique="true">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>ip_address</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
</indexes>
|
|
||||||
</table>
|
|
||||||
<table name="alf_store">
|
<table name="alf_store">
|
||||||
<columns>
|
<columns>
|
||||||
<column name="id" order="1">
|
<column name="id" order="1">
|
||||||
@@ -2652,17 +2620,12 @@
|
|||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="server_id" order="3">
|
<column name="change_txn_id" order="3">
|
||||||
<type>bigint</type>
|
|
||||||
<nullable>true</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="change_txn_id" order="4">
|
|
||||||
<type>varchar(56)</type>
|
<type>varchar(56)</type>
|
||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="commit_time_ms" order="5">
|
<column name="commit_time_ms" order="4">
|
||||||
<type>bigint</type>
|
<type>bigint</type>
|
||||||
<nullable>true</nullable>
|
<nullable>true</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
@@ -2673,13 +2636,6 @@
|
|||||||
<columnname order="1">id</columnname>
|
<columnname order="1">id</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</primarykey>
|
</primarykey>
|
||||||
<foreignkeys>
|
|
||||||
<foreignkey name="fk_alf_txn_svr">
|
|
||||||
<localcolumn>server_id</localcolumn>
|
|
||||||
<targettable>alf_server</targettable>
|
|
||||||
<targetcolumn>id</targetcolumn>
|
|
||||||
</foreignkey>
|
|
||||||
</foreignkeys>
|
|
||||||
<indexes>
|
<indexes>
|
||||||
<index name="idx_alf_txn_ctms" unique="false">
|
<index name="idx_alf_txn_ctms" unique="false">
|
||||||
<columnnames>
|
<columnnames>
|
||||||
@@ -2698,11 +2654,6 @@
|
|||||||
<columnname>commit_time_ms</columnname>
|
<columnname>commit_time_ms</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</index>
|
</index>
|
||||||
<index name="fk_alf_txn_svr" unique="false">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>server_id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
<table name="alf_usage_delta">
|
<table name="alf_usage_delta">
|
||||||
|
@@ -174,31 +174,18 @@ CREATE UNIQUE INDEX auth_id ON alf_authority_alias (auth_id, alias_id);
|
|||||||
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
||||||
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
||||||
|
|
||||||
CREATE SEQUENCE alf_server_seq START WITH 1 INCREMENT BY 1;
|
|
||||||
CREATE TABLE alf_server
|
|
||||||
(
|
|
||||||
id INT8 NOT NULL,
|
|
||||||
version INT8 NOT NULL,
|
|
||||||
ip_address VARCHAR(39) NOT NULL,
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
CREATE UNIQUE INDEX ip_address ON alf_server (ip_address);
|
|
||||||
|
|
||||||
CREATE SEQUENCE alf_transaction_seq START WITH 1 INCREMENT BY 1;
|
CREATE SEQUENCE alf_transaction_seq START WITH 1 INCREMENT BY 1;
|
||||||
CREATE TABLE alf_transaction
|
CREATE TABLE alf_transaction
|
||||||
(
|
(
|
||||||
id INT8 NOT NULL,
|
id INT8 NOT NULL,
|
||||||
version INT8 NOT NULL,
|
version INT8 NOT NULL,
|
||||||
server_id INT8,
|
|
||||||
change_txn_id VARCHAR(56) NOT NULL,
|
change_txn_id VARCHAR(56) NOT NULL,
|
||||||
commit_time_ms INT8,
|
commit_time_ms INT8,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id)
|
||||||
CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
|
|
||||||
);
|
);
|
||||||
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
|
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
|
||||||
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
|
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
|
||||||
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
|
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
|
||||||
CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
|
|
||||||
|
|
||||||
CREATE SEQUENCE alf_store_seq START WITH 1 INCREMENT BY 1;
|
CREATE SEQUENCE alf_store_seq START WITH 1 INCREMENT BY 1;
|
||||||
CREATE TABLE alf_store
|
CREATE TABLE alf_store
|
||||||
|
@@ -44,7 +44,6 @@
|
|||||||
<sequence name="alf_prop_unique_ctx_seq"/>
|
<sequence name="alf_prop_unique_ctx_seq"/>
|
||||||
<sequence name="alf_prop_value_seq"/>
|
<sequence name="alf_prop_value_seq"/>
|
||||||
<sequence name="alf_qname_seq"/>
|
<sequence name="alf_qname_seq"/>
|
||||||
<sequence name="alf_server_seq"/>
|
|
||||||
<sequence name="alf_store_seq"/>
|
<sequence name="alf_store_seq"/>
|
||||||
<sequence name="alf_transaction_seq"/>
|
<sequence name="alf_transaction_seq"/>
|
||||||
<sequence name="alf_usage_delta_seq"/>
|
<sequence name="alf_usage_delta_seq"/>
|
||||||
@@ -2545,38 +2544,6 @@
|
|||||||
</index>
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
<table name="alf_server">
|
|
||||||
<columns>
|
|
||||||
<column name="id" order="1">
|
|
||||||
<type>int8</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="version" order="2">
|
|
||||||
<type>int8</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="ip_address" order="3">
|
|
||||||
<type>varchar(39)</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
</columns>
|
|
||||||
<primarykey name="alf_server_pkey">
|
|
||||||
<columnnames>
|
|
||||||
<columnname order="1">id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</primarykey>
|
|
||||||
<foreignkeys/>
|
|
||||||
<indexes>
|
|
||||||
<index name="ip_address" unique="true">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>ip_address</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
</indexes>
|
|
||||||
</table>
|
|
||||||
<table name="alf_store">
|
<table name="alf_store">
|
||||||
<columns>
|
<columns>
|
||||||
<column name="id" order="1">
|
<column name="id" order="1">
|
||||||
@@ -2723,17 +2690,12 @@
|
|||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="server_id" order="3">
|
<column name="change_txn_id" order="3">
|
||||||
<type>int8</type>
|
|
||||||
<nullable>true</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="change_txn_id" order="4">
|
|
||||||
<type>varchar(56)</type>
|
<type>varchar(56)</type>
|
||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="commit_time_ms" order="5">
|
<column name="commit_time_ms" order="4">
|
||||||
<type>int8</type>
|
<type>int8</type>
|
||||||
<nullable>true</nullable>
|
<nullable>true</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
@@ -2744,19 +2706,7 @@
|
|||||||
<columnname order="1">id</columnname>
|
<columnname order="1">id</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</primarykey>
|
</primarykey>
|
||||||
<foreignkeys>
|
|
||||||
<foreignkey name="fk_alf_txn_svr">
|
|
||||||
<localcolumn>server_id</localcolumn>
|
|
||||||
<targettable>alf_server</targettable>
|
|
||||||
<targetcolumn>id</targetcolumn>
|
|
||||||
</foreignkey>
|
|
||||||
</foreignkeys>
|
|
||||||
<indexes>
|
<indexes>
|
||||||
<index name="fk_alf_txn_svr" unique="false">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>server_id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
<index name="idx_alf_txn_ctms" unique="false">
|
<index name="idx_alf_txn_ctms" unique="false">
|
||||||
<columnnames>
|
<columnnames>
|
||||||
<columnname>commit_time_ms</columnname>
|
<columnname>commit_time_ms</columnname>
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
<ref bean="patch.db-V5.2-remove-jbpm-tables-from-db" />
|
<ref bean="patch.db-V5.2-remove-jbpm-tables-from-db" />
|
||||||
<ref bean="patch.db-V6.0-change-set-indexes" />
|
<ref bean="patch.db-V6.0-change-set-indexes" />
|
||||||
<ref bean="patch.db-V6.3-add-indexes-node-transaction" />
|
<ref bean="patch.db-V6.3-add-indexes-node-transaction" />
|
||||||
|
<ref bean="patch.db-V7.1.0-remove-alf_server-table" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
--
|
||||||
|
-- Title: Remove alf_server table
|
||||||
|
-- Database: MySQL
|
||||||
|
-- Since: V6.3
|
||||||
|
-- Author: David Edwards
|
||||||
|
-- Author: Alex Mukha
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
|
DROP TABLE alf_server;
|
||||||
|
|
||||||
|
ALTER TABLE alf_transaction
|
||||||
|
DROP FOREIGN KEY fk_alf_txn_svr,
|
||||||
|
DROP COLUMN server_id;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS=1;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V7.1.0-remove-alf_server-table';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V7.1.0-remove-alf_server-table', 'Remove alf_server table',
|
||||||
|
0, 15000, -1, 15001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'alf_server table and constraints removed'
|
||||||
|
);
|
@@ -0,0 +1,26 @@
|
|||||||
|
--
|
||||||
|
-- Title: Remove alf_server table
|
||||||
|
-- Database: PostgreSQL
|
||||||
|
-- Since: V6.3
|
||||||
|
-- Author: Bruno Bossola
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE alf_transaction
|
||||||
|
DROP CONSTRAINT IF EXISTS fk_alf_txn_svr,
|
||||||
|
DROP COLUMN IF EXISTS server_id;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS alf_server;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V7.1.0-remove-alf_server-table';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V7.1.0-remove-alf_server-table', 'Removes alf_server table and constraints',
|
||||||
|
0, 15000, -1, 15001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'alf_server table and constraints removed'
|
||||||
|
);
|
@@ -0,0 +1,7 @@
|
|||||||
|
(?i).*expected column .*alf_transaction\.change_txn_id\.order="3".*
|
||||||
|
(?i).*expected column .*alf_transaction\.commit_time_ms\.order="4".*
|
||||||
|
(?i).*unexpected column found in database with path: .*alf_transaction\.server_id
|
||||||
|
(?i).*unexpected foreign key found in database with path: .*alf_transaction\.fk_alf_txn_svr
|
||||||
|
(?i).*unexpected index found in database with path: .*alf_transaction\.fk_alf_txn_svr
|
||||||
|
(?i).*unexpected sequence found in database with path: .*alf_server_seq
|
||||||
|
(?i).*unexpected table found in database with path: .*alf_server
|
@@ -403,3 +403,7 @@ patch.db-V5.2-remove-jbpm-tables-from-db.description=Removes all JBPM related ta
|
|||||||
patch.db-V6.0-change-set-indexes.description=Add additional indexes to support acl tracking.
|
patch.db-V6.0-change-set-indexes.description=Add additional indexes to support acl tracking.
|
||||||
|
|
||||||
patch.db-V6.3-add-indexes-node-transaction.description=Create additional indexes on alf_node and alf_transaction
|
patch.db-V6.3-add-indexes-node-transaction.description=Create additional indexes on alf_node and alf_transaction
|
||||||
|
|
||||||
|
patch.db-V7.1.0-remove-alf_server-table.description=Removes alf_server table and constraints
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1409,4 +1409,22 @@
|
|||||||
<value>classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/add-indexes-node-transaction.sql</value>
|
<value>classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/add-indexes-node-transaction.sql</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
|
||||||
|
<bean id="patch.db-V7.1.0-remove-alf_server-table" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.db-V7.1.0-remove-alf_server-table</value></property>
|
||||||
|
<property name="description"><value>patch.db-V7.1.0-remove-alf_server-table.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>15000</value></property>
|
||||||
|
<property name="targetSchema"><value>15001</value></property>
|
||||||
|
<property name="scriptUrl">
|
||||||
|
<value>classpath:alfresco/dbscripts/upgrade/7.1.0/${db.script.dialect}/remove-alf_server-table.sql</value>
|
||||||
|
</property>
|
||||||
|
<property name="problemsPatternFileUrl">
|
||||||
|
<value>classpath:alfresco/dbscripts/upgrade/7.1.0/remove-alf_server-table.patterns</value>
|
||||||
|
</property>
|
||||||
|
<property name="ignored"><value>${system.remove-alf_server-table-from-db.ignored}</value></property>
|
||||||
|
</bean>
|
||||||
|
<!--
|
||||||
|
-->
|
||||||
|
|
||||||
|
</beans>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
repository.name=Main Repository
|
repository.name=Main Repository
|
||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
version.schema=15000
|
version.schema=15001
|
||||||
|
|
||||||
# Directory configuration
|
# Directory configuration
|
||||||
|
|
||||||
@@ -1239,3 +1239,6 @@ system.new-node-transaction-indexes.ignored=true
|
|||||||
# Allows the configuration of maximum limits of the temp files to be deleted or the maximum time allowed to run for the job
|
# Allows the configuration of maximum limits of the temp files to be deleted or the maximum time allowed to run for the job
|
||||||
system.tempFileCleaner.maxFilesToDelete=
|
system.tempFileCleaner.maxFilesToDelete=
|
||||||
system.tempFileCleaner.maxTimeToRun=
|
system.tempFileCleaner.maxTimeToRun=
|
||||||
|
|
||||||
|
# Property to long running migration to remove alf_server in v7+ patch.db-V7.1.0-remove-alf_server-table
|
||||||
|
system.remove-alf_server-table-from-db.ignored=true
|
||||||
|
@@ -52,11 +52,9 @@ import org.alfresco.util.test.junitrules.ApplicationContextInit;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
import org.junit.rules.TemporaryFolder;
|
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||||
@@ -67,7 +65,7 @@ import org.w3c.dom.Node;
|
|||||||
@Category({OwnJVMTestsCategory.class})
|
@Category({OwnJVMTestsCategory.class})
|
||||||
public class SchemaBootstrapTest
|
public class SchemaBootstrapTest
|
||||||
{
|
{
|
||||||
private static final String BOOTSTRAP_TEST_CONTEXT = "classpath*:alfresco/dbscripts/test-bootstrap-context.xml";
|
private static final String BOOTSTRAP_TEST_CONTEXT = "classpath*:alfresco/dbscripts/bootstrap-context-test.xml";
|
||||||
private static final String MAIN_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml";
|
private static final String MAIN_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml";
|
||||||
private static final String TEST_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Test-Schema-Reference-ALF.xml";
|
private static final String TEST_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Test-Schema-Reference-ALF.xml";
|
||||||
private static final List<String> TEST_SCHEMA_REFERENCE_URLS = Arrays.asList(
|
private static final List<String> TEST_SCHEMA_REFERENCE_URLS = Arrays.asList(
|
||||||
@@ -82,9 +80,6 @@ public class SchemaBootstrapTest
|
|||||||
private SchemaBootstrap schemaBootstrap;
|
private SchemaBootstrap schemaBootstrap;
|
||||||
private SchemaUpgradeScriptPatch optionalPatch;
|
private SchemaUpgradeScriptPatch optionalPatch;
|
||||||
|
|
||||||
@Rule
|
|
||||||
public TemporaryFolder testFolder = new TemporaryFolder();
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception
|
public static void beforeClass() throws Exception
|
||||||
{
|
{
|
||||||
|
@@ -43,6 +43,7 @@ import org.alfresco.repo.admin.patch.AppliedPatch;
|
|||||||
import org.alfresco.repo.admin.patch.PatchService;
|
import org.alfresco.repo.admin.patch.PatchService;
|
||||||
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
||||||
import org.alfresco.repo.domain.dialect.Dialect;
|
import org.alfresco.repo.domain.dialect.Dialect;
|
||||||
|
import org.alfresco.util.schemacomp.model.DbObject;
|
||||||
import org.alfresco.util.schemacomp.model.Index;
|
import org.alfresco.util.schemacomp.model.Index;
|
||||||
import org.alfresco.util.schemacomp.model.Schema;
|
import org.alfresco.util.schemacomp.model.Schema;
|
||||||
import org.alfresco.util.schemacomp.model.Table;
|
import org.alfresco.util.schemacomp.model.Table;
|
||||||
@@ -125,8 +126,7 @@ public class SchemaDifferenceHelperUnitTest
|
|||||||
|
|
||||||
private Difference createDifference()
|
private Difference createDifference()
|
||||||
{
|
{
|
||||||
Difference difference = new Difference(Where.IN_BOTH_BUT_DIFFERENCE, mock(DbProperty.class), mock(DbProperty.class));
|
return new Difference(Where.IN_BOTH_BUT_DIFFERENCE, new DbProperty(mock(DbObject.class)), new DbProperty(mock(DbObject.class)));
|
||||||
return difference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Index createTableIndex(String tableName)
|
private Index createTableIndex(String tableName)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -25,38 +25,38 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.util.schemacomp;
|
package org.alfresco.util.schemacomp;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.domain.schema.SchemaBootstrap;
|
import org.alfresco.repo.domain.schema.SchemaBootstrap;
|
||||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.util.testing.category.DBTests;
|
import org.alfresco.util.testing.category.DBTests;
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test intended for use in the continuous integration system that checks whether the
|
* Test intended for use in the continuous integration system that checks
|
||||||
* schema reference file (for whichever database the tests are being run against)
|
* whether the schema reference file (for whichever database the tests are being
|
||||||
* is in sync with the actual schema. If the test fails (and the schema comparator is
|
* run against) is in sync with the actual schema. If the test fails (and the
|
||||||
* in working order) then the most likely cause is that a new up-to-date schema reference file
|
* schema comparator is in working order) then the most likely cause is that a
|
||||||
* needs to be created.
|
* new up-to-date schema reference file needs to be created.
|
||||||
* <p>
|
* <p>
|
||||||
* Schema reference files are created using the {@link DbToXML} tool.
|
* Schema reference files are created using the {@link DbToXML} tool.
|
||||||
* <p>
|
* <p>
|
||||||
* Note: if no reference file exists then the test will pass, this is to allow piece meal
|
* Note: if no reference file exists then the test will pass, this is to allow
|
||||||
* introduction of schmea reference files.
|
* piece meal introduction of schmea reference files.
|
||||||
*
|
*
|
||||||
* @see DbToXML
|
* @see DbToXML
|
||||||
* @author Matt Ward
|
* @author Matt Ward
|
||||||
*/
|
*/
|
||||||
@Category({OwnJVMTestsCategory.class, DBTests.class})
|
@Category({ OwnJVMTestsCategory.class, DBTests.class })
|
||||||
public class SchemaReferenceFileTest
|
public class SchemaReferenceFileTest
|
||||||
{
|
{
|
||||||
private ClassPathXmlApplicationContext ctx;
|
private ClassPathXmlApplicationContext ctx;
|
||||||
@@ -74,12 +74,28 @@ public class SchemaReferenceFileTest
|
|||||||
{
|
{
|
||||||
ByteArrayOutputStream buff = new ByteArrayOutputStream();
|
ByteArrayOutputStream buff = new ByteArrayOutputStream();
|
||||||
PrintWriter out = new PrintWriter(buff);
|
PrintWriter out = new PrintWriter(buff);
|
||||||
int numProblems = schemaBootstrap.validateSchema(null, out);
|
int maybeProblems = schemaBootstrap.validateSchema(null, out);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
if (numProblems > 0)
|
if (maybeProblems > 0)
|
||||||
{
|
{
|
||||||
fail(buff.toString());
|
List<String> errors = computeRealErrors(buff);
|
||||||
|
assertTrue("\n"+buff, errors.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> computeRealErrors(ByteArrayOutputStream buff)
|
||||||
|
{
|
||||||
|
String[] lines = buff.toString().split("\\n");
|
||||||
|
|
||||||
|
List<String> errors = new ArrayList<>();
|
||||||
|
for (int i = 0; i < lines.length; i++)
|
||||||
|
{
|
||||||
|
String line = lines[i].trim();
|
||||||
|
if (line.isEmpty())
|
||||||
|
break;
|
||||||
|
errors.add(line);
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,6 @@
|
|||||||
<sequence name="alf_prop_unique_ctx_seq"/>
|
<sequence name="alf_prop_unique_ctx_seq"/>
|
||||||
<sequence name="alf_prop_value_seq"/>
|
<sequence name="alf_prop_value_seq"/>
|
||||||
<sequence name="alf_qname_seq"/>
|
<sequence name="alf_qname_seq"/>
|
||||||
<sequence name="alf_server_seq"/>
|
|
||||||
<sequence name="alf_store_seq"/>
|
<sequence name="alf_store_seq"/>
|
||||||
<sequence name="alf_transaction_seq"/>
|
<sequence name="alf_transaction_seq"/>
|
||||||
<sequence name="alf_usage_delta_seq"/>
|
<sequence name="alf_usage_delta_seq"/>
|
||||||
@@ -2551,38 +2550,6 @@
|
|||||||
</index>
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
<table name="alf_server">
|
|
||||||
<columns>
|
|
||||||
<column name="id" order="1">
|
|
||||||
<type>int8</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="version" order="2">
|
|
||||||
<type>int8</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="ip_address" order="3">
|
|
||||||
<type>varchar(39)</type>
|
|
||||||
<nullable>false</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
</columns>
|
|
||||||
<primarykey name="alf_server_pkey">
|
|
||||||
<columnnames>
|
|
||||||
<columnname order="1">id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</primarykey>
|
|
||||||
<foreignkeys/>
|
|
||||||
<indexes>
|
|
||||||
<index name="ip_address" unique="true">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>ip_address</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
</indexes>
|
|
||||||
</table>
|
|
||||||
<table name="alf_store">
|
<table name="alf_store">
|
||||||
<columns>
|
<columns>
|
||||||
<column name="id" order="1">
|
<column name="id" order="1">
|
||||||
@@ -2729,17 +2696,12 @@
|
|||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="server_id" order="3">
|
<column name="change_txn_id" order="3">
|
||||||
<type>int8</type>
|
|
||||||
<nullable>true</nullable>
|
|
||||||
<autoincrement>false</autoincrement>
|
|
||||||
</column>
|
|
||||||
<column name="change_txn_id" order="4">
|
|
||||||
<type>varchar(56)</type>
|
<type>varchar(56)</type>
|
||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="commit_time_ms" order="5">
|
<column name="commit_time_ms" order="4">
|
||||||
<type>int8</type>
|
<type>int8</type>
|
||||||
<nullable>true</nullable>
|
<nullable>true</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
@@ -2750,19 +2712,7 @@
|
|||||||
<columnname order="1">id</columnname>
|
<columnname order="1">id</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</primarykey>
|
</primarykey>
|
||||||
<foreignkeys>
|
|
||||||
<foreignkey name="fk_alf_txn_svr">
|
|
||||||
<localcolumn>server_id</localcolumn>
|
|
||||||
<targettable>alf_server</targettable>
|
|
||||||
<targetcolumn>id</targetcolumn>
|
|
||||||
</foreignkey>
|
|
||||||
</foreignkeys>
|
|
||||||
<indexes>
|
<indexes>
|
||||||
<index name="fk_alf_txn_svr" unique="false">
|
|
||||||
<columnnames>
|
|
||||||
<columnname>server_id</columnname>
|
|
||||||
</columnnames>
|
|
||||||
</index>
|
|
||||||
<index name="idx_alf_txn_ctms" unique="false">
|
<index name="idx_alf_txn_ctms" unique="false">
|
||||||
<columnnames>
|
<columnnames>
|
||||||
<columnname>commit_time_ms</columnname>
|
<columnname>commit_time_ms</columnname>
|
||||||
|
Reference in New Issue
Block a user