From 2708757d1186903849b5d09618186f01a29976cf Mon Sep 17 00:00:00 2001 From: Patrick Dowler Date: Tue, 17 Dec 2024 16:42:37 -0800 Subject: [PATCH] icewind: fix DataSourfce close suppresion for initdb --- icewind/VERSION | 2 +- .../org/opencadc/icewind/CaomHarvester.java | 2 +- .../java/org/opencadc/icewind/Harvester.java | 2 -- .../icewind/ObservationHarvester.java | 30 ++----------------- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/icewind/VERSION b/icewind/VERSION index 1937a67a..17e1c0cb 100644 --- a/icewind/VERSION +++ b/icewind/VERSION @@ -1,6 +1,6 @@ ## deployable containers have a semantic and build tag # semantic version tag: major.minor[.patch] # build version tag: timestamp -VER=0.10.1 +VER=0.10.2 TAGS="${VER} ${VER}-$(date --utc +"%Y%m%dT%H%M%S")" unset VER diff --git a/icewind/src/main/java/org/opencadc/icewind/CaomHarvester.java b/icewind/src/main/java/org/opencadc/icewind/CaomHarvester.java index e14e1e11..9ac142e1 100644 --- a/icewind/src/main/java/org/opencadc/icewind/CaomHarvester.java +++ b/icewind/src/main/java/org/opencadc/icewind/CaomHarvester.java @@ -125,7 +125,7 @@ public CaomHarvester(HarvestSource src, List collections, HarvestDestina ConnectionConfig cc = new ConnectionConfig(null, null, dest.getUsername(), dest.getPassword(), HarvestDestination.POSTGRESQL_DRIVER, dest.getJdbcUrl()); - DataSource ds = DBUtil.getDataSource(cc); + DataSource ds = DBUtil.getDataSource(cc, true, true); this.initdb = new InitDatabase(ds, null, dest.getSchema()); } diff --git a/icewind/src/main/java/org/opencadc/icewind/Harvester.java b/icewind/src/main/java/org/opencadc/icewind/Harvester.java index 2dbed354..50abe1e1 100644 --- a/icewind/src/main/java/org/opencadc/icewind/Harvester.java +++ b/icewind/src/main/java/org/opencadc/icewind/Harvester.java @@ -142,8 +142,6 @@ protected void initHarvestState(DataSource ds, Class c) { log.debug("creating HarvestState tracker: " + cname + " in " + dest.getSchema()); this.harvestStateDAO = new PostgresqlHarvestStateDAO(ds, null, dest.getSchema()); - log.debug("creating HarvestSkip tracker: " + cname + " in " + dest.getSchema()); - this.source = src.getIdentifier(collection).toASCIIString(); } diff --git a/icewind/src/main/java/org/opencadc/icewind/ObservationHarvester.java b/icewind/src/main/java/org/opencadc/icewind/ObservationHarvester.java index fc02bca5..81cfdb9b 100644 --- a/icewind/src/main/java/org/opencadc/icewind/ObservationHarvester.java +++ b/icewind/src/main/java/org/opencadc/icewind/ObservationHarvester.java @@ -182,7 +182,10 @@ private void init(int nthreads) { this.destObservationDAO = new ObservationDAO(); destObservationDAO.setConfig(destConfig); destObservationDAO.setOrigin(false); // copy as-is + initHarvestState(destObservationDAO.getDataSource(), Observation.class); + log.debug("creating HarvestSkip tracker: " + cname + " in " + dest.getSchema()); + this.harvestSkipDAO = new HarvestSkipURIDAO(destObservationDAO.getDataSource(), null, dest.getSchema()); if (srcRepoClient.isObsAvailable()) { ready = true; @@ -834,31 +837,4 @@ public int compare(SkippedWrapperURI o1, SkippedWrapperURI o2) { return o1.skip.getTryAfter().compareTo(o2.skip.getTryAfter()); } } - - /* - * private List> getSkippedState(Date - * start) { log.info("harvest window (skip): " + format(start) + " [" + - * batchSize + "]" + " source = " + source + " cname = " + cname); - * List skip = harvestSkip.get(source, cname, start); - * - * List> ret = new - * ArrayList>(skip.size()); for - * (HarvestSkipURI hs : skip) { ObservationState o = null; - * log.debug("getSkipped: " + hs.getSkipID()); log.debug("start: " + start); - * - * ObservationResponse wr = srcObservationService.get(src.getCollection(), - * hs.getSkipID(), start); - * - * if (wr != null && wr.getObservationState() != null) o = - * wr.getObservationState(); - * - * if (o != null) { ret.add(new SkippedWrapperURI(o, hs)); - * } } return ret; } - */ - @Override - protected void initHarvestState(DataSource ds, Class c) { - super.initHarvestState(ds, c); - this.harvestSkipDAO = new HarvestSkipURIDAO(ds, null, dest.getSchema()); - } - }