chenBright commented on code in PR #2768:
URL: https://github.com/apache/brpc/pull/2768#discussion_r1769710229


##########
src/bthread/key.cpp:
##########
@@ -55,6 +55,15 @@ static const uint32_t KEY_1STLEVEL_SIZE = 31;
 // for most projects throughout baidu. 
 static const uint32_t KEYS_MAX = KEY_2NDLEVEL_SIZE * KEY_1STLEVEL_SIZE;
 
+// The maximum length of the KeyTableList. Once this value is exceeded, a
+// portion of the KeyTables will be moved to the global free_keytables list.
+static const uint32_t KEY_TABLE_LIST_SIZE = 10000;

Review Comment:
   1. 10000会不会太大了?
   2. 支持gflag修改,是不是好一点?



##########
src/bthread/key.cpp:
##########
@@ -205,53 +214,130 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTable {
     SubKeyTable* _subs[KEY_1STLEVEL_SIZE];
 };
 
-struct KeyTableList {
-    KeyTableList() {
-        keytable = NULL;
+class BAIDU_CACHELINE_ALIGNMENT KeyTableList {
+ public:
+  KeyTableList() : _head(NULL), _tail(NULL), _length(0) {}
+
+  ~KeyTableList() {
+    bthread::TaskGroup* g = bthread::tls_task_group;

Review Comment:
   存在#2156 的问题 ,得使用
   ```c++
   EXTERN_BAIDU_VOLATILE_THREAD_LOCAL(TaskGroup*, tls_task_group);
   TaskGroup* g = BAIDU_GET_VOLATILE_THREAD_LOCAL(tls_task_group);
   ```
   
   bthread_keytable_pool_destroy也有这个问题。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to