Revision 7168
Added by ben leinfelder over 12 years ago
src/edu/ucsb/nceas/metacat/dataone/hazelcast/HazelcastService.java | ||
---|---|---|
462 | 462 |
* and saves them locally. |
463 | 463 |
*/ |
464 | 464 |
private void synchronizeLocalStore() { |
465 |
List<String> localIds = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true); |
|
465 |
List<String> localIds = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true, -1);
|
|
466 | 466 |
if (localIds != null) { |
467 | 467 |
logMetacat.debug("Member missing SystemMetadata entries, count = " + localIds.size()); |
468 | 468 |
for (String localId: localIds) { |
src/edu/ucsb/nceas/metacat/admin/upgrade/dataone/GenerateSystemMetadata.java | ||
---|---|---|
96 | 96 |
// do not include ORE or data, but can generate SystemMetadata for ALL records |
97 | 97 |
final boolean includeOre = false; |
98 | 98 |
final boolean downloadData = false; |
99 |
int serverLocation = -1;
|
|
99 |
int serverLocation = 1; |
|
100 | 100 |
|
101 | 101 |
try { |
102 | 102 |
|
103 | 103 |
// the ids for which to generate system metadata |
104 | 104 |
List<String> idList = null; |
105 |
idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true); |
|
105 |
// only get local objects |
|
106 |
idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true, serverLocation); |
|
106 | 107 |
|
107 | 108 |
// for testing, subset to a limited random number |
108 | 109 |
boolean test = false; |
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
523 | 523 |
* return all local ids in the object store that do not have associated |
524 | 524 |
* system metadata |
525 | 525 |
*/ |
526 |
public List<String> getLocalIdsWithNoSystemMetadata(boolean includeRevisions) |
|
526 |
public List<String> getLocalIdsWithNoSystemMetadata(boolean includeRevisions, int serverLocation)
|
|
527 | 527 |
{ |
528 | 528 |
Vector<String> ids = new Vector<String>(); |
529 | 529 |
String sql = "select docid, rev from xml_documents " + |
530 | 530 |
"where docid not in " + |
531 | 531 |
"(select docid from identifier where guid in (select guid from systemmetadata))"; |
532 |
if (serverLocation > 0) { |
|
533 |
sql = sql + " and server_location = ? "; |
|
534 |
} |
|
532 | 535 |
|
533 | 536 |
String revisionSql = "select docid, rev from xml_revisions " + |
534 | 537 |
"where docid not in " + |
535 | 538 |
"(select docid from identifier where guid in (select guid from systemmetadata))"; |
539 |
if (serverLocation > 0) { |
|
540 |
revisionSql = revisionSql + " and server_location = ? "; |
|
541 |
} |
|
536 | 542 |
|
537 | 543 |
if (includeRevisions) { |
538 | 544 |
sql = sql + " UNION ALL " + revisionSql; |
... | ... | |
548 | 554 |
|
549 | 555 |
// Execute the insert statement |
550 | 556 |
PreparedStatement stmt = dbConn.prepareStatement(sql); |
557 |
// set params based on what we have in the query string |
|
558 |
if (serverLocation > 0) { |
|
559 |
stmt.setInt(1, serverLocation); |
|
560 |
if (includeRevisions) { |
|
561 |
stmt.setInt(2, serverLocation); |
|
562 |
} |
|
563 |
} |
|
551 | 564 |
ResultSet rs = stmt.executeQuery(); |
552 | 565 |
while (rs.next()) |
553 | 566 |
{ |
Also available in: Unified diff
only generate system metadata for original objects.
https://redmine.dataone.org/issues/2721