Project

General

Profile

« Previous | Next » 

Revision 7636

Added by Matt Jones over 11 years ago

CHange replication 'update' query to use a LEFT JOIN so that the performance of the replication update action is improved, which had been causing an HTTP timeout for large metacat installations. See https://projects.ecoinformatics.org/ecoinfo/issues/5929.

View differences:

src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
1441 1441
			StringBuffer docsql = new StringBuffer();
1442 1442
			StringBuffer revisionSql = new StringBuffer();
1443 1443
			
1444
			// Store the deleted docid list
1445
			StringBuffer delsql = new StringBuffer();
1446 1444
			// Store the data set file
1447 1445
			Vector<Vector<String>> packageFiles = new Vector<Vector<String>>();
1448 1446

  
......
1469 1467
			logReplication.info("ReplicationService.handleUpdateRequest - Doc sql: " + docsql.toString());
1470 1468

  
1471 1469
			// Get any deleted documents
1472
			delsql.append("select distinct docid from ");
1473
			delsql.append("xml_revisions where docid not in (select docid from ");
1474
			delsql.append("xml_documents) ");
1470
			StringBuffer delsql = new StringBuffer();
1471
			delsql.append("SELECT t1.docid FROM xml_revisions t1 LEFT JOIN xml_documents t2 on t1.docid = t2.docid WHERE t2.docid IS NULL"); 
1472
			
1475 1473
			// If the localhost is not a hub to the remote server, only replicate
1476 1474
			// the docid' which home server is local host (server_location =1)
1477 1475
			if (!serverList.getHubValue(server)) {
1478
				delsql.append("and server_location = 1");
1476
				delsql.append("and t1.server_location = 1");
1479 1477
			}
1480 1478
			logReplication.info("ReplicationService.handleUpdateRequest - Deleted sql: " + delsql.toString());
1481 1479

  

Also available in: Unified diff