User mover error with rasters + overlays
See original GitHub issueSTR:
- Import a raster into CARTO, and create some overviews (CARTO automatically creates one for level 1)
- Try to move the user
The check _overview_constraint
for the overview can fail. The issues is that with parallel execution, it is possible that the overlay data will be imported before the raster itself, and this check will fail.
Workarounds:
- Run
pg_restore
in order (remove-j X
) <-- this one doesn’t always work. - ~Disable the check before export, reeenable after import. e.g~ (DON’T DO THIS, see further comment about using a pg_restore index):
SELECT DropOverviewConstraints('schema'::name, 'o_16_tablename'::name, 'the_raster_webmercator'::name);
SELECT AddOverviewConstraints('schema'::name, 'o_16_tablename'::name, 'the_raster_webmercator'::name, 'schema'::name, 'tablename'::name, 'the_raster_webmercator'::name, 16);
As this is an uncommon case, I would suggest making -j
parametrizable and just passing that parameter when the raster situation is detected. Slower import but it works.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Error 999999, failed to execute (weighted overlay)
I am getting an error 999999, failed to execute (weighted overlay), while running weighted overlay tool. i selected 6 raster data layers ...
Read more >Weighted Overlay function—ArcGIS Pro | Documentation
This raster function allows you to overlay several rasters using a common measurement scale and weight each according to its importance.
Read more >Weighted Overlay final raster to indicate inputs
I would like to be able to click on a cell and be able to identify which input rasters contributed to the weighted...
Read more >Inconsistencies in error messages using a for loop and ifelse ...
Background -> I'm trying to remove all old forest out of certain forest types by using the overlay function. If the forest is...
Read more >Multi Criteria Overlay Analysis (QGIS3) - QGIS Tutorials and Tips
First step in the overlay analysis, is to convert each data layer to raster. An important consideration is that all rasters must be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Disclaimer: read the full comment before doing anything based on this.
For future reference, the
-j1
hack didn’t work at CartoDB/tech-ops/issues/292. The error (check the comment) was weird because the constraint didn’t appear at the index file, so I chose a different manual alternative.This would’ve been the “normal manual” approach:
pg_restore
with-l
so it outputs an index. That output must be redirected to a file. Example:pg_restore -l /tmp/user_export_<id>/data/org_<id>.dump > /tmp/org.dump.index
;
) the lines with overview constraints.pg_restore
) with -L <patched index file> so it skips the overviews.Nevertheless, I had to do this:
pg_restore
with-l
so it outputs an index. That output must be redirected to a file. Example:pg_restore -l /tmp/user_export_<id>/data/org_<id>.dump > /tmp/org.dump.index
;
) the lines withTABLE DATA
from overviews (lines containingTABLE DATA
on an overview table, which are the ones that begin witho_
).services/user-mover/import_user.rb
, adding-L /tmp/org.dump.index
topg_restore
command./tmp/user_imports$ /usr/lib/postgresql/9.5/bin/pg_restore -e --verbose --disable-triggers -L /tmp/org.dump.index -Fc /tmp/user_imports/data/org_<id>.dump -U postgres -h <IP> -p 5432 -d cartodb_user_<id>_db
This also failed, same error 🎉
So, let’s drop the constraint and copy the data:
Uncomment the lines of the index and run again so it just imports the data tables:
/tmp/user_imports$ /usr/lib/postgresql/9.5/bin/pg_restore -e --verbose --disable-triggers -L /tmp/org.dump.index -Fc /tmp/user_imports/data/org_<id>.dump -U postgres -h <IP> -p 5432 -d cartodb_user_<id>_db
Recreate the overviews:
This approach is better than dropping + recreating the constraints because it doesn’t require touching the source DB. Nevertheless, in this case we could’ve considered doing that instead, because it’s really strange that the index didn’t contain the failing constraints.
It’s not exactly a trick, but it is not ideal either. I’d be more comfortable adding it to the json generated by user-mover than to the migration models.
Anyway, I just realised that we can properly detect it on import, by checking if the dump file has an
_overview_constraint
in it (pg_restore -l
and some grepping should do it). So no, you are not adding more fields to my lean models! Stop trying to convince me! 😛