r53907 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53906‎ | r53907 | r53908 >
Date:21:44, 28 July 2009
Author:daniel
Status:deferred
Tags:
Comment:
force index in deleteLinksToBadConcepts
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java
@@ -903,7 +903,7 @@
904904 //XXX: should be redundant: just delete alias concepts below and then kill broken links.
905905 // but somehow, we need it...
906906 if (beginTask("finishAliases", "deleteLinksToBadConcepts:link,ALIAS")) {
907 - int n = deleteLinksToBadConcepts(linkTable, "target", ConceptType.ALIAS); //uses index _use.concept, _concept.type
 907+ int n = deleteLinksToBadConcepts(linkTable, "target", "target_anchor", ConceptType.ALIAS); //uses index _use.concept, _concept.type
908908 if (n>0) warning(-1, "links to bad concepts", n+" references to redirects in "+linkTable.getName()+".target deleted", null);
909909 endTask("finishAliases", "deleteLinksToBadConcepts:link,ALIAS", n+" entries");
910910 }
@@ -1049,7 +1049,7 @@
10501050 }
10511051 }
10521052
1053 - protected int deleteLinksToBadConcepts(DatabaseTable table, String conceptIdField, ConceptType... types) throws PersistenceException {
 1053+ protected int deleteLinksToBadConcepts(DatabaseTable table, String conceptIdField, String index, ConceptType... types) throws PersistenceException {
10541054 ReferenceField refField = (ReferenceField)table.getField(conceptIdField);
10551055 DatabaseTable tgtTable = getTable(refField.getTargetTable());
10561056 DatabaseField tgtField = tgtTable.getField(refField.getTargetField());
@@ -1061,11 +1061,12 @@
10621062 String sql = "DELETE FROM "+table.getSQLName()
10631063 +" USING "+table.getSQLName()
10641064 +" JOIN "+conceptTable.getSQLName()
 1065+ + ( index==null ? "" : "force index( "+index+" )" )
10651066 +" ON "+table.getSQLName()+"."+conceptIdField+" = "+conceptTable.getSQLName()+"."+tgtField.getName();
10661067 String where = " WHERE "+conceptTable.getSQLName()+".type IN " + bad;
10671068
10681069 //System.out.println("*** "+sql+" ***");
1069 - return executeChunkedUpdate("deleteLinksToBadConcepts", table.getName()+"."+conceptIdField+" IN "+bad, sql, where, conceptTable, tgtField.getName());
 1070+ return executeChunkedUpdate("deleteLinksToBadConcepts", table.getName()+"."+conceptIdField+" IN "+bad, sql, where, table, conceptIdField);
10701071 }
10711072
10721073 protected int deleteBrokenReferences(DatabaseTable table, String ref) throws PersistenceException {

Status & tagging log