-
Notifications
You must be signed in to change notification settings - Fork 9
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
Restore lost data - 3rd attempt #1473
Comments
Was unable to review completely. Will review after 5pm since need to be away for a work. But found the below:
oct 30 backup had 200 less data with nulls for the program encounter. If we have lost data of encounters outside of the date range (27thNov - 14th Dec - we need to try restore them). |
not planning to run for encounters in CK also |
@petmongrels will analyse if need to run for encounters, we can run for individual and enrolment for now. Regarding this point:
Adding some data here for later reference: in oct29 backup: In prod: --enrolment in oct29 backup: |
@petmongrels from the below queries I think for ihmp it will help to restore data both for registeration and enrolment check for IHMP resgisteration form - individual subject type - contact number concept : oct 29 backup: check for eligible couple enrolment - gravida concept: oct 29 backup: |
these numbers look so different because oct29 backup has less data than
current. more data, more gap. not because it will be able to update so many
records.
https://github.com/avniproject/data-fixes/blob/cfb5301cc7d23075535b6cdd05e34ea8a79bbbbc/ck-ihmp-data-loss/ihmp/4/fix4.sql
…On Thu, Jan 18, 2024 at 8:00 PM mahalakshme ***@***.***> wrote:
@petmongrels <https://github.com/petmongrels> from the below queries I
think for ihmp it will help to restore data both for registeration and
enrolment
*check for IHMP resgisteration form - individual subject type - contact
number concept :*
current prod data:
select count(*) from public.individual where
observations->>'82fa0dbb-92f9-4ec2-9263-49054e64d909' is null and
created_date_time < '2023-10-29'::timestamptz and created_date_time >
'2019-10-29'
and subject_type_id=1; -- 45357
oct 29 backup:
select count(*) from public.individual where
observations->>'82fa0dbb-92f9-4ec2-9263-49054e64d909' is null and
created_date_time < '2023-10-29'::timestamptz and created_date_time >
'2019-10-29'
and subject_type_id=1;
--45077
*check for eligible couple enrolment - gravida concept:*
current prod data:
select count(*) from program_enrolment where
observations->>'dc2c23e9-19ad-471f-81d1-213069ccc975' is null and
created_date_time < '2023-10-29'::timestamptz and created_date_time >
'2019-10-29'
and program_id=11; -- 356
oct 29 backup:
select count(*) from program_enrolment where
observations->>'dc2c23e9-19ad-471f-81d1-213069ccc975' is null and
created_date_time < '2023-10-29'::timestamptz and created_date_time >
'2019-10-29'
and program_id=11; -- 41
—
Reply to this email directly, view it on GitHub
<#1473 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZ3C5MXFOMB326FA7DQTLYPEWZDAVCNFSM6AAAAABB2UIRAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJYGU4DSMZXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Vivek Singh | +91 98452 32929 | @petmongrels
<https://twitter.com/petmongrels>
|
@petmongrels no I have added
|
@petmongrels also from the below queries found that for enrolment data for program id 11, we will not be able to restore only data created outside the data loss period(except for one) from the below query which is a win for us. executed on prod:
|
Expected:
So if we had had the right backups - at max we would lose only data for 22 individuals. So we should work towards achieving this.
Actual - Current
But currently 219 rows dont have houshold number(considering this field since it is a mandatory field)
What so far done:
Previously - data was restored from prerelease - it had data from 30th November prod data. But since the issue was introduced on 27th November there were updates to 600 individuals because of which it had already lost data.
Next attempt was made to restore data from data shared from client(downloaded from reports). But still around 200 individuals didint have even primary data, and even for those updated, we were able to restore only the data available in the downloaded report and not all data of the individuals.
The above had led to major issues for the client.
What can be done:
We have a backup of prod taken on 29th October. So that will have the old data other than the those created after it.
So at max if we restore from the above we should lose only 35+4 = data for 39 individuals. Considering we have also restored from 30th Nov prerelease backup, that might have the data for the ones missed by the restore of Oct-30 backup.
Acceptance criteria:
-- I have restored the data from the snapshot to a RDS instance(host name: oct-29-snapshot-db.avniproject.org) which can be accessed via staging EC2 instance. staging env will continue to work as usual connecting to its staging db.
The text was updated successfully, but these errors were encountered: