Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 155DC200CBB for ; Tue, 20 Jun 2017 01:23:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 13EAD160BE4; Mon, 19 Jun 2017 23:23:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 59447160BE1 for ; Tue, 20 Jun 2017 01:23:07 +0200 (CEST) Received: (qmail 55914 invoked by uid 500); 19 Jun 2017 23:23:06 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 55903 invoked by uid 99); 19 Jun 2017 23:23:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2017 23:23:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F3FA3C08BB for ; Mon, 19 Jun 2017 23:23:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.011 X-Spam-Level: X-Spam-Status: No, score=-100.011 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id J80TD496fyLU for ; Mon, 19 Jun 2017 23:23:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 823535F5A2 for ; Mon, 19 Jun 2017 23:23:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E11D1E0C1B for ; Mon, 19 Jun 2017 23:23:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1DF3923FFF for ; Mon, 19 Jun 2017 23:23:01 +0000 (UTC) Date: Mon, 19 Jun 2017 23:23:01 +0000 (UTC) From: "Devaraj Das (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-18214) Replace the folly::AtomicHashMap usage in the RPC layer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 19 Jun 2017 23:23:08 -0000 [ https://issues.apache.org/jira/browse/HBASE-18214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16054931#comment-16054931 ] Devaraj Das commented on HBASE-18214: ------------------------------------- bq. Instead of std::unique_ptr mutex_; use std::shared_timed_mutex mutex_; The issue is the shared_timed_mutex is (rightfully) not copyable. So one would have to define explicit copy constructors in the classes where this is used... It's not clear as to what such a copy constructor would do anyway (mutexes are fundamentally not copyable safely). Treating it as a pointer in class declarations works around such things since all the instances in question would refer to the same underlying mutex. But maybe, we should declare it to be shared_ptr as opposed to a shared_ptr. In the usecase we have, we probably will not run into issues with either anyway I guess. > Replace the folly::AtomicHashMap usage in the RPC layer > ------------------------------------------------------- > > Key: HBASE-18214 > URL: https://issues.apache.org/jira/browse/HBASE-18214 > Project: HBase > Issue Type: Sub-task > Reporter: Devaraj Das > Assignee: Devaraj Das > Attachments: 18214-1-1.txt, 18214-1-2.txt > > > In my tests, I saw that folly::AtomicHashMap usage is not appropriate for one, rather common use case. It'd become sort of unusable (inserts would hang) after a bunch of inserts and erases. This hashmap is used to keep track of call-Id after a connection is set up in the RPC layer (insert a call-id/msg pair when an RPC is sent, and erase the pair when the corresponding response is received). Here is a simple program that will demonstrate the issue: > {code} > folly::AtomicHashMap f(100); > int i = 0; > while (i < 10000) { > try { > f.insert(i,100); > LOG(INFO) << "Inserted " << i << " " << f.size(); > f.erase(i); > LOG(INFO) << "Deleted " << i << " " << f.size(); > i++; > } catch (const std::exception &e) { > LOG(INFO) << "Exception " << e.what(); > break; > } > } > {code} > After poking around a little bit, it is indeed called out as a limitation here https://github.com/facebook/folly/blob/master/folly/docs/AtomicHashMap.md (grep for 'erase'). Proposal is to replace this with something that will fit in in the above usecase (thinking of using std::unordered_map). -- This message was sent by Atlassian JIRA (v6.4.14#64029)