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

Sync issue #1524

Closed
Tracked by #1659
mahalakshme opened this issue Sep 26, 2024 · 13 comments
Closed
Tracked by #1659

Sync issue #1524

mahalakshme opened this issue Sep 26, 2024 · 13 comments
Assignees

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Sep 26, 2024

User: anjalifc@cini, anjalib@cini, anjalibps@apfodisha
apk: 9.4
env: prod
fresh sync

Image

Stacktrace:

09-24 00:14:05.999  4348  4395 D ReactNativeJS: [12:14:05:999] [SyncService][Debug] Before filter entityResources length: 7, after filter entityResources length: 7, entities length  7
09-24 00:14:05.999  4348  4395 D ReactNativeJS: [12:14:05:999] [SyncService][Debug] Creating entity create functions for schema DashboardSectionCardMapping
09-24 00:14:05.999  4348  4395 D ReactNativeJS: [12:14:05:999] [SyncService][Debug] Syncing - DashboardSectionCardMapping with subType:
09-24 00:14:06.000  4348  4395 D ReactNativeJS: [12:14:06:000] [SyncService][Debug] Creating entity create functions for [object Object]
09-24 00:14:06.010  4348  4395 D ReactNativeJS: [12:14:06:009] [ErrorHandler][Debug] SyncComponent-Sync
09-24 00:14:06.010  4348  4395 E ReactNativeJS: 'SyncComponent-Sync', 'card are mandatory for DashboardSectionCardMapping, Keys being saved - uuid,displayOrder,voided,dashboardSection,card. UUID: a1a69c7f-3b68-4ebf-8e88-af2657e8e2f2, {}', 'Error: card are mandatory for DashboardSectionCardMapping, Keys being saved - uuid,displayOrder,voided,dashboardSection,card. UUID: a1a69c7f-3b68-4ebf-8e88-af2657e8e2f2\n    at create (address at index.android.bundle:1:1104391)\n    at anonymous (address at index.android.bundle:1:1252484)\n    at anonymous (address at index.android.bundle:1:1252397)\n    at map (native)\n    at anonymous (address at index.android.bundle:1:1252383)\n    at write (native)\n    at write (address at index.android.bundle:1:1104836)\n    at bulkSaveOrUpdate (address at index.android.bundle:1:1252355)\n    at persistAll (address at index.android.bundle:1:1552044)\n    at processResponse (address at index.android.bundle:1:1555213)\n    at anonymous (address at index.android.bundle:1:1555472)\n    at tryCallOne (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/2k3l5153/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)\n    at anonymous (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/2k3l5153/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)\n    at apply (native)\n    at anonymous (address at index.android.bundle:1:246985)\n    at _callTimer (address at index.android.bundle:1:245979)\n    at _callReactNativeMicrotasksPass (address at index.android.bundle:1:246144)\n    at callReactNativeMicrotasks (address at index.android.bundle:1:248066)\n    at __callReactNativeMicrotasks (address at index.android.bundle:1:97211)\n    at anonymous (address at index.android.bundle:1:96350)\n    at __guard (address at index.android.bundle:1:97088)\n    at flushedQueue (address at index.android.bundle:1:96261)\n    at invokeCallbackAndReturnFlushedQueue (address at index.android.bundle:1:96204)'
09-24 00:14:06.018  4348  4395 D ReactNativeJS: [12:14:06:018] [SyncComponent::AC][Debug] Dispatching action: "SyncTelemetryActions.SYNC_FAILED"
09-24 00:14:06.029  4348  4395 D ReactNativeJS: [12:14:06:029] [SyncComponent::AC][Debug] Dispatched action completed: "SyncTelemetryActions.SYNC_FAILED" {"syncing":true,"isConnected":true,"progress":0.33999999999999964,"message":"downloadForms","syncMessage":"syncingData","startSync":false,"backgroundSyncInProgress":false,"startTime":1727116945452,"numberOfPagesProcessedForCurrentEntity":0,"totalNumberOfPagesForCurrentEntity":1}
09-24 00:14:06.030  4348  4395 D ReactNativeJS: [12:14:06:030] [SyncComponent::AC][Debug] Dispatching action: "SYNC.ON_ERROR"
09-24 00:14:06.037  4348  4395 D ReactNativeJS: [12:14:06:037] [SyncComponent::AC][Debug] Dispatched action completed: "SYNC.ON_ERROR" {"syncing":false,"isConnected":true,"progress":0.33999999999999964,"message":"downloadForms","syncMessage":"syncingData","startSync":false,"backgroundSyncInProgress":false,"startTime":1727116945452,"numberOfPagesProcessedForCurrentEntity":0,"totalNumberOfPagesForCurrentEntity":1}
09-24 00:14:06.039  4348  4395 W ReactNativeJS: registerHeadlessTask or registerCancellableHeadlessTask called multiple times for same key 'syncJob'
09-24 00:14:06.042  4348  4395 I ReactNativeJS: [12:14:06:042] [AvniBackgroundJob-SyncJobSchedule][Info] Successfully scheduled
09-24 00:14:06.212  4348  4395 I ReactNativeJS: [12:14:06:212] [Sync][Info] Starting background sync
09-24 00:14:06.212  4348  4395 I ReactNativeJS: [12:14:06:212] [Sync][Info] Skipping auto-sync since it is disabled
@mahalakshme mahalakshme converted this from a draft issue Sep 26, 2024
@mahalakshme mahalakshme moved this from In Analysis to Ready in Avni Product Sep 26, 2024
@1t5j0y 1t5j0y self-assigned this Sep 26, 2024
@1t5j0y 1t5j0y moved this from Ready to In Progress in Avni Product Sep 26, 2024
@himeshr
Copy link
Contributor

