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

HPCC-15496: Refactor DataBuffer code #8606

Merged
merged 2 commits into from
May 6, 2016

Conversation

ghalliday
Copy link
Member

Signed-off-by: Gavin Halliday gavin.halliday@lexisnexis.com

@ghalliday ghalliday changed the title WIP: refactory DataBuffer code HPCC-15496: Refactor DataBuffer code May 4, 2016
Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
@ghalliday
Copy link
Member Author

@richardkchapman please review.

The main changes are:

  • avoid the DataBufferBase base class, and use the correct types for various pointers
  • don't call noteRelease()/noteLinked() for DataBufferBottom instances.
  • remove the dependence of DataBuffer on HeapletBase

@@ -5081,30 +5077,31 @@ class CDataBufferManager : public CInterface, implements IDataBufferManager
{
if (curBlock)
{
DataBufferBottom *bottom = (DataBufferBottom *) curBlock;
DataBufferBottom *bottom = curBlock;
assertex(((memsize_t)bottom & HEAP_PAGE_OFFSET_MASK) == 0);
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps dbgassertex ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I will change

@HPCCSmoketest
Copy link
Contributor

Automated Smoketest
Sha: 1c17ad1
Build: success
Install hpccsystems-platform-community_6.1.0-trunk0.el6.x86_64.rpm
HPCC Start: OK
HPCC Stop: OK
HPCC Uninstall: OK

bottom->freeChain = x->next;
x->next = NULL;
if (memTraceLevel >= 4)
DBGLOG("RoxieMemMgr: CDataBufferManager::allocate() reallocated DataBuffer - addr=%p", x);
return ::new(x) DataBuffer();
}
else if ((memsize_t)(nextAddr - curBlock) <= HEAP_ALIGNMENT_SIZE-DATA_ALIGNMENT_SIZE)
else if ((((memsize_t)nextAddr) & HEAP_PAGE_OFFSET_MASK) != 0) // Is there any space in the current block
Copy link
Member

Choose a reason for hiding this comment

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

This feels like it is changing the semantics. Before it was testing whether there was room to add DATA_ALIGNMENT_SIZE, now it is testing if already full ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.
It was filling up from DATA_ALIGNMENT_SIZE .. HEAP_ALIGNMENT_SIZE. The previous test could have equally said

(memsize_t)(nextAddr - curBlock) < HEAP_ALIGNMENT_SIZE)

Because HEAP_ALIGNMENT_SIZE is a multiple of DATA_ALIGNMENT_SIZE . (I will add a static assert to check that).

Stage 2 of this change is to move the DataBufferBottom out of the page, so I wanted to remove curBlock form the test. (Having though a little more about that I will need to change this check again to something similar, so maybe I will do that now).

@ghalliday
Copy link
Member Author

@richardkchapman I have updated the code and responded to the comments.

@HPCCSmoketest
Copy link
Contributor

Automated Smoketest
Sha: c4ad8e6
Build: success
Install hpccsystems-platform-community_6.1.0-trunk0.el6.x86_64.rpm
HPCC Start: OK
HPCC Stop: OK
HPCC Uninstall: OK

@@ -5113,7 +5112,7 @@ class CDataBufferManager : public CInterface, implements IDataBufferManager
{
curBlock->Release();
curBlock = NULL;
nextAddr = NULL;
nextBase = NULL;
Copy link
Member

Choose a reason for hiding this comment

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

Should you also clear nextOffset here (and above)?

Copy link
Member

Choose a reason for hiding this comment

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

I suspect it may be important NOT to clear it - in which case a comment would be good

Copy link
Member Author

Choose a reason for hiding this comment

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

I was lazy - it didn't need clearing. A comment would be good though - or clear it.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
@richardkchapman richardkchapman merged commit a8f7280 into hpcc-systems:master May 6, 2016
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.

3 participants