Ignore:
Timestamp:
2024-03-19T17:42:16+01:00 (8 months ago)
Author:
taylor.smock
Message:

reverter: Speed up reverting of large changesets where many objects have changed since the changeset was closed

This is done by using the OSM multi-fetch API to avoid doing a request per
version per object. Instead, we now do a bulk request for a series of versions
until we have all the information we need.

Additional performance enhancements include:

  • Don't do string concatenation prior to logging call for Reverting {target} to {old version}
  • reverter multi-fetch now queries 2k objects or 8k characters, whichever comes first
  • Some locations which fire DataSet events are now wrapped in DataSet#update calls
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reverter/src/reverter/DataSetCommandMerger.java

    r35464 r36230  
    77import java.util.Collection;
    88import java.util.HashMap;
     9import java.util.HashSet;
    910import java.util.LinkedHashSet;
    1011import java.util.LinkedList;
    1112import java.util.List;
    1213import java.util.Map;
     14import java.util.Set;
    1315
    1416import org.openstreetmap.josm.command.ChangeCommand;
     
    3840    private final DataSet targetDataSet;
    3941
    40     private final List<Command> cmds = new LinkedList<>();
    41     private final List<OsmPrimitive> nominalRevertedPrimitives = new LinkedList<>();
     42    private final List<Command> cmds = new ArrayList<>();
     43    private final Set<OsmPrimitive> nominalRevertedPrimitives = new HashSet<>();
    4244
    4345    /**
     
    6062                nominalRevertedPrimitives.add(target);
    6163            }
    62             Logging.debug("Reverting " + target + " to " + newTarget);
     64            Logging.debug("Reverting {0} to {1}", target, newTarget);
    6365        }
    6466    }
     
    126128            // Target node has been deleted by a more recent changeset -> conflict
    127129            } else if (sourceNode.isIncomplete() && !conflicts.hasConflictForMy(targetNode)) {
    128                 localConflicts.add(new Conflict<OsmPrimitive>(targetNode, sourceNode, true));
     130                localConflicts.add(new Conflict<>(targetNode, sourceNode, true));
    129131            } else {
    130132               Logging.info("Skipping target node "+targetNode+" for source node "+sourceNode+" while reverting way "+source);
Note: See TracChangeset for help on using the changeset viewer.