Symptom: the 'removeQuerySettings' command is retried by the client mongo (legacy) shell on primary step-down, even though the original command has succeeded.
[js_test:query_settings_debug_query_shape] =-=-=-= Retrying on network error for command :: removeQuerySettings, CommandID: 22, error: Error: network error while attempting to run command 'removeQuerySettings' on host 'localhost:20000' :: caused by :: dbclient error communicating with server localhost:20000 :: caused by :: futurize :: caused by :: Connection closed by peer, command: { "removeQuerySettings" : { "aggregate" : "query_settings_debug_query_shape", "$db" : "test", "pipeline" : [ { "$lookup" : { "from" : "inventory", "localField" : "item", "foreignField" : "sku", "as" : "inventory_docs" } }, { "$match" : { "qty" : { "$lt" : 5 }, "manufacturer" : { "$in" : [ "Acme Corporation", "Umbrella Corporation" ] } } }, { "$count" : "itemsLowOnStock" } ] }, "lsid" : { "id" : UUID("eb8945be-1f3d-44c8-8478-309175475b16") }, "$clusterTime" : { "clusterTime" : Timestamp(1705536600, 6), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } }