You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Mike Percy (Code Review)" <ge...@cloudera.org> on 2017/04/25 22:52:55 UTC

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

Mike Percy has uploaded a new change for review.

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................

tablet copy: Refactor to avoid separate expiration map

This simplifies the implementation a bit by removing extra data
structures and making it easier to understand.

Also add an assert on the session lock being taken and take the lock at
shutdown time.

Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
---
M src/kudu/tserver/tablet_copy_service.cc
M src/kudu/tserver/tablet_copy_service.h
2 files changed, 27 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/31/6731/1
-- 
To view, visit http://gerrit.cloudera.org:8080/6731
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


Patch Set 1: Verified+1

Flaky test is KUDU-1736; overriding

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


Patch Set 1:

(6 comments)

http://gerrit.cloudera.org:8080/#/c/6731/1/src/kudu/tserver/tablet_copy_service.cc
File src/kudu/tserver/tablet_copy_service.cc:

Line 122:     const auto& iter = sessions_.find(session_id);
> Couldn't you still use FindCopy() as long as the third argument was a Sessi
Switched to FindOrNull() since FindCopy() makes a copy of the scoped_refptr<TabletCopySourceSession> which means we have to std::move() it below to avoid a double ref. Since std::move() can be prone to human error down the road I'd rather avoid it.


Line 134:       InsertOrDie(&sessions_, session_id, { .session = session, .expires = GetNewExpireTime() });
> I thought this was illegal in C++11:
It seems to work but it's apparently non-standard, so I'll remove it.


PS1, Line 261:   for (const auto& entry : sessions_) {
             :     session_ids.push_back(entry.first);
             :   }
             :   for (const string& session_id : session_ids) {
> Can these loops be merged?
Done


Line 276:   const auto& entry = sessions_.find(session_id);
> Here too.
Same as above


Line 319:   auto iter = sessions_.find(session_id);
> Here maybe FindOrNull, so you can get a pointer to the SessionEntry in orde
Sounds good, done


http://gerrit.cloudera.org:8080/#/c/6731/1/src/kudu/tserver/tablet_copy_service.h
File src/kudu/tserver/tablet_copy_service.h:

Line 49: struct SessionEntry {
> Maybe declare this as a nested and private member of TabletCopyServiceImpl,
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................

tablet copy: Refactor to avoid separate expiration map

This simplifies the implementation a bit by removing extra data
structures and making it easier to understand.

Also add an assert on the session lock being taken and take the lock at
shutdown time.

Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
---
M src/kudu/tserver/tablet_copy_service.cc
M src/kudu/tserver/tablet_copy_service.h
2 files changed, 33 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/31/6731/2
-- 
To view, visit http://gerrit.cloudera.org:8080/6731
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has submitted this change and it was merged.

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


tablet copy: Refactor to avoid separate expiration map

This simplifies the implementation a bit by removing extra data
structures and making it easier to understand.

Also add an assert on the session lock being taken and take the lock at
shutdown time.

Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Reviewed-on: http://gerrit.cloudera.org:8080/6731
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>
---
M src/kudu/tserver/tablet_copy_service.cc
M src/kudu/tserver/tablet_copy_service.h
2 files changed, 33 insertions(+), 21 deletions(-)

Approvals:
  Mike Percy: Looks good to me, approved
  Kudu Jenkins: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


Patch Set 1:

(6 comments)

http://gerrit.cloudera.org:8080/#/c/6731/1/src/kudu/tserver/tablet_copy_service.cc
File src/kudu/tserver/tablet_copy_service.cc:

Line 122:     const auto& iter = sessions_.find(session_id);
Couldn't you still use FindCopy() as long as the third argument was a SessionEntry? I think it's a little more idiomatic than find() + comparison against end().


Line 134:       InsertOrDie(&sessions_, session_id, { .session = session, .expires = GetNewExpireTime() });
I thought this was illegal in C++11:

http://stackoverflow.com/questions/18731707/why-does-c11-not-support-designated-initializer-list-as-c99

If it compiles for you, can you make sure it's not because of a GNU extension?


PS1, Line 261:   for (const auto& entry : sessions_) {
             :     session_ids.push_back(entry.first);
             :   }
             :   for (const string& session_id : session_ids) {
Can these loops be merged?


Line 276:   const auto& entry = sessions_.find(session_id);
Here too.


Line 319:   auto iter = sessions_.find(session_id);
Here maybe FindOrNull, so you can get a pointer to the SessionEntry in order to modify the expiration time?


http://gerrit.cloudera.org:8080/#/c/6731/1/src/kudu/tserver/tablet_copy_service.h
File src/kudu/tserver/tablet_copy_service.h:

Line 49: struct SessionEntry {
Maybe declare this as a nested and private member of TabletCopyServiceImpl, since it's not supposed to be used by anyone except the class itself?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] tablet copy: Refactor to avoid separate expiration map

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

Change subject: tablet copy: Refactor to avoid separate expiration map
......................................................................


Patch Set 4: Code-Review+2

Porting over Adar's previous +2 after a rebase

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcf4e57722e4e34e99064713a6e8d246d3ebf920
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No