Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

New DoublyBufferedData for suspended bthread #2225

Merged
merged 4 commits into from
Jun 25, 2023

Conversation

chenBright
Copy link
Contributor

@chenBright chenBright commented Apr 27, 2023

What problem does this PR solve?

Issue Number: resolve #2209

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@chenBright chenBright added the feature new feature label Apr 28, 2023
@chenBright chenBright requested a review from wwbmmm April 28, 2023 01:32
@chenBright
Copy link
Contributor Author

@wwbmmm 麻烦有空看看这个PR

@wwbmmm
Copy link
Contributor

wwbmmm commented May 16, 2023

@chenBright 我看这个DoublyBufferedDataBthread大部分代码和DoublyBufferedData还是差不多的,是不是可以给DoublyBufferedData加一个bool模板参数,根据参数走不同的代码逻辑,这样改动小一些

@chenBright
Copy link
Contributor Author

@chenBright 我看这个DoublyBufferedDataBthread大部分代码和DoublyBufferedData还是差不多的,是不是可以给DoublyBufferedData加一个bool模板参数,根据参数走不同的代码逻辑,这样改动小一些

改动本来是不大的。
加bool模板参数应该也可以,那我先这样改改看。

@chenBright
Copy link
Contributor Author

chenBright commented May 16, 2023

@wwbmmm

template <typename T, typename TLS = Void, bool AllowSuspendBthread = false>
class DoublyBufferedData;

加bool模板参数的话,有一个问题:当AllowSuspendBthread=true(允许查询逻辑中挂起bthread)的时候,TLS 即使不为Void,DoublyBufferedData也是不支持自定义tls数据的。这样的实现好像不太友好,用户可能会比较迷惑为啥TLS没有生效吧。

或者加个static_assert(!(AllowSuspendBthread && TLS != Void));,在编译期发现这个问题,告知用户不支持这种用法?

@wwbmmm
Copy link
Contributor

wwbmmm commented May 17, 2023

或者加个static_assert(!(AllowSuspendBthread && TLS != Void));,在编译期发现这个问题,告知用户不支持这种用法?

我觉得可以

@chenBright
Copy link
Contributor Author

@chenBright 我看这个DoublyBufferedDataBthread大部分代码和DoublyBufferedData还是差不多的,是不是可以给DoublyBufferedData加一个bool模板参数,根据参数走不同的代码逻辑,这样改动小一些

@wwbmmm 改好了,有空看看

@chenBright chenBright changed the title New DoublyBufferedData for bthread New DoublyBufferedData for suspended bthread May 23, 2023
@wwbmmm
Copy link
Contributor

wwbmmm commented May 23, 2023

LGTM

@wwbmmm wwbmmm merged commit 21a6aab into apache:master Jun 25, 2023
@chenBright chenBright deleted the dbd_for_bthread branch June 25, 2023 06:43
yanglimingcn pushed a commit to yanglimingcn/brpc that referenced this pull request Oct 31, 2023
* New DoublyBufferedData for bthread

* Use cond and ref array

* DoublyBufferedData allows bthread suspended

* optimize cond and var name
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

实现一种支持在查询逻辑中挂起bthread的新DBD数据结构
2 participants