You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@impala.apache.org by "Tim Armstrong (Code Review)" <ge...@cloudera.org> on 2016/07/20 17:14:36 UTC

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Tim Armstrong has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/3688

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................

IMPALA-3201: HEADER ONLY: buffer pool

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 422 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/1
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 1
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Dan Hecht (Code Review)" <ge...@cloudera.org>.
Dan Hecht has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 4:

(21 comments)

http://gerrit.cloudera.org:8080/#/c/3688/4/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS4, Line 62: one buffer pool client
pages can only have one client.


PS4, Line 65: to hold another page.
should clarify that the buffer could also be used as a plain buffer.


PS4, Line 72: buffers in memory.
buffers are always in memory. should say "have access to a certain number of buffers" or something like that.


PS4, Line 96: page
            : /// or buffer
nit: buffer or page 
(for consistency in order)


PS4, Line 98: buffer
same


PS4, Line 100: converting
what does this mean? extracting?
also you can get the BufferHandle that backs a pinned page without extracting.


PS4, Line 100: page
buffer


PS4, Line 104: Reference Counting 
are the page handles actually referenced counted? or is this talking about pin counts?


PS4, Line 106: Multiple handles to a page can exist at any
             : /// given time, allowing for multiple handles to the same page to be used by the same
             : /// client.
is this allowed so that read and write iterators can reference the same page? or something else?


PS4, Line 125: CloseHandle
FreeBuffer()


PS4, Line 126: Transfer
TransferBuffer()


PS4, Line 127: operator
client


Line 152: /// operations with the same Client, PageHandle or BufferHandle.
this seems more than an implementation detail.  i.e clients can't know how to use this interface without knowing the synchronization rules laid out here.  So I'd remove "IMPLEMENTATION DETAILS" and rename the section "Synchronization" or "Thread-safety".


PS4, Line 186: returns
delete


PS4, Line 195: memory
buffer


PS4, Line 197: removed from memory
the buffer reclaimed.


PS4, Line 197: page
page's buffer


Line 208:   void DuplicateHandle(const PageHandle& src, Client* client, PageHandle* dst);
why is this needed?  is this to support simultaneous read and write iterators referencing the same page?  Do we need both this and the ability to pin a particular PageHandle multiple times?


PS4, Line 213: CloseHandle
Maybe we should call this ClosePage()? since we have BufferHandles as well.


Line 218:   /// 'page_handle'.
what happens if the PageHandle has been duplicated?


PS4, Line 315: page's buffer
update


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 4
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/3688/2/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 303:   uint8_t* buf() const;
> PageHandle should not have this function. all access of the underlying data
I don't understand the problem with this if you're proposing that the page owns the buffer.

page->buffer()->buffer() or whatever the alternative is seems overly fussy.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Dan Hecht (Code Review)" <ge...@cloudera.org>.
Dan Hecht has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/3688/2/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 227:       PageHandle* dst);
is this needed still? wouldn't we only be transferring buffers via TransferBuffer()?


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 5:

Ping

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 5
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: No

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Dan Hecht (Code Review)" <ge...@cloudera.org>.
Dan Hecht has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 2:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/3688/2/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 219:   void DuplicateHandle(const PageHandle& src, Client* client, PageHandle* dst);
Doesn't seem like we need this.


Line 296:   BufferHandle ExtractBuffer();
It'd be nice for this to live side-by-side with Pin() and Unpin() so either move this to BufferPool or move those Page operations here.  My slight preference is to move this and leave Buffer/Page more like structs since the buffer pool is the thing that has to do the heavy lifting, but I'm okay either way.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#3).

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................

IMPALA-3201: HEADER ONLY: buffer pool

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 326 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/3
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 3
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Marcel Kornacker (Code Review)" <ge...@cloudera.org>.
Marcel Kornacker has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 5:

(9 comments)

