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

chore: improve handling of rollback scenarios #9680

Merged
merged 1 commit into from
Feb 12, 2025
Merged

chore: improve handling of rollback scenarios #9680

merged 1 commit into from
Feb 12, 2025

Conversation

runspired
Copy link
Contributor

No description provided.

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ bug This PR primarily fixes a reported issue labels Feb 12, 2025
@runspired runspired self-assigned this Feb 12, 2025
@runspired runspired added the ci-perf Activates Performance Checks in CI label Feb 12, 2025
Copy link

Performance Report for 8dd4ec3

Scenario - basic-record-materialization: ☑️ Performance is stable

☑️ duration
phase no difference [-17ms to 2ms]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 0ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-1ms to 1ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -6ms [-12ms to 0ms] OR -0.76% [-1.49% to -0.05%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
☑️ Phase [start-record-materialization] => [end-record-materialization]
phase no difference [-4ms to 4ms]
☑️ Phase [end-record-materialization] => [Test End]
phase no difference [0ms to 0ms]

Scenario - relationship-materialization-simple: ☑️ Performance is stable

☑️ duration
phase no difference [-8ms to 3ms]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-1ms to 0ms]
☑️ Phase [start-find-all] => [start-materialization]
phase no difference [-3ms to 1ms]
☑️ Phase [start-materialization] => [end-materialization]
phase no difference [-3ms to 3ms]
☑️ Phase [end-materialization] => [Test End]
phase no difference [-3ms to 1ms]

Scenario - relationship-materialization-complex: ☑️ Performance is stable

☑️ duration
phase no difference [-27ms to 13ms]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-payload] => [start-peek-records]
phase no difference [-6ms to 1ms]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
☑️ Phase [start-record-materialization] => [start-relationship-materialization]
phase no difference [-3ms to 2ms]
☑️ Phase [start-relationship-materialization] => [end-relationship-materialization]
phase no difference [-20ms to 12ms]
☑️ Phase [end-relationship-materialization] => [Test End]
phase no difference [-3ms to 1ms]

Scenario - unload: ☑️ Performance is stable

