morningman commented on a change in pull request #3222: Support sharding
txn_map_lock into more small map locks to make good performance for txn manage
task
URL: https://github.com/apache/incubator-doris/pull/3222#discussion_r400935246
##########
File path: be/src/olap/txn_manager.cpp
##########
@@ -70,10 +71,13 @@ using std::vector;
namespace doris {
-TxnManager::TxnManager() {
- for (int i = 0; i < _txn_lock_num; ++i) {
- _txn_locks[i] = std::make_shared<RWMutex>();
- }
+TxnManager::TxnManager(int32_t txn_map_shard_size)
+ : _txn_map_shard_size(txn_map_shard_size) {
+ DCHECK_GT(_txn_map_shard_size, 0);
+ DCHECK_EQ(_txn_map_shard_size & (_txn_map_shard_size - 1), 0);
+ _txn_map_locks = new RWMutex[_txn_map_shard_size];
+ _txn_tablet_maps = new std::map<TxnKey, std::map<TabletInfo,
TabletTxnInfo>>[_txn_map_shard_size];
Review comment:
```suggestion
_txn_tablet_maps = new txn_tablet_map_t[_txn_map_shard_size];
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]