Skip to content

Commit

Permalink
Merge pull request #285 from KNMI/fix-wik-cleanup
Browse files Browse the repository at this point in the history
2.11.3: Less logging and robuster scanner
  • Loading branch information
maartenplieger authored Sep 4, 2023
2 parents 3f747b0 + b346656 commit 53cf02a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER root
LABEL maintainer="adaguc@knmi.nl"

# Version should be same as in Definitions.h
LABEL version="2.11.2"
LABEL version="2.11.3"

######### First stage (build) ############

Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
**Version 2.11.2 2023-08-21**
**Version 2.11.3 2023-09-04**

- Reduced logging during dataset scanning for better traceability
- Stop scanning at early stage when a variable does not exist in a NetCDF file.

**Version 2.11.3 2023-08-21**

- Hot fix: Accidently removed necessary python dependencies in Docker build

Expand Down
23 changes: 20 additions & 3 deletions adagucserverEC/CDBFileScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ int CDBFileScanner::createDBUpdateTables(CDataSource *dataSource, int &removeNon
return 1;
}

// Check if variable is in this file:

if (cdfObject->getVariableNE(dataSource->getDataObject(0)->variableName.c_str()) == NULL) {
CDBError("Variable %s does not exist in %s ", dataSource->getDataObject(0)->variableName.c_str(), dataSource->headerFileName.c_str());
return 1;
}

if (dataSource->cfgLayer->Dimension.size() == 0) {

if (CAutoConfigure::autoConfigureDimensions(dataSource) != 0) {
Expand Down Expand Up @@ -425,7 +432,9 @@ int CDBFileScanner::DBLoopFiles(CDataSource *dataSource, int removeNonExistingFi
}
for (size_t d = 0; d < dataSource->cfgLayer->Dimension.size(); d++) {
if (skipDim[d] == true) {
CDBDebug("Assuming [%s] done", dataSource->cfgLayer->Dimension[d]->attr.name.c_str());
#ifdef CDBFILESCANNER_DEBUG
CDBDebug("Assuming %d/%d [%s] done", j, d, dataSource->cfgLayer->Dimension[d]->attr.name.c_str());
#endif
continue;
}
{
Expand Down Expand Up @@ -539,7 +548,9 @@ int CDBFileScanner::DBLoopFiles(CDataSource *dataSource, int removeNonExistingFi
if (dimVar != NULL && dimDim == NULL) {
// Check for scalar variable
if (dimVar->dimensionlinks.size() == 0) {
#ifdef CDBFILESCANNER_DEBUG
CDBDebug("Found scalar variable %s with no dimension. Creating dim", dimVar->name.c_str());
#endif
dimDim = new CDF::Dimension();
dimDim->name = dimVar->name;
dimDim->setSize(1);
Expand All @@ -549,7 +560,9 @@ int CDBFileScanner::DBLoopFiles(CDataSource *dataSource, int removeNonExistingFi
// Check if this variable has another dim attached
if (dimVar->dimensionlinks.size() == 1) {
dimDim = dimVar->dimensionlinks[0];
#ifdef CDBFILESCANNER_DEBUG
CDBDebug("Using dimension %s for dimension variable %s", dimVar->dimensionlinks[0]->name.c_str(), dimVar->name.c_str());
#endif
}
}

Expand Down Expand Up @@ -975,15 +988,18 @@ int CDBFileScanner::updatedb(CDataSource *dataSource, CT::string *_tailPath, CT:
// First check and create all tables... returns zero on success, positive on error, negative on already done.
status = createDBUpdateTables(dataSource, removeNonExistingFiles, &fileList, scanFlags & CDBFILESCANNER_RECREATETABLES);
if (status > 0) {

CDBError("createDBUpdateTables failed");
throw(__LINE__);
}

if (status == 0) {

// Loop Through all files
status = DBLoopFiles(dataSource, removeNonExistingFiles, &fileList, scanFlags);
if (status != 0) throw(__LINE__);
if (status != 0) {
CDBError("DBLoopFiles failed");
throw(__LINE__);
}

// Clean up if needed
cleanFiles(dataSource, scanFlags);
Expand All @@ -993,6 +1009,7 @@ int CDBFileScanner::updatedb(CDataSource *dataSource, CT::string *_tailPath, CT:
#ifdef USEQUERYTRANSACTIONS
if (removeNonExistingFiles == 1) status = DB->query("COMMIT");
#endif

return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion adagucserverEC/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef Definitions_H
#define Definitions_H

#define ADAGUCSERVER_VERSION "2.11.2" // Please also update in the Dockerfile to the same version
#define ADAGUCSERVER_VERSION "2.11.3" // Please also update in the Dockerfile to the same version

// CConfigReaderLayerType
#define CConfigReaderLayerTypeUnknown 0
Expand Down

0 comments on commit 53cf02a

Please sign in to comment.