☑️ duration
phase no difference [-4ms to 2ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [0ms to 1ms]
☑️ Phase [start-push-payload] => [start-unload-records]
phase no difference [-3ms to 1ms]
☑️ Phase [start-unload-records] => [end-unload-records]
phase no difference [-1ms to 1ms]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - unload-all: ☑️ Performance is stable

☑️ duration
phase no difference [-10ms to 4ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-payload] => [start-materialization]
phase no difference [-6ms to 1ms]
☑️ Phase [start-materialization] => [start-unload-all]
phase no difference [-1ms to 3ms]
☑️ Phase [start-unload-all] => [end-unload-all]
phase no difference [-4ms to 2ms]
☑️ Phase [end-unload-all] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -5ms [-8ms to -1ms] OR -0.96% [-1.65% to -0.23%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [0ms to 1ms]
✅ Phase [start-push-payload] => [start-destroy-records]
phase estimated improvement -3ms [-5ms to -1ms] OR -1.42% [-2.3% to -0.43%]
☑️ Phase [start-destroy-records] => [end-destroy-records]
phase no difference [-3ms to 1ms]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -3ms [-6ms to 0ms] OR -0.68% [-1.42% to -0.01%]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-initial-payload] => [start-push-update-payload]
phase no difference [-3ms to 0ms]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -2ms [-3ms to 0ms] OR -1.82% [-3.41% to -0.13%]
☑️ Phase [end-push-update-payload] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -3ms [-5ms to 0ms] OR -0.65% [-1.29% to -0.05%]
✅ Phase [navigationStart] => [start-push-payload]
phase estimated improvement -1ms [-2ms to 0ms] OR -0.81% [-1.26% to -0.34%]
☑️ Phase [start-push-payload] => [end-push-payload]
phase no difference [-4ms to 0ms]
☑️ Phase [end-push-payload] => [Test End]
phase no difference [-1ms to 0ms]

Copy link

Commit v Release Performance Report for 8dd4ec3

Scenario - basic-record-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -147ms [-155ms to -140ms] OR -8.93% [-9.38% to -8.48%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [0ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [0ms to 3ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -156ms [-162ms to -151ms] OR -17.11% [-17.75% to -16.53%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
⚠️ Phase [start-record-materialization] => [end-record-materialization]
phase estimated regression +7ms [3ms to 10ms] OR +1.7% [0.86% to 2.56%]
☑️ Phase [end-record-materialization] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - relationship-materialization-simple: ☑️ Performance is stable

☑️ duration
phase no difference [-11ms to 0ms]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [0ms to 1ms]
✅ Phase [start-find-all] => [start-materialization]
phase estimated improvement -12ms [-14ms to -10ms] OR -5.55% [-6.63% to -4.46%]
⚠️ Phase [start-materialization] => [end-materialization]
phase estimated regression +4ms [1ms to 6ms] OR +1.67% [0.43% to 2.85%]
⚠️ Phase [end-materialization] => [Test End]
phase estimated regression +2ms [1ms to 3ms] OR +3.83% [1.99% to 5.97%]

Scenario - relationship-materialization-complex: ☑️ Performance is stable

☑️ duration
phase no difference [-4ms to 35ms]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 0ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-1ms to 0ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -57ms [-61ms to -53ms] OR -13.6% [-14.57% to -12.56%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
⚠️ Phase [start-record-materialization] => [start-relationship-materialization]
phase estimated regression +8ms [5ms to 11ms] OR +4.42% [2.8% to 5.91%]
⚠️ Phase [start-relationship-materialization] => [end-relationship-materialization]
phase estimated regression +66ms [51ms to 80ms] OR +4.11% [3.19% to 5%]
☑️ Phase [end-relationship-materialization] => [Test End]
phase no difference [-2ms to 2ms]

Scenario - unload: ✅ Performance improved

✅ duration
phase estimated improvement -30ms [-34ms to -26ms] OR -5.64% [-6.36% to -4.96%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-1ms to 1ms]
✅ Phase [start-push-payload] => [start-unload-records]
phase estimated improvement -56ms [-59ms to -53ms] OR -20.21% [-21.21% to -19.11%]
⚠️ Phase [start-unload-records] => [end-unload-records]
phase estimated regression +26ms [25ms to 27ms] OR +30.62% [29.51% to 31.8%]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [0ms to 1ms]

Scenario - unload-all: ✅ Performance improved

✅ duration
phase estimated improvement -58ms [-69ms to -45ms] OR -4.51% [-5.41% to -3.57%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-2ms to 1ms]
✅ Phase [start-push-payload] => [start-materialization]
phase estimated improvement -68ms [-73ms to -63ms] OR -12.53% [-13.45% to -11.57%]
⚠️ Phase [start-materialization] => [start-unload-all]
phase estimated regression +14ms [11ms to 17ms] OR +6.08% [4.77% to 7.51%]
☑️ Phase [start-unload-all] => [end-unload-all]
phase no difference [-6ms to 2ms]
☑️ Phase [end-unload-all] => [Test End]
phase no difference [0ms to 1ms]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -27ms [-31ms to -24ms] OR -5.13% [-5.87% to -4.52%]
⚠️ Phase [navigationStart] => [start-push-payload]
phase estimated regression +1ms [0ms to 1ms] OR +0.54% [0.07% to 0.99%]
✅ Phase [start-push-payload] => [start-destroy-records]
phase estimated improvement -53ms [-55ms to -50ms] OR -19.45% [-20.26% to -18.61%]
⚠️ Phase [start-destroy-records] => [end-destroy-records]
phase estimated regression +25ms [23ms to 27ms] OR +28.98% [27.07% to 31.18%]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -26ms [-29ms to -22ms] OR -6.22% [-7.05% to -5.43%]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [0ms to 1ms]
✅ Phase [start-push-initial-payload] => [start-push-update-payload]
phase estimated improvement -12ms [-13ms to -10ms] OR -9.59% [-11.06% to -8.14%]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -12ms [-14ms to -11ms] OR -12.66% [-14.55% to -11.05%]
✅ Phase [end-push-update-payload] => [Test End]
phase estimated improvement -1ms [-2ms to -1ms] OR -5.32% [-7.11% to -3.51%]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -25ms [-28ms to -23ms] OR -5.83% [-6.37% to -5.29%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [0ms to 1ms]
✅ Phase [start-push-payload] => [end-push-payload]
phase estimated improvement -54ms [-56ms to -52ms] OR -20% [-20.79% to -19.27%]
⚠️ Phase [end-push-payload] => [Test End]
phase estimated regression +28ms [28ms to 29ms] OR +109.81% [107.59% to 111.83%]

}
} else {
changed = true;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runspired Why do we need this if else when you are performing same operations inside ?
Can we just do it with just one if condition like below

if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {
if ((!remoteClearsLocal && i < priorLocalLength) || i < priorLocalLength || remoteClearsLocal ) {
           if (!changed && j < priorLocalLength) {
             const priorLocalMember = priorLocalState![j];
              changed  = priorLocalMember !== member ? true : false;
           }
         }
       }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!remoteClearsLocal && is the difference. The way we approach deprecation flagging (so that deprecated code can be fully eliminated) is to wrap the full version of the deprecated code in its flag and the else be the full new version.

RE changed = priorLocalMember !== member ? true : false;, we don't do this because once changed is true we never revert it to false.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runspired ok , in that case make it as changed = priorLocalMember !== member && true ;

changed = true;
}
} else {
changed = true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even this if conditions should be optimised as like suggested above

@@ -135,62 +132,3 @@ module('integration/application - Using the store as a service', function (hooks
assert.notStrictEqual(store, secondService, 'the store can be used as a service');
});
});

module('integration/application - Attaching initializer', function (hooks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these test changes intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests test a removed thing, by testing the removed thing they cause a deprecation because its not really there. They were unrelated but I was tired of the noise when running the test suite

@runspired runspired merged commit 183e163 into main Feb 12, 2025
26 of 38 checks passed
@runspired runspired deleted the fix-rollback branch February 12, 2025 20:45
gitKrystan pushed a commit that referenced this pull request Feb 12, 2025
imrpove handling of rollback scenarios
gitKrystan pushed a commit that referenced this pull request Feb 18, 2025
imrpove handling of rollback scenarios
MehulKChaudhari pushed a commit to MehulKChaudhari/ember-data that referenced this pull request Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-perf Activates Performance Checks in CI 🎯 canary PR is targeting canary (default) 🏷️ bug This PR primarily fixes a reported issue
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants