Skip to content

Commit

Permalink
icewind: always retrySkipped if validate mode finds discrepancies
Browse files Browse the repository at this point in the history
  • Loading branch information
pdowler committed Dec 13, 2024
1 parent d36dc34 commit 5f449b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 2 additions & 6 deletions icewind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ org.opencadc.icewind.retrySkipped = true
# (optional mode) validate remote and local observation sets for consistency
# this mode always assumes exitWhenComplete=true
# validate mode always assumes retrySkipped and performs retries after validation
org.opencadc.icewind.validate = true
# TODO: this currently adds discrepancies to the list of skipped observations
# but we could automatically retrySkipped whenever validate finds a discrepancy
# so that validate finds and fixes discrepancies
```

The _caom_ database account owns and manages (create, alter, drop) CAOM database objects
Expand Down Expand Up @@ -100,8 +97,7 @@ through the list.
The `icewind` _validate_ mode queries the _repoService_ and local database asnd compares the
two sets of observations, identifies discrepancies (missed delete, missed observation, or
Observation.accMetaChecksum discrepancy) and schedules a retry by creating a new record
in the `caom2.HarvestSkipURI` table. TODO: merge validate and retrySkipped modes into a
single validate-and-repair mode.
in the `caom2.HarvestSkipURI` table.

### cadcproxy.pem (optional)
This client certificate can be provided in /config directory. If present, it is used to
Expand Down
2 changes: 1 addition & 1 deletion icewind/VERSION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## deployable containers have a semantic and build tag
# semantic version tag: major.minor[.patch]
# build version tag: timestamp
VER=0.9.13
VER=0.10.0
TAGS="${VER} ${VER}-$(date --utc +"%Y%m%dT%H%M%S")"
unset VER
6 changes: 6 additions & 0 deletions icewind/src/main/java/org/opencadc/icewind/CaomHarvester.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ public void run() {

if (validateMode) {
ObservationValidator validator = new ObservationValidator(src, collection, dest, batchSize, numThreads, false);
ObservationHarvester obsHarvester = new ObservationHarvester(src, collection, dest, basePublisherID,
batchSize, numThreads, nochecksum);
obsHarvester.setSkipped(skipMode, null);
try {
validator.run();
if (validator.getNumMismatches() > 0) {
obsHarvester.run(); // retry skipped
}
} catch (TransientException ex) {
log.warn("validate " + src.getIdentifier(collection) + " FAIL", ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public class ObservationValidator extends Harvester {
private boolean nochecksum = false;

HarvestSkipURIDAO harvestSkip = null;
private int numMismatches = 0;

public ObservationValidator(HarvestSource src, String collection, HarvestDestination dest,
Integer batchSize, int nthreads, boolean dryrun) {
Expand Down Expand Up @@ -152,12 +153,16 @@ private void init(int nthreads) {
initHarvestState(destObservationDAO.getDataSource(), Observation.class);
}

public int getNumMismatches() {
return numMismatches;
}

@Override
public void run() {
log.info("START VALIDATION: " + Observation.class.getSimpleName());

Progress num = doit();

this.numMismatches = num.found;
if (num.found > 0) {
log.info("finished batch: " + num);
}
Expand Down

0 comments on commit 5f449b8

Please sign in to comment.