himeshr commented Sep 26, 2024

Issue root-cause is migration "V1_342_1__SetDefaultsForStandardReportCardInput.sql", which does report_card new fields edit conditionally.
The reason we didnt face this issue earlier, was because, the migration happened long before EndOfLife1 attribute date value in our test environments.

To resolve the issue, changed the prod_vars value to

avni_endpoint_end_of_life_1: "2024-09-27"

Only entities that were modified today and included under endOfLifeEndpoints was report-cards.

select count(*) from dashboard where last_modified_date_time > '2024-09-26'::timestamp; --0
select count(*) from report_card where last_modified_date_time > '2024-09-26'::timestamp; --88
select count(*) from dashboard_section where last_modified_date_time > '2024-09-26'::timestamp; --0
select count(*) from dashboard_filter where last_modified_date_time > '2024-09-26'::timestamp; --0
select count(*) from dashboard_section_card_mapping where last_modified_date_time > '2024-09-26'::timestamp; --0
select count(*) from group_dashboard where last_modified_date_time > '2024-09-26'::timestamp; --0

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Sep 26, 2024
@mahalakshme
Copy link
Contributor Author

sync for cini working now

@himeshr
Copy link
Contributor

himeshr commented Sep 27, 2024

sync for cini working now

Further testing suggestions, After fresh sync on 9.4 for cini user

  • Upgrade of the app from 9.4 to 10.0 prod dev apk as well and confirm that there are no issues post that
  • And also a fresh sync on 10.0 for the cini user and confirm that there are no issues post that

@himeshr himeshr moved this from Code Review Ready to QA Failed in Avni Product Sep 27, 2024
@himeshr himeshr moved this from QA Failed to QA Ready in Avni Product Sep 27, 2024
@1t5j0y 1t5j0y assigned himeshr and unassigned 1t5j0y Sep 27, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Sep 27, 2024
@AchalaBelokar
Copy link

@AchalaBelokar AchalaBelokar moved this from In QA to QA Failed in Avni Product Sep 27, 2024
@himeshr
Copy link
Contributor

himeshr commented Sep 27, 2024

@AchalaBelokar Does the issue get resolved on fresh sync.? Need this info to provide proper fix.

@AchalaBelokar
Copy link

@himeshr no after doing the fresh sync I am facing the same issue.

@himeshr himeshr moved this from QA Failed to In Progress in Avni Product Sep 27, 2024
@AchalaBelokar
Copy link

AchalaBelokar commented Sep 27, 2024

And I am download 10.0 version it is stuck on loading page that is on avni.
After clearing the data. I am able to Login with respected id.

himeshr added a commit to avniproject/avni-models that referenced this issue Sep 27, 2024
@himeshr
Copy link
Contributor

himeshr commented Sep 27, 2024

Discussion notes

  • Do not make any data-fix to mitiagate the report card load on custom dashboard on upgrade from 9.4 to 10.0
  • Fix failure in 10.0 apk

Code changes done

  • In models, init default values for new reportCard fields : standardReportCardInputSubjectTypes, standardReportCardInputPrograms, standardReportCardInputEncounterTypes
  • In Client, have a default value for duration param in indService.recentlyRegisteredV2

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Sep 27, 2024
@1t5j0y 1t5j0y moved this from In Code Review to QA Ready in Avni Product Sep 30, 2024
@petmongrels
Copy link
Contributor

  • binding recentlyRegisteredV2 etc should not be required, as it is getting invoked expclity on the service object instance and not via use of object mapping
  • instead of checking for standardReportCardInputRecentDurationJSON being empty we should initialise it with default value in the migration if it is not present

@petmongrels petmongrels moved this from QA Ready to Ready in Avni Product Sep 30, 2024
@petmongrels petmongrels self-assigned this Sep 30, 2024
@petmongrels
Copy link
Contributor

  1. Lists are initialised to empty array by default so they need to be initialised.

petmongrels added a commit to avniproject/avni-models that referenced this issue Sep 30, 2024
… removed get recent input duration default value from getter. realm initialises list to empty array by default. initialise with default values for duration input standard report card types.
@himeshr
Copy link
Contributor

himeshr commented Oct 1, 2024

RealmDB file of version 9.4 to test the fix using 10.0.1 apk. Do put db and login as anjalifc user of cini org.

@himeshr himeshr moved this from Code Review Ready to In Code Review in Avni Product Oct 1, 2024
@himeshr himeshr moved this from In Code Review to QA Ready in Avni Product Oct 1, 2024
@AchalaBelokar
Copy link

  • for 10.0 when I click on dashboard it is showing same error and 10.0.1 is showing the same error.

@AchalaBelokar AchalaBelokar moved this from In QA to QA Failed in Avni Product Oct 1, 2024
@himeshr
Copy link
Contributor

himeshr commented Oct 1, 2024

  • for 10.0 when I click on dashboard it is showing same error and 10.0.1 is showing the same error.

AAh, this is because of my mistake while specifying test case..

Instead of this test case:

1> Login using 9.4

setup fast sync
Update to 10.0.0
Update to 10.0.1

Follow this one:

1> Login using 9.4

setup fast sync
Update to 10.0.1

The reason is that, since DBMigration for both 10.0 and 10.0.1 is the same, it'll not resolve the issue on install of 10.0.1 on top of 10.0.

@himeshr himeshr moved this from QA Failed to QA Ready in Avni Product Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

6 participants