Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31049

View with collation doesn't work as expected in sharded cluster

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 3.4.9
    • Fix Version/s: 3.4.10, 3.6.0-rc0
    • Component/s: Querying, Sharding
    • Labels:
    • Environment:
      Mongodb 3.4.9, Ubuntu 16.04, sharded cluster
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4
    • Steps To Reproduce:
      Hide

      In single mongod instance:

      > db.test.insertMany([{"nm": "case"}, {"nm": "CaSe"}, {"nm": "câse"}])
      {
      	"acknowledged" : true,
      	"insertedIds" : [
      		ObjectId("59b7887b90afeae466d0cdcb"),
      		ObjectId("59b7887b90afeae466d0cdcc"),
      		ObjectId("59b7887b90afeae466d0cdcd")
      	]
      }
      > db.createView("view", "test", [{$match: {"nm": "case"}}], {"collation": {"locale": "en", strength: 1}})
      { "ok" : 1 }
      > db.view.find()
      { "_id" : ObjectId("59b7887b90afeae466d0cdcb"), "nm" : "case" }
      { "_id" : ObjectId("59b7887b90afeae466d0cdcc"), "nm" : "CaSe" }
      { "_id" : ObjectId("59b7887b90afeae466d0cdcd"), "nm" : "câse" }
      

      In sharded cluster (2 shards, 3 config server started as replicaSet). Collection is not sharded

      Cluster info :

      mongos> sh.status()
      --- Sharding Status --- 
        sharding version: {
      	"_id" : 1,
      	"minCompatibleVersion" : 5,
      	"currentVersion" : 6,
      	"clusterId" : ObjectId("59b7860fbc018363095e4c79")
      }
        shards:
      	{  "_id" : "shard0000",  "host" : "localhost:27021",  "state" : 1 }
      	{  "_id" : "shard0001",  "host" : "localhost:27022",  "state" : 1 }
        active mongoses:
      	"3.4.9" : 1
       autosplit:
      	Currently enabled: yes
        balancer:
      	Currently enabled:  yes
      	Currently running:  no
      		Balancer lock taken at Tue Sep 12 2017 11:00:35 GMT+0400 (RET) by ConfigServer:Balancer
      	Failed balancer rounds in last 5 attempts:  0
      	Migration Results for the last 24 hours: 
      		No recent migrations
        databases:
      	{  "_id" : "test",  "primary" : "shard0000",  "partitioned" : false }
      

      mongos> db.test.insertMany([{"nm": "case"}, {"nm": "CaSe"}, {"nm": "câse"}])
      {
      	"acknowledged" : true,
      	"insertedIds" : [
      		ObjectId("59b7890412b88ce4ce4ccf30"),
      		ObjectId("59b7890412b88ce4ce4ccf31"),
      		ObjectId("59b7890412b88ce4ce4ccf32")
      	]
      }
      mongos> db.createView("view", "test", [{$match: {"nm": "case"}}], {"collation": {"locale": "en", strength: 1}})
      { "ok" : 1 }
      mongos> db.view.find()
      { "_id" : ObjectId("59b7890412b88ce4ce4ccf30"), "nm" : "case" }
      

      Show
      In single mongod instance: > db.test.insertMany([{ "nm" : "case" }, { "nm" : "CaSe" }, { "nm" : "câse" }]) { "acknowledged" : true , "insertedIds" : [ ObjectId( "59b7887b90afeae466d0cdcb" ), ObjectId( "59b7887b90afeae466d0cdcc" ), ObjectId( "59b7887b90afeae466d0cdcd" ) ] } > db.createView( "view" , "test" , [{$match: { "nm" : "case" }}], { "collation" : { "locale" : "en" , strength: 1}}) { "ok" : 1 } > db.view.find() { "_id" : ObjectId( "59b7887b90afeae466d0cdcb" ), "nm" : "case" } { "_id" : ObjectId( "59b7887b90afeae466d0cdcc" ), "nm" : "CaSe" } { "_id" : ObjectId( "59b7887b90afeae466d0cdcd" ), "nm" : "câse" } In sharded cluster (2 shards, 3 config server started as replicaSet). Collection is not sharded Cluster info : mongos> sh.status() --- Sharding Status --- sharding version: { "_id" : 1 , "minCompatibleVersion" : 5 , "currentVersion" : 6 , "clusterId" : ObjectId( "59b7860fbc018363095e4c79" ) } shards: { "_id" : "shard0000" , "host" : "localhost:27021" , "state" : 1 } { "_id" : "shard0001" , "host" : "localhost:27022" , "state" : 1 } active mongoses: "3.4.9" : 1 autosplit: Currently enabled: yes balancer: Currently enabled: yes Currently running: no Balancer lock taken at Tue Sep 12 2017 11 : 00 : 35 GMT+ 0400 (RET) by ConfigServer:Balancer Failed balancer rounds in last 5 attempts: 0 Migration Results for the last 24 hours: No recent migrations databases: { "_id" : "test" , "primary" : "shard0000" , "partitioned" : false } mongos> db.test.insertMany([{ "nm" : "case" }, { "nm" : "CaSe" }, { "nm" : "câse" }]) { "acknowledged" : true , "insertedIds" : [ ObjectId( "59b7890412b88ce4ce4ccf30" ), ObjectId( "59b7890412b88ce4ce4ccf31" ), ObjectId( "59b7890412b88ce4ce4ccf32" ) ] } mongos> db.createView( "view" , "test" , [{$match: { "nm" : "case" }}], { "collation" : { "locale" : "en" , strength: 1}}) { "ok" : 1 } mongos> db.view.find() { "_id" : ObjectId( "59b7890412b88ce4ce4ccf30" ), "nm" : "case" }
    • Sprint:
      Query 2017-10-02
    • Linked BF Score:
      0

      Description

      Creating a view with a collation in a sharded cluster does not work as expected, whereas it works fine in a single mongod instance

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: