Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92BE318ACC for ; Mon, 28 Mar 2016 14:11:34 +0000 (UTC) Received: (qmail 84737 invoked by uid 500); 28 Mar 2016 14:11:34 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 84695 invoked by uid 500); 28 Mar 2016 14:11:34 -0000 Mailing-List: contact dev-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 dev@accumulo.apache.org Received: (qmail 84684 invoked by uid 99); 28 Mar 2016 14:11:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Mar 2016 14:11:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1B907DFDE0; Mon, 28 Mar 2016 14:11:34 +0000 (UTC) From: joshelser To: dev@accumulo.apache.org Reply-To: dev@accumulo.apache.org References: In-Reply-To: Subject: [GitHub] accumulo pull request: 4148 inmemorymap counter Content-Type: text/plain Message-Id: <20160328141134.1B907DFDE0@git1-us-west.apache.org> Date: Mon, 28 Mar 2016 14:11:34 +0000 (UTC) Github user joshelser commented on a diff in the pull request: https://github.com/apache/accumulo/pull/82#discussion_r57574973 --- Diff: test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java --- @@ -0,0 +1,319 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.test; + +import com.google.common.collect.ImmutableSet; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.accumulo.core.data.ArrayByteSequence; +import org.apache.accumulo.core.data.ByteSequence; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.iterators.SortedKeyValueIterator; +import org.apache.accumulo.test.functional.NativeMapIT; +import org.apache.accumulo.tserver.InMemoryMap; +import org.apache.accumulo.tserver.MemKey; +import org.apache.accumulo.tserver.NativeMap; +import org.apache.hadoop.io.Text; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Integration Test for https://issues.apache.org/jira/browse/ACCUMULO-4148 + *

+ * User had problem writing one Mutation with multiple KV pairs that had the same key. Doing so should write out all pairs in all mutations with a unique id. In + * typical operation, you would only see the last one when scanning. User had a combiner on the table, and they noticed that when using InMemoryMap with + * NativeMapWrapper, only the last KV pair was ever written. When InMemoryMap used DefaultMap, all KV pairs were added and the behavior worked as expected. + * + * This IT inserts a variety of Mutations with and without the same KV pairs and then inspects result of InMemoryMap mutate, looking for unique id stored with + * each key. This unique id, shown as mc= in the MemKey toString, was originally used for scan Isolation. Writing the same key multiple times in the same + * mutation is a secondary use case, discussed in https://issues.apache.org/jira/browse/ACCUMULO-227. In addition to NativeMapWrapper and DefaultMap, + * LocalityGroupMap was add in https://issues.apache.org/jira/browse/ACCUMULO-112. + * + * This test has to be an IT in accumulo-test, because libaccumulo is built in 'integration-test' phase of accumulo-native, which currently runs right before + * accumulo-test. The tests for DefaultMap could move to a unit test in tserver, but they are here for convenience of viewing both at the same time. + */ +public class InMemoryMapIT { + + private static final Logger log = LoggerFactory.getLogger(InMemoryMapIT.class); + + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target")); + + @BeforeClass + public static void ensureNativeLibrary() throws FileNotFoundException { + File nativeMapLocation = NativeMapIT.nativeMapLocation(); + log.debug("Native map location " + nativeMapLocation); + NativeMap.loadNativeLib(Collections.singletonList(nativeMapLocation)); + if (!NativeMap.isLoaded()) { --- End diff -- Have we already made the conscious decision that we're expecting a C++ compiler to be present for anyone doing the build (and thus would be able to build the shared library)? If we haven't, we should just JUnit's `Assume` to just ignore this test when the native IMM isnt' present. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---