You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Andrzej <bo...@wp.pl> on 2018/06/20 20:42:15 UTC
Template problem native client c++ with new folly
I have installed new (17 days ago) folly and wangle from sources.
I try compile sources of native client from HBASE-14850 branch.
These sources are old.
I have problem:
```
template <typename F, typename R = futures::detail::callableResult<T, F>>
typename R::Return then(F&& func) {
return this->template thenImplementation<F, R>(
std::forward<F>(func), typename R::Arg());
}
```
from /usr/local/include/folly/futures/Future.h
Is template called from
```
// mimic: std::invoke_result_t, C++17
template <typename F, typename... Args>
using invoke_result_t = typename invoke_result<F, Args...>::type;
```
from /usr/local/include/folly/functional/Invoke.h
but is called from
```
GetRegionLocations(actions, locate_timeout_ns)
.then([=](std::vector<Try<std::shared_ptr<RegionLocation>>> &loc) {
std::lock_guard<std::recursive_mutex> lck(multi_mutex_);
ActionsByServer actions_by_server;
std::vector<std::shared_ptr<Action>> locate_failed;
```
from
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc
- my project
I have turn on -std=gnu++17
There are error and notes:
====================================================
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|error:
no matching function for call to
‘folly::Future<std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> > >::then(hbase::AsyncBatchRpcRetryingCaller<REQ,
RESP>::GroupAndSend(const std::vector<std::shared_ptr<hbase::Action> >&,
int32_t) [with REQ = std::shared_ptr<hbase::Row>; RESP =
std::shared_ptr<hbase::Result>; int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>)’|
/usr/local/include/folly/futures/Future.h|737|note: candidate:
template<class F, class R> typename R::Return
folly::Future<T>::then(F&&) [with F = F; R = R; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|737|note: substitution of
deduced template arguments resulted in errors seen above|
/usr/local/include/folly/futures/Future.h|753|note: candidate:
template<class R, class Caller, class ... Args> folly::Future<typename
folly::isFuture<F>::Inner> folly::Future<T>::then(R (Caller::*)(Args
...), Caller*) [with R = R; Caller = Caller; Args = {Args ...}; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|753|note: template argument
deduction/substitution failed:|
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|note:
mismatched types ‘R (Caller::*)(Args ...)’ and
‘hbase::AsyncBatchRpcRetryingCaller<REQ, RESP>::GroupAndSend(const
std::vector<std::shared_ptr<hbase::Action> >&, int32_t) [with REQ =
std::shared_ptr<hbase::Row>; RESP = std::shared_ptr<hbase::Result>;
int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>’|
/usr/local/include/folly/futures/Future.h|770|note: candidate:
template<class Executor, class Arg, class ... Args> auto
folly::Future<T>::then(Executor*, Arg&&, Args&& ...) [with Executor =
Executor; Arg = Arg; Args = {Args ...}; T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future.h|770|note: template argument
deduction/substitution failed:|
/home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc|259|note:
mismatched types ‘Executor*’ and
‘hbase::AsyncBatchRpcRetryingCaller<REQ, RESP>::GroupAndSend(const
std::vector<std::shared_ptr<hbase::Action> >&, int32_t) [with REQ =
std::shared_ptr<hbase::Row>; RESP = std::shared_ptr<hbase::Result>;
int32_t =
int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> >&)>’|
/usr/local/include/folly/futures/Future-inl.h|975|note: candidate:
folly::Future<folly::Unit> folly::Future<T>::then() [with T =
std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
/usr/local/include/folly/futures/Future-inl.h|975|note: candidate
expects 0 arguments, 1 provided|
====================================================
How I can change this piece of sources to fit new folly?
Re: Template problem native client c++ with new folly
Posted by Andrzej <bo...@wp.pl>.
W dniu 20.06.2018 o 22:42, Andrzej pisze:
> GetRegionLocations(actions, locate_timeout_ns)
> .then([=](std::vector<Try<std::shared_ptr<RegionLocation>>> &loc) {
> std::lock_guard<std::recursive_mutex> lck(multi_mutex_);
> ActionsByServer actions_by_server;
> std::vector<std::shared_ptr<Action>> locate_failed;
Method GetRegionLocations retuns AsyncBatchRpcRetryingCaller<REQ, RESP>
we have two arguments to instantiate template: REQ and RESP
RESP is in Call()
folly::Future<std::vector<folly::Try<RESP>>> Call();
we have std::vector<Try<std::shared_ptr<RegionLocation>>> as argument
but parameter REQ is not known,
must be std::vector<std::shared_ptr<Action>> ?
GetRegionLocations is not template, have this type
How to say compiler, that type REQ must be
std::vector<std::shared_ptr<Action>>
?
Is possible points this type explicitly in this code?
Re: Template problem native client c++ with new folly
Posted by Ted Yu <yu...@gmail.com>.
Can you take a look at :
HBASE-18901 [C++] Provide CMAKE infrastructure
There hasn't been effort to support newer folly.
FYI
On Wed, Jun 20, 2018 at 1:42 PM, Andrzej <bo...@wp.pl> wrote:
> I have installed new (17 days ago) folly and wangle from sources.
> I try compile sources of native client from HBASE-14850 branch.
> These sources are old.
> I have problem:
> ```
> template <typename F, typename R = futures::detail::callableResult<T, F>>
> typename R::Return then(F&& func) {
> return this->template thenImplementation<F, R>(
> std::forward<F>(func), typename R::Arg());
> }
> ```
> from /usr/local/include/folly/futures/Future.h
>
> Is template called from
> ```
> // mimic: std::invoke_result_t, C++17
> template <typename F, typename... Args>
> using invoke_result_t = typename invoke_result<F, Args...>::type;
> ```
> from /usr/local/include/folly/functional/Invoke.h
>
> but is called from
> ```
> GetRegionLocations(actions, locate_timeout_ns)
> .then([=](std::vector<Try<std::shared_ptr<RegionLocation>>> &loc) {
> std::lock_guard<std::recursive_mutex> lck(multi_mutex_);
> ActionsByServer actions_by_server;
> std::vector<std::shared_ptr<Action>> locate_failed;
> ```
> from /home/andrzej/projects/simple-hbase2/src/hbase/client/async-batch-rpc-retrying-caller.cc
> - my project
>
> I have turn on -std=gnu++17
>
> There are error and notes:
> ====================================================
> /home/andrzej/projects/simple-hbase2/src/hbase/client/async-
> batch-rpc-retrying-caller.cc|259|error: no matching function for call to
> ‘folly::Future<std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> > > >::then(hbase::AsyncBatchRpcRetryingCaller<REQ,
> RESP>::GroupAndSend(const std::vector<std::shared_ptr<hbase::Action> >&,
> int32_t) [with REQ = std::shared_ptr<hbase::Row>; RESP =
> std::shared_ptr<hbase::Result>; int32_t = int]::<lambda(std::vector<foll
> y::Try<std::shared_ptr<hbase::RegionLocation> > >&)>)’|
>
> /usr/local/include/folly/futures/Future.h|737|note: candidate:
> template<class F, class R> typename R::Return folly::Future<T>::then(F&&)
> [with F = F; R = R; T = std::vector<folly::Try<std::sh
> ared_ptr<hbase::RegionLocation> > >]|
>
> /usr/local/include/folly/futures/Future.h|737|note: substitution of
> deduced template arguments resulted in errors seen above|
>
> /usr/local/include/folly/futures/Future.h|753|note: candidate:
> template<class R, class Caller, class ... Args> folly::Future<typename
> folly::isFuture<F>::Inner> folly::Future<T>::then(R (Caller::*)(Args ...),
> Caller*) [with R = R; Caller = Caller; Args = {Args ...}; T =
> std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
>
> /usr/local/include/folly/futures/Future.h|753|note: template argument
> deduction/substitution failed:|
>
> /home/andrzej/projects/simple-hbase2/src/hbase/client/async-
> batch-rpc-retrying-caller.cc|259|note: mismatched types ‘R
> (Caller::*)(Args ...)’ and ‘hbase::AsyncBatchRpcRetryingCaller<REQ,
> RESP>::GroupAndSend(const std::vector<std::shared_ptr<hbase::Action> >&,
> int32_t) [with REQ = std::shared_ptr<hbase::Row>; RESP =
> std::shared_ptr<hbase::Result>; int32_t = int]::<lambda(std::vector<foll
> y::Try<std::shared_ptr<hbase::RegionLocation> > >&)>’|
>
> /usr/local/include/folly/futures/Future.h|770|note: candidate:
> template<class Executor, class Arg, class ... Args> auto
> folly::Future<T>::then(Executor*, Arg&&, Args&& ...) [with Executor =
> Executor; Arg = Arg; Args = {Args ...}; T = std::vector<folly::Try<std::sh
> ared_ptr<hbase::RegionLocation> > >]|
>
> /usr/local/include/folly/futures/Future.h|770|note: template argument
> deduction/substitution failed:|
>
> /home/andrzej/projects/simple-hbase2/src/hbase/client/async-
> batch-rpc-retrying-caller.cc|259|note: mismatched types ‘Executor*’ and
> ‘hbase::AsyncBatchRpcRetryingCaller<REQ, RESP>::GroupAndSend(const
> std::vector<std::shared_ptr<hbase::Action> >&, int32_t) [with REQ =
> std::shared_ptr<hbase::Row>; RESP = std::shared_ptr<hbase::Result>;
> int32_t = int]::<lambda(std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation>
> > >&)>’|
>
> /usr/local/include/folly/futures/Future-inl.h|975|note: candidate:
> folly::Future<folly::Unit> folly::Future<T>::then() [with T =
> std::vector<folly::Try<std::shared_ptr<hbase::RegionLocation> > >]|
>
> /usr/local/include/folly/futures/Future-inl.h|975|note: candidate
> expects 0 arguments, 1 provided|
> ====================================================
>
> How I can change this piece of sources to fit new folly?
>