Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database errors with kcor_hw in 2.1.11 reprocessing #382

Closed
mgalloy opened this issue Aug 5, 2024 · 4 comments
Closed

Fix database errors with kcor_hw in 2.1.11 reprocessing #382

mgalloy opened this issue Aug 5, 2024 · 4 comments
Assignees
Labels
bug fix of a problem in the existing code
Milestone

Comments

@mgalloy
Copy link
Member

mgalloy commented Aug 5, 2024

There are several database errors that involve kcor_hw are frequently reported in the logs.

The first is:

2024-07-29 22:35:01 WARN: KCOR_HW_INSERT: cannot find 20240409_174852_kcor_l2_pb.fts.gz

That file is there:

level2$ ll 20240409_174852_kcor_l2_pb.fts.gz
-rw-rw-r--. 1 mgalloy cordyn 2.5M Jul 29 20:19 20240409_174852_kcor_l2_pb.fts.gz

Maybe it was not there when it was needed? Maybe it was just .fts then?

Next is:

2024-07-29 22:35:23 ERROR: KCORDBMYSQL::REPORT_ERROR: error with SQL statement
2024-07-29 22:35:23 ERROR: KCORDBMYSQL::REPORT_ERROR: status: 1
2024-07-29 22:35:23 ERROR: KCORDBMYSQL::REPORT_ERROR: Cannot add or update a child row: a foreign key
constraint fails (`MLSO`.`kcor_eng`, CONSTRAINT `kcor_eng_ibfk_4` FOREIGN KEY (`kcor_hw_id`)
REFERENCES `kcor_hw` (`hw_id`))
2024-07-29 22:35:23 ERROR: KCORDBMYSQL::REPORT_ERROR: SQL command: insert into kcor_eng (file_name,
date_obs, obs_day, rcamfocs, tcamfocs, modltrt, o1focs, kcor_sgsdimv, kcor_sgsdims, level, bunit,
bzero, bscale, rcamxcen, rcamycen, tcamxcen, tcamycen, rcam_rad, tcam_rad, image_scale, mean_phase1,
cover, darkshut, diffuser, calpol, distort, labviewid, socketcamid, kcor_sw_id, kcor_hw_id) values
('20240409_174852_kcor_l2_pb.fts', '2024-04-09T17:48:52', 10132, 0.000000, 0.000000, 31.900000,
133.834000, 8.083000, 0.008747, 3, 'Mean Solar Brightness', 0, 1.000000, 515.299988, 512.299988,
513.229980, 515.229980, 177.759995, 180.820007, 5.614600, 0.000000, 'out', 'out', 'out', 'out',
'dist_coeff_20191216_212805_kcor_darkcorrected_occulter_in_focus.sav', '20191125T093731',
'socketcam.exe', 123308, 0)
@mgalloy mgalloy added the bug fix of a problem in the existing code label Aug 5, 2024
@mgalloy mgalloy added this to the KCor 2.2 milestone Aug 5, 2024
@mgalloy mgalloy self-assigned this Aug 5, 2024
@mgalloy mgalloy closed this as completed Aug 6, 2024
@mgalloy
Copy link
Member Author

mgalloy commented Aug 12, 2024

Fixed issues with duplicated entries for 20240330.

@mgalloy mgalloy reopened this Aug 12, 2024
@mgalloy
Copy link
Member Author

mgalloy commented Aug 29, 2024

A problem with the kcor_hw table in general is that the pipeline is never quite sure when a "new" set of hardware settings is needed. It would probably be best to just copy the contents of kcor_hw into kcor_eng. I think the following would do it:

update kcor_eng
set kcor_eng.EACH_COLUMN = kcor_hw.EACH_COLUMN
from kcor_eng
left join kcor_hw
  on kcor_eng.kcor_hw_id = kcor_hw.hw_id
where kcor_hw.EACH_COLUMN is not null;

@mgalloy
Copy link
Member Author

mgalloy commented Sep 4, 2024

I think this OK now, but need to reprocess again to make sure. Will reprocess along with #365.

@mgalloy
Copy link
Member Author

mgalloy commented Sep 9, 2024

This looks good.

@mgalloy mgalloy closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix of a problem in the existing code
Projects
None yet
Development

No branches or pull requests

1 participant