From commits-return-22334-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Fri Nov 16 00:35:51 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3CF40180676 for ; Fri, 16 Nov 2018 00:35:51 +0100 (CET) Received: (qmail 18461 invoked by uid 500); 15 Nov 2018 23:35:50 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 18319 invoked by uid 99); 15 Nov 2018 23:35:50 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2018 23:35:50 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8E9DF87FDE; Thu, 15 Nov 2018 23:35:49 +0000 (UTC) Date: Thu, 15 Nov 2018 23:35:49 +0000 To: "commits@accumulo.apache.org" Subject: [accumulo] branch 1.9 updated: fixes #767 correct allocation issue in native maps (#769) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154232494949.8757.8285364305712541513@gitbox.apache.org> From: ctubbsii@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: accumulo X-Git-Refname: refs/heads/1.9 X-Git-Reftype: branch X-Git-Oldrev: 61a6eb8fcc674276e763ffd2f46d47c7b62c4101 X-Git-Newrev: df1061b79cd3be716567e3ecbc595126036d517f X-Git-Rev: df1061b79cd3be716567e3ecbc595126036d517f X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch 1.9 in repository https://gitbox.apache.org/repos/asf/accumulo.git The following commit(s) were added to refs/heads/1.9 by this push: new df1061b fixes #767 correct allocation issue in native maps (#769) df1061b is described below commit df1061b79cd3be716567e3ecbc595126036d517f Author: Keith Turner AuthorDate: Thu Nov 15 18:35:45 2018 -0500 fixes #767 correct allocation issue in native maps (#769) This fixes a bug that was found when building the native maps against Fedora 29. The cause of the bug was that an empty C++ map seemed to allocate a small amount of memory, which was a new behavior. This new behavior violated an assumption made by the custom alloctor used by the native map code. The code was restructured to avoid this issue. --- server/native/src/main/c++/nativeMap/NativeMap.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/server/native/src/main/c++/nativeMap/NativeMap.h b/server/native/src/main/c++/nativeMap/NativeMap.h index bc44a98..5934e2e 100644 --- a/server/native/src/main/c++/nativeMap/NativeMap.h +++ b/server/native/src/main/c++/nativeMap/NativeMap.h @@ -130,21 +130,23 @@ struct NativeMap : public NativeMapData { } ColumnMap *startUpdate(const char *r){ - Field row(lba, r); return startUpdate(row); } ColumnMap *startUpdate(Field &row){ - //cout << "Starting update "< insertResult = rowmap.insert(pair(row, ColumnMap(std::less(), BlockAllocator >(lba)))); - - if(!insertResult.second) + // This method is structured to avoid allocating the column map in the case + // where it already exists in the map. This is done so the row key memory can + // be easily deallocated. + RowMap::iterator lbi = rowmap.lower_bound(row); + if(lbi == rowmap.end() || row < lbi->first) { + RowMap::iterator iter = rowmap.insert(lbi, pair(row, ColumnMap(std::less(), BlockAllocator >(lba)))); + return &(iter->second); + } else { + // Return row memory because an insert was not done. row.clear(lba); - - return &(insertResult.first->second); - + return &(lbi->second); + } } void update(ColumnMap *cm, JNIEnv *env, jbyteArray cf, jbyteArray cq, jbyteArray cv, jlong ts, jboolean del, jbyteArray val, jint mutationCount){