http://gerrit.cloudera.org:8080/#/c/3688/5/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 85: /// it is able to fulfill the reservations when needed, e.g. by flushing unpinned pages
i think it would be good to create a condensed version of the specific guarantees of the buffer pool, without comments about what clients might be doing or what might be going on under the covers. possibly as an introductory section to this class comment, if we feel we also need the expanded version.


Line 90: /// The buffer pool does not directly expose its internal data structures to clients,
opportunity for more brevity: no need to explain general software engineering practices in class comments.


Line 109: /// The invariants are as follows:
update this section


Line 113: /// * Pin() can be called on a pinned handle, incrementing the handle's pin count.
it sounds like you're mixing up 'pinned' and 'open'. the distinction isn't particularly clear.


Line 124: ///   destroy the handle and free the page and its buffer, or use TransferBuffer() to
from the perspective of the caller, it's not clear why/how a page is involved.


Line 138: /// * If the operator is done with the page, it can call DestroyBuffer() to destroy the
why DestroyBuffer?


Line 203:   /// buffers or disk storage backing the page is freed. Idempotent.
should this be idempotent (but unpinning an unpinned page isn't)?


Line 223:   Status TransferBuffer(Client* src_client, BufferHandle* src, Client* dst_client,
can't the handle stay the same? what is the effect on the src's and dst's reservations?


Line 277:   int64_t len() const;
is this legal for unpinned pages?


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 5
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#2).

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................

IMPALA-3201: HEADER ONLY: buffer pool

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 336 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/2
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#4).

Change subject: IMPALA-3201: buffer pool header only
......................................................................

IMPALA-3201: buffer pool header only

Implementation will follow in a subsequent commit.

The BufferPool interface and reservation bookkeeping are documented.

Includes documentation for some guarantees of new reservation mechanism
where reservations are always guaranteed and pages can't be pinned and
buffers can't be allocated without without a reservation. Reservations
are tracked via a hierarchy of ReservationTrackers.

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 326 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/4
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 4
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 8: Code-Review+2

Carry +2

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 8
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: No

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 6:

(24 comments)

http://gerrit.cloudera.org:8080/#/c/3688/6/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS6, Line 62: and
            : ///   the corresponding buffer
> how about deleting this now that BufferHandle is a first class construct?
I think this still makes sense since you access the buffer via the page.


PS6, Line 91: A new
> nit: An 
Done


PS6, Line 94: unclosed
> what's the difference between unclosed and open?
Same thing. Changed.


PS6, Line 94: thatr
> typo
Done


PS6, Line 100: DestroyHandle
> DestroyPage()
Done


PS6, Line 110: CreateBuffer
> AllocateBuffer()
Done


PS6, Line 118: ()
> nit: add period
Done


PS6, Line 120: free up memory reservations
> would be nice to use terminology consistent with what we ended up with in R
Done


PS6, Line 123:  
> unused? available?
Done


PS6, Line 166: see BufferPool class comment
> I just read the comment and don't remember where this was documented :) is 
Under "Pages, Buffers and Pinning". I moved it to its own section to be called outbetter.


PS6, Line 167:  
> unused? available?
Done


PS6, Line 169: .
> due to an I/O error? or something, to emphasize that these are only system 
Defined 'system errors' in "Reservations" section.


PS6, Line 176:  
> available? unused?
Done


PS6, Line 177: error
> maybe we should come up with a term for these kinds of errors to emphasize 
See above comment - "system errors"


PS6, Line 181: Releases client's reservation
> Decreases the client's usage of its reservation. or similar, since it doesn
Done


Line 189:   void Unpin(Client* client, PageHandle* handle);
> Pin/Unpin are both illegal on closed handles, correct?  it's implied in Unp
Done


PS6, Line 191: '.
> maybe say ... "if the handle is opened." to clarify how idempotency works (
Done


PS6, Line 191: Then the page is destroyed 
> seems redundant with first sentence. also would be nice to explicitly say t
Done


PS6, Line 191: Destroy's
> Destroy
Done


Line 192:   /// buffers or disk storage backing the page is freed. Idempotent.
> what happens if you destroy a pinned page?  that decreases reservation usag
Done


PS6, Line 207: free up the reservation
> decrease the reservation used by, or similar.
Done


PS6, Line 211: frees
> decreases reservation usage
Done


Line 212:   /// reservation in 'src_client'.
> what happens to 'src' handle, is it closed? what is 'src' is a closed handl
Right. Added.


PS6, Line 271: or NULL if the page is unpinned
> shouldn't this be illegal for unpinned pages?  (just like data() specificat
Done.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 6
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 4:

(21 comments)

http://gerrit.cloudera.org:8080/#/c/3688/4/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS4, Line 62: one buffer pool client
> pages can only have one client.
Done


PS4, Line 65: to hold another page.
> should clarify that the buffer could also be used as a plain buffer.
Done


PS4, Line 72: buffers in memory.
> buffers are always in memory. should say "have access to a certain number o
Done


PS4, Line 96: page
            : /// or buffer
> nit: buffer or page 
Done


PS4, Line 98: buffer
> same
Went with page thenbuffer since that was the order used in most of the text.


PS4, Line 100: converting
> what does this mean? extracting?
I worded this slightly differently so that it stated less specifically that you could get a reference to the buffer to a page. I have a feeling that that particular API may evolve so don't want to document the full details up here.


PS4, Line 100: page
> buffer
Done


PS4, Line 104: Reference Counting 
> are the page handles actually referenced counted? or is this talking about 
That part of the design was removed as a result of other decisions. See below.


PS4, Line 106: Multiple handles to a page can exist at any
             : /// given time, allowing for multiple handles to the same page to be used by the same
             : /// client.
> is this allowed so that read and write iterators can reference the same pag
Explained below but other design decisions made this complicated so I've just removed it.


PS4, Line 125: CloseHandle
> FreeBuffer()
Done


PS4, Line 126: Transfer
> TransferBuffer()
Done


PS4, Line 127: operator
> client
Done


Line 152: /// operations with the same Client, PageHandle or BufferHandle.
> this seems more than an implementation detail.  i.e clients can't know how 
Done


PS4, Line 186: returns
> delete
Done


PS4, Line 195: memory
> buffer
Done


PS4, Line 197: page
> page's buffer
edited - page's data makes more sense to me - it's really the contents of the page that we're shuffling between memory and disk.


PS4, Line 197: removed from memory
> the buffer reclaimed.
Done


Line 208:   void DuplicateHandle(const PageHandle& src, Client* client, PageHandle* dst);
> why is this needed?  is this to support simultaneous read and write iterato
I think it would be a generally useful facility if you want to have memory shared between multiple places but without having to coordinate reservation bookkeeping using an additional external mechanism. 

E.g. suppose you're partitioning a row batch through a local exchange and you don't want to copy all of the underlying memory. With this you can just duplicate handles to all the underlying memory, attach it to the batches and send it to the destination operators. Referencing counting takes care of freeing the memory once all operators independently have closed their handles.

I think that Without this you'd either have to deep-copy all the rows, or invent another mechanism off on the side to track that the memory is referenced by multiple operators.

Other design decisions made this less useful (not transferring pages between operators) and harder to implement with sane invariants (the conversion to buffer handles) so I'll just delete it and we'll figure out a workaround if this comes up.


PS4, Line 213: CloseHandle
> Maybe we should call this ClosePage()? since we have BufferHandles as well.
If we remove DuplicateHandle() this makes sense yes.


Line 218:   /// 'page_handle'.
> what happens if the PageHandle has been duplicated?
removed DuplicateHandle()


PS4, Line 315: page's buffer
> update
Done


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 4
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Dan Hecht (Code Review)" <ge...@cloudera.org>.
Dan Hecht has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 6:

(25 comments)

http://gerrit.cloudera.org:8080/#/c/3688/6/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS6, Line 62: and
            : ///   the corresponding buffer
how about deleting this now that BufferHandle is a first class construct?


PS6, Line 91: A new
nit: An 
(to be consistent with PageHandle sentence).


PS6, Line 94: unclosed
what's the difference between unclosed and open?


PS6, Line 94: thatr
typo


PS6, Line 100: DestroyHandle
DestroyPage()


PS6, Line 104: releases reservations
One way to interpret this is that the reservation is adjusted, but it's not.  Let's use the terminology we have in ReservationTracker:

... always increases/decreases reservation usage.

or something similar.


PS6, Line 110: CreateBuffer
AllocateBuffer()


PS6, Line 118: ()
nit: add period


PS6, Line 120: free up memory reservations
would be nice to use terminology consistent with what we ended up with in ReservationTracker:  ... decrease its reservation usage ...

i.e. it's not giving away (or freeing) the reservation itself; it still has the same amount of reservation afterwords, but less usage.


PS6, Line 123:  
unused? available?


PS6, Line 166: see BufferPool class comment
I just read the comment and don't remember where this was documented :) is it still there?


PS6, Line 167:  
unused? available?


PS6, Line 169: .
due to an I/O error? or something, to emphasize that these are only system errors that can prevent it from succeeding.


PS6, Line 176:  
available? unused?


PS6, Line 177: error
maybe we should come up with a term for these kinds of errors to emphasize what this is really trying to say?


PS6, Line 181: Releases client's reservation
Decreases the client's usage of its reservation. or similar, since it doesn't actually release the reservation itself, just the current usage of it.


Line 189:   void Unpin(Client* client, PageHandle* handle);
Pin/Unpin are both illegal on closed handles, correct?  it's implied in Unpin since closed would have a pincount of 0, but maybe call that out as a precondition, especially since DestroyPage() allows closed handles on input.


PS6, Line 191: Then the page is destroyed 
seems redundant with first sentence. also would be nice to explicitly say this closes the handle.


PS6, Line 191: Destroy's
Destroy


PS6, Line 191: '.
maybe say ... "if the handle is opened." to clarify how idempotency works (open -> closed, closed -> closed).


Line 192:   /// buffers or disk storage backing the page is freed. Idempotent.
what happens if you destroy a pinned page?  that decreases reservation usage, right?  would be worth calling that out explicitly.


PS6, Line 207: free up the reservation
decrease the reservation used by, or similar.
also would be nice to say this closes 'handle'.
also is this idempotent like DestroyPage()?  This needs to be specified (i.e. does 'handle' have to be an open handle?)


PS6, Line 211: frees
decreases reservation usage


Line 212:   /// reservation in 'src_client'.
what happens to 'src' handle, is it closed? what is 'src' is a closed handle on input? and I assume 'dst' must be closed on input, right?


PS6, Line 271: or NULL if the page is unpinned
shouldn't this be illegal for unpinned pages?  (just like data() specification.)


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 6
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 1:

One point that I alluded to in the previous comment is that passing an InMemPageHandle allows compile-time checking of whether the page is pinned, but doesn't provide compile-time checking of whether the handle is closed.

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 1
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: No

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 5:

(9 comments)

http://gerrit.cloudera.org:8080/#/c/3688/5/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 85: /// it is able to fulfill the reservations when needed, e.g. by flushing unpinned pages
> i think it would be good to create a condensed version of the specific guar
I deleted the middle paragraph here and cut down the other paragraphs, just to focus on the idea that reservations are necessary and sufficient for allocating memory. I think the method comments should be the canonical reference for more specific guarantees.


Line 90: /// The buffer pool does not directly expose its internal data structures to clients,
> opportunity for more brevity: no need to explain general software engineeri
Done


Line 109: /// The invariants are as follows:
> update this section
Done


Line 113: /// * Pin() can be called on a pinned handle, incrementing the handle's pin count.
> it sounds like you're mixing up 'pinned' and 'open'. the distinction isn't 
Done


Line 124: ///   destroy the handle and free the page and its buffer, or use TransferBuffer() to
> from the perspective of the caller, it's not clear why/how a page is involv
editing error, removed.


Line 138: /// * If the operator is done with the page, it can call DestroyBuffer() to destroy the
> why DestroyBuffer?
Editing error - DestroyPage(). Fixed.


Line 203:   /// buffers or disk storage backing the page is freed. Idempotent.
> should this be idempotent (but unpinning an unpinned page isn't)?
The pins are referenced counted, so unpinning twice is different from unpinning once. We could change it so that unpinning an unpinned page has no effect, but I think that would make it easier to be sloppy.

Idempotency of DestroyPage() is mainly to simplify cleanup logic so it doesn't have to check whether everything is open.


Line 223:   Status TransferBuffer(Client* src_client, BufferHandle* src, Client* dst_client,
> can't the handle stay the same? what is the effect on the src's and dst's r
Made the reservation implications of the ownership change explicit in the comment.

No reason it can't be transferred in-place. I did it this way since usually it makes sense to move to a new handle when transferring ownership. E.g. attaching it to a row batch. This would discourage patterns where the ownership of a a particular member variable or vector of handles was ambiguous.


Line 277:   int64_t len() const;
> is this legal for unpinned pages?
Yeah, the length of the page's data still makes sense if the page is unpinned.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 5
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 1:

This is an updated header where was have a new InMemPageHandle abstraction that guarantees that the referenced page is in memory (provided the handle is open).

I've posted the header only so we can agree on the interface before diving into the implementation.

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 1
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: No

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#5).

Change subject: IMPALA-3201: buffer pool header only
......................................................................

IMPALA-3201: buffer pool header only

Implementation will follow in a subsequent commit.

The BufferPool interface and reservation bookkeeping are documented.

Includes documentation for some guarantees of new reservation mechanism
where reservations are always guaranteed and pages can't be pinned and
buffers can't be allocated without without a reservation. Reservations
are tracked via a hierarchy of ReservationTrackers.

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 317 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/5
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 5
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#7).

Change subject: IMPALA-3201: buffer pool header only
......................................................................

IMPALA-3201: buffer pool header only

Implementation will follow in a subsequent commit.

The BufferPool interface and reservation bookkeeping are documented.

Includes documentation for some guarantees of new reservation mechanism
where reservations are always guaranteed and pages can't be pinned and
buffers can't be allocated without without a reservation. Reservations
are tracked via a hierarchy of ReservationTrackers.

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 315 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/7
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 7
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Marcel Kornacker (Code Review)" <ge...@cloudera.org>.
Marcel Kornacker has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 7:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/3688/7/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 155:   ///     remainder will not be usable.
alternatively, express size as multiple of min_buffer_len


Line 201:   /// closed and 'buffer_handle' will reference the buffer from 'page_handle'. This
"will be closed" = "will be destroyed", i assume? we seem to use close and destroy to mean the same thing.


Line 218:   /// reservation in 'src_client'. 'src' must be open and 'dst' must be closed before
how do you get a closed BufferHandle, other than calling allocate and free in sequence? should this maybe not require a src and dest after all, but do it in-place?


Line 279:   const BufferHandle* buffer_handle() const;
presumably an error to call FreeBuffer on the returned handle directly?


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 7
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Marcel Kornacker (Code Review)" <ge...@cloudera.org>.
Marcel Kornacker has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 7: Code-Review+2

(1 comment)

http://gerrit.cloudera.org:8080/#/c/3688/7/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 218:   /// reservation in 'src_client'. 'src' must be open and 'dst' must be closed before
> how do you get a closed BufferHandle, other than calling allocate and free 
we can decide to change this later, if the code that calls this ends up looking awkward, i just wanted to point this out as something odd.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 7
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#6).

Change subject: IMPALA-3201: buffer pool header only
......................................................................

IMPALA-3201: buffer pool header only

Implementation will follow in a subsequent commit.

The BufferPool interface and reservation bookkeeping are documented.

Includes documentation for some guarantees of new reservation mechanism
where reservations are always guaranteed and pages can't be pinned and
buffers can't be allocated without without a reservation. Reservations
are tracked via a hierarchy of ReservationTrackers.

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 306 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/6
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 6
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Hello Marcel Kornacker, Dan Hecht,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/3688

to look at the new patch set (#8).

Change subject: IMPALA-3201: buffer pool header only
......................................................................

IMPALA-3201: buffer pool header only

Implementation will follow in a subsequent commit.

The BufferPool interface and reservation bookkeeping are documented.

Includes documentation for some guarantees of new reservation mechanism
where reservations are always guaranteed and pages can't be pinned and
buffers can't be allocated without without a reservation. Reservations
are tracked via a hierarchy of ReservationTrackers.

Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
---
A be/src/bufferpool/buffer-pool.h
1 file changed, 318 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala refs/changes/88/3688/8
-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 8
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 2:

Updated with buffer-oriented naming and private members stripped out.

For comparison, I posted the same interface with only the page methods exposed: https://gerrit.cloudera.org/#/c/3762/

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: No

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has abandoned this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Abandoned

move to  http://gerrit.cloudera.org:8080/3992

-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 8
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-CR](cdh5-trunk) IMPALA-3201: HEADER ONLY: buffer pool

Posted by "Marcel Kornacker (Code Review)" <ge...@cloudera.org>.
Marcel Kornacker has posted comments on this change.

Change subject: IMPALA-3201: HEADER ONLY: buffer pool
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/3688/2/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

Line 303:   uint8_t* buf() const;
PageHandle should not have this function. all access of the underlying data needs to go through the buffer abstraction (otherwise you don't really have a separation of abstractions).

algorithms that only implement data processing logic should only deal with buffers, whereas algorithms that only implement spilling-type logic should only deal with pages.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Dan Hecht (Code Review)" <ge...@cloudera.org>.
Dan Hecht has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 7: Code-Review+2

(2 comments)

Please also let Marcel finish his review.

http://gerrit.cloudera.org:8080/#/c/3688/7/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS7, Line 124: free up memory reservations
this instance wasn't updated to be clearer on terminology:

decreases reservation usage


PS7, Line 217: frees
also not updated:

decreases reservation usage


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 7
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-CR](cdh5-trunk) IMPALA-3201: buffer pool header only

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3201: buffer pool header only
......................................................................


Patch Set 7:

(7 comments)

http://gerrit.cloudera.org:8080/#/c/3688/7/be/src/bufferpool/buffer-pool.h
File be/src/bufferpool/buffer-pool.h:

PS7, Line 124: free up memory reservations
> this instance wasn't updated to be clearer on terminology:
Done


Line 155:   ///     remainder will not be usable.
> alternatively, express size as multiple of min_buffer_len
My thought was that it was best to consistently denominate buffers in bytes rather than use two different units. There's a trade-off here in that we have to document what happens in this case, but I like the consistency.


Line 201:   /// closed and 'buffer_handle' will reference the buffer from 'page_handle'. This
> "will be closed" = "will be destroyed", i assume? we seem to use close and 
The handle is closed and the page is destroyed. I'll use the second here since it's clearer.


PS7, Line 217: frees
> also not updated:
Done


Line 218:   /// reservation in 'src_client'. 'src' must be open and 'dst' must be closed before
> how do you get a closed BufferHandle, other than calling allocate and free 
The default constructor of BufferHandle creates a closed buffer handle: it's only opened by calling a buffer pool method with this as an argument. So the code looks like:

BufferHandle dst;
TransferBuffer(src_client, &src, dst_client, &dst);


Line 218:   /// reservation in 'src_client'. 'src' must be open and 'dst' must be closed before
> we can decide to change this later, if the code that calls this ends up loo
Sounds good.


Line 279:   const BufferHandle* buffer_handle() const;
> presumably an error to call FreeBuffer on the returned handle directly?
Right, that's what the const modifier is enforcing.

Extended comment to explain it.


-- 
To view, visit http://gerrit.cloudera.org:8080/3688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id771dea2eb4c1aa13c30d59e8b184a7d1bca8d34
Gerrit-PatchSet: 7
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <ma...@cloudera.com>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-HasComments: Yes