[COMPASS-4770] "Shard results differ" warning when sharding is not used Created: 26/Apr/21  Updated: 29/Oct/23  Resolved: 04/Oct/21

Status: Closed
Project: Compass
Component/s: Explain
Affects Version/s: None
Fix Version/s: 1.29.4

Type: Bug Priority: Major - P3
Reporter: Anna Henningsen Assignee: Anna Henningsen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Story Points: 3
Documentation Changes: Not Needed
Sprint: Iteration Minsk

 Description   

for (let i = 0; i < 10000; i++) db.coll.insertOne({ a: ((Math.random() * 1000) | 0), b: ((Math.random() * 1000) | 0) });
db.coll.createIndex({a:1})
db.coll.createIndex({b:1})

Then explain in Compass for a query like

{$or:[{a:200},{b:300}]}

will result in a “Shard results differ” warning message in the explain output because the server performs two index scans using different indexes, even though sharding is not involved.



 Comments   
Comment by Githook User [ 18/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: fix(explain-plan): migrate to TS/away from Ampersand, fix sharding warning bug (#2494)

  • chore(explain-plan): drop serverVersion from state

This does not have any actual impact on the UI.

  • feat(explain-plan): replace explain-plan ampersand model

Replace the explain-plan-model Ampersand model and replace
it with a typescript helper package.

This new package matches the model broadly, except in a
few aspects:

  • It automatically includes the SBE compatibiltiy helper,
    removing the need to apply it explicitly in compass-explain-plan.
  • The “raw” original data property is exposed directly, not
    attached via monkey-patching in compass-explain-plan.
  • `model.serialize()` is gone, the compass-explain-plan
    package now manually unpacks the properties it uses.
    This may not look very pretty, but at least it doesn’t
    hide the fact that we are using the object as an untyped
    bag of properties anymore.
  • The child stage iterator helper is exposed, allowing some
    code redundancy between the packages to be removed.
  • Support for pre-3.0 server explain plans is dropped.
  • chore(explain-plan): replace usedIndex field to make it more meaningful

Replace the `usedIndex` field, which had an odd typing to begin
with, with a `usedIndexes` field that reflects all indices used
and what shards they were used on in a consistent way that matches
its actual usage.

  • fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: compass-5113-remove-loading-screen-from-the-app
https://github.com/mongodb-js/compass/commit/5f78690e663bd94bfbb4a1bb26398fae5fa1a73a

Comment by Githook User [ 12/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: fix(explain-plan): migrate to TS/away from Ampersand, fix sharding warning bug (#2494)

  • chore(explain-plan): drop serverVersion from state

This does not have any actual impact on the UI.

  • feat(explain-plan): replace explain-plan ampersand model

Replace the explain-plan-model Ampersand model and replace
it with a typescript helper package.

This new package matches the model broadly, except in a
few aspects:

  • It automatically includes the SBE compatibiltiy helper,
    removing the need to apply it explicitly in compass-explain-plan.
  • The “raw” original data property is exposed directly, not
    attached via monkey-patching in compass-explain-plan.
  • `model.serialize()` is gone, the compass-explain-plan
    package now manually unpacks the properties it uses.
    This may not look very pretty, but at least it doesn’t
    hide the fact that we are using the object as an untyped
    bag of properties anymore.
  • The child stage iterator helper is exposed, allowing some
    code redundancy between the packages to be removed.
  • Support for pre-3.0 server explain plans is dropped.
  • chore(explain-plan): replace usedIndex field to make it more meaningful

Replace the `usedIndex` field, which had an odd typing to begin
with, with a `usedIndexes` field that reflects all indices used
and what shards they were used on in a consistent way that matches
its actual usage.

  • fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: COMPASS-5053-loading-status
https://github.com/mongodb-js/compass/commit/5f78690e663bd94bfbb4a1bb26398fae5fa1a73a

Comment by Githook User [ 11/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: fix(explain-plan): migrate to TS/away from Ampersand, fix sharding warning bug (#2494)

  • chore(explain-plan): drop serverVersion from state

This does not have any actual impact on the UI.

  • feat(explain-plan): replace explain-plan ampersand model

Replace the explain-plan-model Ampersand model and replace
it with a typescript helper package.

This new package matches the model broadly, except in a
few aspects:

  • It automatically includes the SBE compatibiltiy helper,
    removing the need to apply it explicitly in compass-explain-plan.
  • The “raw” original data property is exposed directly, not
    attached via monkey-patching in compass-explain-plan.
  • `model.serialize()` is gone, the compass-explain-plan
    package now manually unpacks the properties it uses.
    This may not look very pretty, but at least it doesn’t
    hide the fact that we are using the object as an untyped
    bag of properties anymore.
  • The child stage iterator helper is exposed, allowing some
    code redundancy between the packages to be removed.
  • Support for pre-3.0 server explain plans is dropped.
  • chore(explain-plan): replace usedIndex field to make it more meaningful

Replace the `usedIndex` field, which had an odd typing to begin
with, with a `usedIndexes` field that reflects all indices used
and what shards they were used on in a consistent way that matches
its actual usage.

  • fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: compass-home-ts
https://github.com/mongodb-js/compass/commit/5f78690e663bd94bfbb4a1bb26398fae5fa1a73a

Comment by Githook User [ 05/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: fix(explain-plan): migrate to TS/away from Ampersand, fix sharding warning bug (#2494)

  • chore(explain-plan): drop serverVersion from state

This does not have any actual impact on the UI.

  • feat(explain-plan): replace explain-plan ampersand model

Replace the explain-plan-model Ampersand model and replace
it with a typescript helper package.

This new package matches the model broadly, except in a
few aspects:

  • It automatically includes the SBE compatibiltiy helper,
    removing the need to apply it explicitly in compass-explain-plan.
  • The “raw” original data property is exposed directly, not
    attached via monkey-patching in compass-explain-plan.
  • `model.serialize()` is gone, the compass-explain-plan
    package now manually unpacks the properties it uses.
    This may not look very pretty, but at least it doesn’t
    hide the fact that we are using the object as an untyped
    bag of properties anymore.
  • The child stage iterator helper is exposed, allowing some
    code redundancy between the packages to be removed.
  • Support for pre-3.0 server explain plans is dropped.
  • chore(explain-plan): replace usedIndex field to make it more meaningful

Replace the `usedIndex` field, which had an odd typing to begin
with, with a `usedIndexes` field that reflects all indices used
and what shards they were used on in a consistent way that matches
its actual usage.

  • fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: electron-13-same-keytar-node-14
https://github.com/mongodb-js/compass/commit/5f78690e663bd94bfbb4a1bb26398fae5fa1a73a

Comment by Githook User [ 04/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: fix(explain-plan): migrate to TS/away from Ampersand, fix sharding warning bug (#2494)

  • chore(explain-plan): drop serverVersion from state

This does not have any actual impact on the UI.

  • feat(explain-plan): replace explain-plan ampersand model

Replace the explain-plan-model Ampersand model and replace
it with a typescript helper package.

This new package matches the model broadly, except in a
few aspects:

  • It automatically includes the SBE compatibiltiy helper,
    removing the need to apply it explicitly in compass-explain-plan.
  • The “raw” original data property is exposed directly, not
    attached via monkey-patching in compass-explain-plan.
  • `model.serialize()` is gone, the compass-explain-plan
    package now manually unpacks the properties it uses.
    This may not look very pretty, but at least it doesn’t
    hide the fact that we are using the object as an untyped
    bag of properties anymore.
  • The child stage iterator helper is exposed, allowing some
    code redundancy between the packages to be removed.
  • Support for pre-3.0 server explain plans is dropped.
  • chore(explain-plan): replace usedIndex field to make it more meaningful

Replace the `usedIndex` field, which had an odd typing to begin
with, with a `usedIndexes` field that reflects all indices used
and what shards they were used on in a consistent way that matches
its actual usage.

  • fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: main
https://github.com/mongodb-js/compass/commit/5f78690e663bd94bfbb4a1bb26398fae5fa1a73a

Comment by Githook User [ 01/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: 4770-dev
https://github.com/mongodb-js/compass/commit/8513af412931a82809f78e3d7ba136259555ab9d

Comment by Githook User [ 01/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: 4770-dev
https://github.com/mongodb-js/compass/commit/25e73bc6d44eb2294586f13afd5e1b6d4067ff50

Comment by Githook User [ 01/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: 4770-dev
https://github.com/mongodb-js/compass/commit/535e918ad5de1cb358aa4d97908e9e32b7b09908

Comment by Githook User [ 01/Oct/21 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(explain-plan): do not display shard warning when inappropriate COMPASS-4770

This warning is supposed to tell people about situations in which
different shards used difference indices in their explain plan,
which is fine to warn about.

However, the check was fairly naïve and only warned whether multiple
indices were used at all. That can lead to false positives, since
using multiple indices by itself is not problematic.

Address this by grouping the used indices by the shards they were
run on, and seeing if these structures actually differ between
the individual shards.
Branch: 4770-dev
https://github.com/mongodb-js/compass/commit/745915cd8d2e5f235ed1f90ad203a268425cfc7a

Generated at Wed Feb 07 22:37:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.