[DOCS-524] Turn recommendation into example for padding with compact Created: 14/Sep/12  Updated: 30/Oct/23  Resolved: 17/Sep/12

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: v1.0
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 11 years, 22 weeks, 1 day ago

 Description   

http://docs.mongodb.org/manual/reference/commands/#compact

Where did the the section recommending 10% or 100 bytes of padding come from? This is not something that should be recommended as a hard and fast rule, but the information should be preserved as an example showing how one can use paddingFactor and paddingBytes options to compact.



 Comments   
Comment by auto [ 19/Sep/12 ]

Author:

{u'date': u'2012-09-18T17:46:02-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: merge: DOCS-524
Branch: master
https://github.com/mongodb/docs/commit/ddeb0c9d348c72c7533074a2d429770d4194cd17

Comment by auto [ 19/Sep/12 ]

Author:

{u'date': u'2012-09-18T12:41:21-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-524 compact method equation use option directives
Branch: master
https://github.com/mongodb/docs/commit/6020e67032497c7cc7794d850b680fb7bc1d6ec2

Comment by auto [ 19/Sep/12 ]

Author:

{u'date': u'2012-09-18T07:12:53-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-524 explain paddingFactor equation
Branch: master
https://github.com/mongodb/docs/commit/93decd9b11534c5f41d2f2e4d98bd066d1e65ba5

Comment by Kay Kim (Inactive) [ 17/Sep/12 ]

Hey Dan –

I think I can kind of explain the padding equation:

paddingFactor: 4.0 would only add 120 bytes (i.e. 40 * (4.0 - 1)) of
padding

If we gloss over some of the other manipulations, the source code allocates
document space = (originalDocumentLength) * PaddingFactor ; which would
have been 40 * 4.0 = 160 bytes (in our example) of which 120 would be
padding.

I'm going to set up a meeting with either Mathias to discuss some of these
other manipulations of the padding factor, including when you would set
both the paddingFactor and the paddingBytes.

oldObjSize += sz;
oldObjSizeWithPadding += recOld->netLength();

unsigned lenWHdr = sz + Record::HeaderSize;
unsigned lenWPadding = lenWHdr;
{
lenWPadding = static_cast<unsigned>(pf*lenWPadding);
lenWPadding += pb;
lenWPadding = lenWPadding & quantizeMask(lenWPadding);
if( lenWPadding < lenWHdr || lenWPadding > BSONObjMaxUserSize
/ 2 )

{ lenWPadding = lenWHdr; }

}

For now, I'll comment out the equation in the documentation. Although,
from the code, it probably may be good to document that the
paddingFactor/Bytes may be overridden if the lengthWithThe Padding is less
then lengthWHdr or is too big. But, I'll wait until discussing with
Mathias.

Regards,

Kay

Comment by Kay Kim (Inactive) [ 17/Sep/12 ]

Hi Dan –
we've updated the document.

http://docs.mongodb.org/manual/reference/command/compact/

Also, this morning, you mentioned that the old DOC page seemed misleading
since the padding is on the documents rather than the collection. Do you
want us to change the new page to explicitly state that the padding is on
the documents?

Regards,

Kay

Comment by auto [ 17/Sep/12 ]

Author:

{u'date': u'2012-09-17T09:39:57-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: merge: DOCS-524
Branch: master
https://github.com/mongodb/docs/commit/72a324fc12df734e0298cc6d947ec26c0aaf571b

Comment by auto [ 17/Sep/12 ]

Author:

{u'date': u'2012-09-17T09:15:46-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-524 – fix the accidental combination of padding bytes and factor
Branch: master
https://github.com/mongodb/docs/commit/22c5f8c57a6deb5c991caee09de935adabbda7a0

Comment by auto [ 17/Sep/12 ]

Author:

{u'date': u'2012-09-17T07:29:09-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: DOCS-524 style correction
Branch: master
https://github.com/mongodb/docs/commit/98879609c449031d510059cebcb1c93c001f2194

Comment by auto [ 17/Sep/12 ]

Author:

{u'date': u'2012-09-17T07:25:56-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: merge: DOCS-524
Branch: master
https://github.com/mongodb/docs/commit/75b890510c0895c75de4a994ff4a3aa124521a19

Comment by auto [ 17/Sep/12 ]

Author:

{u'date': u'2012-09-14T20:28:33-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-524 change recommendation to example
Branch: master
https://github.com/mongodb/docs/commit/b7ca8e24471bb2d53a5eba0dc7ed781be8a82630

Generated at Thu Feb 08 07:38:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.