azgs / azlibrary_database

1 stars 1 forks source link

Raster processing appears to be all boogered up #36

Closed NoisyFlowers closed 5 years ago

NoisyFlowers commented 5 years ago

Raster processing in azlibAdd is not working, yet no error manifests.

Investigation shows that the promisifyed child_process.exec in raster.js is not throwing an error even though the psql command it is processing is failing. The command is actually getting errors like this: "ERROR: insert or update on table "rasters" violates foreign key constraint "rasters_collection_id_fkey"\nDETAIL: Key (collection_id)=(48) is not present in table "collections".\npsql:/tmp/tmp-22213Yn0W9u6CIgx3.tmp:3: ERROR: current transaction is aborted, commands ignored until end of transaction block"

My guess is that this has been happening since we switched db processing to all be under a transaction. The call to the psql cli probably occurs outside of this transaction and does not see the collection record, since it has not yet been committed.

So, two problems to be addressed: 1) Do something to make the call to psql work, or replace it with something that does 2) Make sure whatever solution is implemented for (1) manifests errors when it fails