Github user joshelser commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/82#discussion_r57575112
--- 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
+ * <p>
+ * 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()) {
+ fail("Missing the native library from " +
nativeMapLocation.getAbsolutePath() + "\nYou need to build the libaccumulo
binary first. "
+ + "\nTry running 'mvn clean install -Dit.test=InMemoryMapIT
-Dtest=foo -DfailIfNoTests=false -Dfindbugs.skip -Dcheckstyle.skip'");
+ // afterwards, you can run the following
+ // mvn clean verify -Dit.test=InMemoryMapIT -Dtest=foo
-DfailIfNoTests=false -Dfindbugs.skip -Dcheckstyle.skip -pl :accumulo-test
--- End diff --
The Maven reactor should be smart enough to pick up artifacts from a
previous module in the same execution. The only time this wouldn't work is if
you `cd test` first, but it doesn't look like you're actually doing this (or,
your command would work just fine from the root dir of the project).
---
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 [email protected] or file a JIRA ticket
with INFRA.
---