[SERVER-50501] Move TransactionsUtil.deepCopyObject to a more generic library Created: 24/Aug/20  Updated: 12/Dec/23

Status: Backlog
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Backlog - Cluster Scalability
Resolution: Unresolved Votes: 0
Labels: neweng, sharding-common-backlog, sharding-nyc-test-improvements
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-40425 fix Object.extend() for all custom ja... Backlog
is related to SERVER-61079 Move TransactionsUtil.deepCopyObject ... Closed
Assigned Teams:
Cluster Scalability
Participants:

 Description   

This method is being used outside transactions tests, so it doesn't make sense for it to be in a transactions-specific library:

$ git grep deepCopyObject jstests/
jstests/concurrency/fsm_libs/fsm.js:115:                        data = TransactionsUtil.deepCopyObject({}, args.data);
jstests/libs/override_methods/network_error_and_txn_override.js:595:        const objCopy = TransactionsUtil.deepCopyObject({}, cmdObj);
jstests/libs/transactions_util.js:80:    function deepCopyObject(dst, src) {
jstests/libs/transactions_util.js:93:                    v = deepCopyObject({}, v);
jstests/libs/transactions_util.js:95:                    v = deepCopyObject([], v);
jstests/libs/transactions_util.js:114:        deepCopyObject,

Having it in this library also makes it less discoverable.

It would be better to put it in src/mongo/shell/types.js next to extend, which it was originally based on.



 Comments   
Comment by Max Hirschhorn [ 16/Dec/22 ]

Haley had made a similar request in SERVER-61079 so please see this comment from me for why I would recommend against encouraging any further usages of TransactionsUtil.deepCopyObject().

Generated at Thu Feb 08 05:22:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.