Project

General

Profile

« Previous | Next » 

Revision 7392

shorten the systemmetadata* table names for Oracle's 30 character limit. move version to 2.0.5. http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5717

View differences:

lib/metacat.properties
22 22
############### Application Values ############
23 23

  
24 24
## one of the few places where we use ANT tokens
25
application.metacatVersion=2.0.4
25
application.metacatVersion=2.0.5
26 26
application.metacatReleaseInfo=-1
27 27

  
28 28
application.deployDir=
......
76 76
database.upgradeVersion.2.0.2=upgrade-db-to-2.0.2
77 77
database.upgradeVersion.2.0.3=upgrade-db-to-2.0.3
78 78
database.upgradeVersion.2.0.4=upgrade-db-to-2.0.4
79
database.upgradeVersion.2.0.5=upgrade-db-to-2.0.5
79 80
## for running java-based utilities
80 81
database.upgradeUtility.1.5.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade1_5_0
81 82
database.upgradeUtility.2.0.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade2_0_0
src/upgrade-db-to-2.0.0-oracle.sql
20 20
		PRIMARY KEY (guid)
21 21
)
22 22

  
23
CREATE TABLE systemMetadataReplicationPolicy (
23
CREATE TABLE smReplicationPolicy (
24 24
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
25 25
	member_node VARCHAR(250),	 -- replication member node
26 26
	policy VARCHAR2(2000),	 -- the policy (preferred, blocked, etc...TBD)
27
	CONSTRAINT systemMetadataReplicationPolicy_fk 
27
	CONSTRAINT smReplicationPolicy_fk 
28 28
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
29 29
);
30 30

  
31
CREATE TABLE systemMetadataReplicationStatus (
31
CREATE TABLE smReplicationStatus (
32 32
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
33 33
	member_node VARCHAR(250),	 -- replication member node
34 34
	status VARCHAR(250),	 -- replication status
35 35
	date_verified DATE, 	-- the date replication was verified   
36
	CONSTRAINT systemMetadataReplicationStatus_fk 
36
	CONSTRAINT smReplicationStatus_fk 
37 37
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
38 38
);
39 39

  
src/xmltables-oracle.sql
422 422
		PRIMARY KEY (guid)
423 423
)
424 424

  
425
CREATE TABLE systemMetadataReplicationPolicy (
425
CREATE TABLE smReplicationPolicy (
426 426
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
427 427
	member_node VARCHAR(250),	 -- replication member node
428 428
	policy VARCHAR2(2000),	 -- the policy (preferred, blocked, etc...TBD)
429
	CONSTRAINT systemMetadataReplicationPolicy_fk 
429
	CONSTRAINT smReplicationPolicy_fk 
430 430
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
431 431
);
432 432

  
433
CREATE TABLE systemMetadataReplicationStatus (
433
CREATE TABLE smReplicationStatus (
434 434
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
435 435
	member_node VARCHAR(250),	 -- replication member node
436 436
	status VARCHAR(250),	 -- replication status
437 437
	date_verified DATE, 	-- the date replication was verified   
438
	CONSTRAINT systemMetadataReplicationStatus_fk 
438
	CONSTRAINT smReplicationStatus_fk 
439 439
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
440 440
);
441 441

  
src/xmltables-postgres.sql
319 319
 */
320 320

  
321 321

  
322
CREATE TABLE systemMetadataReplicationPolicy (
322
CREATE TABLE smReplicationPolicy (
323 323
	guid text,	-- the globally unique string identifier of the object that the system metadata describes
324 324
	member_node VARCHAR(250),	 -- replication member node
325 325
	policy text,	 -- the policy (preferred, blocked, etc...TBD)
326
	CONSTRAINT systemMetadataReplicationPolicy_fk 
326
	CONSTRAINT smReplicationPolicy_fk 
327 327
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
328 328
);
329 329

  
330
CREATE TABLE systemMetadataReplicationStatus (
330
CREATE TABLE smReplicationStatus (
331 331
	guid text,	-- the globally unique string identifier of the object that the system metadata describes
332 332
	member_node VARCHAR(250),	 -- replication member node
333 333
	status VARCHAR(250),	 -- replication status
334 334
	date_verified TIMESTAMP, 	-- the date replication was verified   
335
	CONSTRAINT systemMetadataReplicationStatus_fk 
335
	CONSTRAINT smReplicationStatus_fk 
336 336
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
337 337
);
338 338

  
src/upgrade-db-to-2.0.5-postgres.sql
1
/*
2
 * Alter the systemmetadata* table names for Oracle length restrictions
3
 */
4
ALTER TABLE systemMetadataReplicationPolicy RENAME TO smReplicationPolicy;
5
ALTER TABLE systemMetadataReplicationStatus RENAME TO smReplicationStatus;
6

  
7
/*
8
 * update the database version
9
 */
10
UPDATE db_version SET status=0;
11

  
12
INSERT INTO db_version (version, status, date_created) 
13
  VALUES ('2.0.5', 1, CURRENT_DATE);
0 14

  
src/upgrade-db-to-2.0.5-oracle.sql
1
/*
2
 * Alter the systemmetadata* table names for Oracle length restrictions
3
 * NOTE: we cannot actually perform this since the tables could 
4
 * never be created when 2.0.0 was first released. Oracle users of Metacat 1.x
5
 * will have run through an updated 2.0.0 script that creates the correct table names
6
 * for use in 2.0.5. So, we do nothing here for Oracle deployments.
7
 */
8

  
9

  
10
/*
11
 * update the database version
12
 */
13
UPDATE db_version SET status=0;
14

  
15
INSERT INTO db_version (version, status, date_created) 
16
  VALUES ('2.0.5', 1, CURRENT_DATE);
0 17

  
src/edu/ucsb/nceas/metacat/admin/upgrade/GenerateGlobalIdentifiers.java
57 57
 * xml_replication, then only convert the IDs for server 1 to GUIDs if the
58 58
 * property 'guid.ezid.doishoulder.1' defines a valid doi shoulder.
59 59
 * 
60
 * NOTE: Metacat v2.0.5 has changed the name of the systemmetadata* tables to accommodate Oracle
61
 * length restrictions. The table names have been updated in this utility to enable
62
 * users to run this utility on v2.0.5+. You can only run this version of the utility on 
63
 * Metacat deployments that have been upgraded to 2.0.5+
64
 * 
60 65
 * @author jones
61 66
 */
62 67
public class GenerateGlobalIdentifiers implements UpgradeUtilityInterface {
......
153 158
        // Convert other tables once, after the identifier table conversion has established the new
154 159
        // global identifiers to be used
155 160
        // This incudes: xml_access table, including accessfileid field, systemmetadata, 
156
        // systemmetadatareplicationpolicy,and systemmetadatareplicationstatus tables
161
        // smreplicationpolicy,and smreplicationstatus tables
157 162
        convertIdentifierField(con, "xml_access", "guid");
158 163
        convertIdentifierField(con, "xml_access", "accessfileid");
159 164
        convertIdentifierField(con, "systemmetadata", "guid");
160
        convertIdentifierField(con, "systemmetadatareplicationpolicy", "guid");
161
        convertIdentifierField(con, "systemmetadatareplicationstatus", "guid");
165
        convertIdentifierField(con, "smreplicationpolicy", "guid");
166
        convertIdentifierField(con, "smreplicationstatus", "guid");
162 167

  
163 168
        // Now clean up the temporary column we created, but note this makes it much
164 169
        // harder to revert our changes
......
169 174
        /*      
170 175
        // The following SQL commands will revert the changes made by this script as long as the identifier.old_guid column is intact
171 176
        start transaction;
172
        update systemmetadatareplicationstatus set guid = id.old_guid FROM identifier id WHERE systemmetadatareplicationstatus.guid = id.guid;
173
        update systemmetadatareplicationpolicy set guid = id.old_guid FROM identifier id WHERE systemmetadatareplicationpolicy.guid = id.guid;
177
        update smreplicationstatus set guid = id.old_guid FROM identifier id WHERE smreplicationstatus.guid = id.guid;
178
        update smreplicationpolicy set guid = id.old_guid FROM identifier id WHERE smreplicationpolicy.guid = id.guid;
174 179
        update systemmetadata set guid = id.old_guid FROM identifier id WHERE systemmetadata.guid = id.guid;
175 180
        update xml_access set accessfileid = id.old_guid FROM identifier id WHERE xml_access.accessfileid = id.guid;
176 181
        update xml_access set guid = id.old_guid FROM identifier id WHERE xml_access.guid = id.guid;
src/edu/ucsb/nceas/metacat/IdentifierManager.java
382 382
		
383 383
		List<NodeReference> nodes = new ArrayList<NodeReference>();
384 384
		String sql = "select guid, policy, member_node " +
385
			"from systemMetadataReplicationPolicy where guid = ? and policy = ?";
385
			"from smReplicationPolicy where guid = ? and policy = ?";
386 386
	    DBConnection dbConn = null;
387 387
	    int serialNumber = -1;
388 388
	    try {
......
420 420
		
421 421
		List<Replica> replicas = new ArrayList<Replica>();
422 422
		String sql = "select guid, member_node, status, date_verified " +
423
			"from systemMetadataReplicationStatus where guid = ?";
423
			"from smReplicationStatus where guid = ?";
424 424
	    DBConnection dbConn = null;
425 425
	    int serialNumber = -1;
426 426
	    try {
......
1092 1092
    {
1093 1093
           
1094 1094
        // remove existing values first
1095
        String delete = "delete from systemMetadataReplicationPolicy " + 
1095
        String delete = "delete from smReplicationPolicy " + 
1096 1096
        "where guid = ? and policy = ?";
1097 1097
        PreparedStatement stmt = dbConn.prepareStatement(delete);
1098 1098
        //data values
......
1104 1104
        
1105 1105
        for (String memberNode: memberNodes) {
1106 1106
            // Execute the insert statement
1107
            String insert = "insert into systemMetadataReplicationPolicy " + 
1107
            String insert = "insert into smReplicationPolicy " + 
1108 1108
                "(guid, policy, member_node) " +
1109 1109
                "values (?, ?, ?)";
1110 1110
            PreparedStatement insertStatement = dbConn.prepareStatement(insert);
......
1114 1114
            insertStatement.setString(2, policy);
1115 1115
            insertStatement.setString(3, memberNode);
1116 1116
            
1117
            logMetacat.debug("systemMetadataReplicationPolicy sql: " + insertStatement.toString());
1117
            logMetacat.debug("smReplicationPolicy sql: " + insertStatement.toString());
1118 1118

  
1119 1119
            //execute
1120 1120
            int rows = insertStatement.executeUpdate();
......
1126 1126
    private void insertReplicationStatus(String guid, List<Replica> replicas, DBConnection dbConn) throws SQLException {
1127 1127
       
1128 1128
        // remove existing values first
1129
        String delete = "delete from systemMetadataReplicationStatus " + 
1129
        String delete = "delete from smReplicationStatus " + 
1130 1130
        "where guid = ?";
1131 1131
        PreparedStatement stmt = dbConn.prepareStatement(delete);
1132 1132
        //data values
......
1138 1138
        if (replicas != null) {
1139 1139
            for (Replica replica: replicas) {
1140 1140
	            // Execute the insert statement
1141
	            String insert = "insert into systemMetadataReplicationStatus " + 
1141
	            String insert = "insert into smReplicationStatus " + 
1142 1142
	                "(guid, member_node, status, date_verified) " +
1143 1143
	                "values (?, ?, ?, ?)";
1144 1144
	            PreparedStatement insertStatement = dbConn.prepareStatement(insert);
......
1152 1152
	            insertStatement.setString(3, status);
1153 1153
	            insertStatement.setDate(4, sqlDate);
1154 1154

  
1155
	            logMetacat.debug("systemMetadataReplicationStatus sql: " + insertStatement.toString());
1155
	            logMetacat.debug("smReplicationStatus sql: " + insertStatement.toString());
1156 1156
	            
1157 1157
	            //execute
1158 1158
	            int rows = insertStatement.executeUpdate();
......
1735 1735
            rows = stmt.executeUpdate();
1736 1736
            stmt.close();
1737 1737
            
1738
            // remove the systemMetadataReplicationPolicy
1739
            query = "delete from systemMetadataReplicationPolicy " + 
1738
            // remove the smReplicationPolicy
1739
            query = "delete from smReplicationPolicy " + 
1740 1740
            "where guid = ?";
1741 1741
            stmt = dbConn.prepareStatement(query);
1742 1742
            stmt.setString(1, guid);
1743
            logMetacat.debug("delete systemMetadataReplicationPolicy: " + stmt.toString());
1743
            logMetacat.debug("delete smReplicationPolicy: " + stmt.toString());
1744 1744
            rows = stmt.executeUpdate();
1745 1745
            stmt.close();
1746 1746
            
1747
            // remove the systemMetadataReplicationStatus
1748
            query = "delete from systemMetadataReplicationStatus " + 
1747
            // remove the smReplicationStatus
1748
            query = "delete from smReplicationStatus " + 
1749 1749
            "where guid = ?";
1750 1750
            stmt = dbConn.prepareStatement(query);
1751 1751
            stmt.setString(1, guid);
1752
            logMetacat.debug("delete systemMetadataReplicationStatus: " + stmt.toString());
1752
            logMetacat.debug("delete smReplicationStatus: " + stmt.toString());
1753 1753
            rows = stmt.executeUpdate();
1754 1754
            stmt.close();
1755 1755
            
src/delete_all_by_pid.sql
65 65

  
66 66
	-- do we want to remove the SM records too?
67 67
	IF deleteSystemMetadata THEN
68
		DELETE FROM systemMetadataReplicationPolicy WHERE guid = pid;
68
		DELETE FROM smReplicationPolicy WHERE guid = pid;
69 69
		GET DIAGNOSTICS deleted_count = ROW_COUNT;
70
		RAISE NOTICE 'Deleted % rows from systemMetadataReplicationPolicy', deleted_count;
70
		RAISE NOTICE 'Deleted % rows from smReplicationPolicy', deleted_count;
71 71
		
72
		DELETE FROM systemMetadataReplicationStatus WHERE guid = pid;
72
		DELETE FROM smReplicationStatus WHERE guid = pid;
73 73
		GET DIAGNOSTICS deleted_count = ROW_COUNT;
74
		RAISE NOTICE 'Deleted % rows from systemMetadataReplicationStatus', deleted_count;
74
		RAISE NOTICE 'Deleted % rows from smReplicationStatus', deleted_count;
75 75
		
76 76
		DELETE FROM systemMetadata WHERE guid = pid;
77 77
		GET DIAGNOSTICS deleted_count = ROW_COUNT;
build.properties
2 2

  
3 3
#Version of this build.  This needs to be a dotted numeric version.  For
4 4
#instance 1.9.1 is okay.  1.9.1_rc1 is not.
5
metacat.version=2.0.4
5
metacat.version=2.0.5
6 6

  
7 7
#This is for packaging purposes.  leave it blank for final production release.
8 8
metacat.releaseCandidate=
README
8 8
Metacat: XML Metadata and Data Management System
9 9
------------------------------------------------                      
10 10

  
11
Version: 2.0.4 Release
11
Version: 2.0.5 Release
12 12

  
13 13
Send feedback and bugs to: metacat-dev@ecoinformatics.org
14 14
                           http://bugzilla.ecoinformatics.org
......
53 53
See the file "docs/install.html" for detailed instructions
54 54
for your OS.
55 55

  
56
Release Notes for 2.0.5:
57
------------------------
58
This patch release focuses on Metacat support for Oracle
59
*SystemMetadata table names have been shortened to comply with Oracle limits.
60

  
56 61
Release Notes for 2.0.4:
57 62
------------------------
58 63
This patch release focuses on Metacat-Metacat replication.

Also available in: Unified diff