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

Fix RITA clean 'no such command "scale"' error #780

Merged
merged 1 commit into from Jan 17, 2023
Merged

Conversation

Zalgo2462
Copy link
Contributor

If the scale field appears before dbStats when asking MongoDB the size of a collection, the command will fail. The RITA clean command stores this query document using bson.M which does not guarantee the order of the fields. As a result, the command will fail at random. This PR ensures that RITA uses bson.D to store this query document. This preserves the order of the fields each time the code is executed.

Fixes #770

Example mongo shell output:

> db.getSiblingDB("testdb-2022-11-21").runCommand({ "scale": 1024 * 1024, "dbStats": 1})
{
        "ok" : 0,
        "errmsg" : "no such command: 'scale'",
        "code" : 59,
        "codeName" : "CommandNotFound"
}
> db.getSiblingDB("testdb-2022-11-21").runCommand({"dbStats": 1, "scale": 1024 * 1024})
{
        "db" : "testdb-2022-11-21",
        "collections" : 11,
        "views" : 0,
        "objects" : 1017028,
        "avgObjSize" : 762.0969314512481,
        "dataSize" : 739.1680889129639,
        "storageSize" : 244.2265625,
        "numExtents" : 0,
        "indexes" : 59,
        "indexSize" : 95.8359375,
        "scaleFactor" : 1048576,
        "fsUsedSize" : 1208142.41015625,
        "fsTotalSize" : 1625364.50390625,
        "ok" : 1
}

Copy link
Contributor

@lisaSW lisaSW left a comment

Choose a reason for hiding this comment

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

tested

@lisaSW lisaSW merged commit 5cec6d5 into master Jan 17, 2023
@lisaSW lisaSW deleted the 779-rita-clean-fix branch January 17, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants