Author: ctubbsii Date: Fri Feb 8 21:18:11 2013 New Revision: 1444244 URL: http://svn.apache.org/r1444244 Log: ACCUMULO-1001 Fix typo on setAuthorizations method name.
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java?rev=1444244&r1=1444243&r2=1444244&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java Fri Feb 8 21:18:11 2013 @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -79,7 +79,7 @@ abstract public class TransformingIterat public static final String AUTH_OPT = "authorizations"; public static final String MAX_BUFFER_SIZE_OPT = "maxBufferSize"; private static final long DEFAULT_MAX_BUFFER_SIZE = 10000000; - + protected Logger log = Logger.getLogger(getClass()); protected ArrayList<Pair<Key,Value>> keys = new ArrayList<Pair<Key,Value>>(); @@ -120,7 +120,7 @@ abstract public class TransformingIterat } else { maxBufferSize = DEFAULT_MAX_BUFFER_SIZE; } - + parsedVisibilitiesCache = new LRUMap(100); } @@ -129,9 +129,9 @@ abstract public class TransformingIterat String desc = "This iterator allows ranges of key to be transformed (with the exception of row transformations)."; String authDesc = "Comma-separated list of user's scan authorizations. " + "If excluded or empty, then no visibility check is performed on transformed keys."; - String bufferDesc = "Maximum buffer size (in accumulo memory spec) to use for buffering keys before throwing a BufferOverflowException. " + - "Users should keep this limit in mind when deciding what to transform. That is, if transforming the column family for example, then all " + - "keys sharing the same row and column family must fit within this limit (along with their associated values)"; + String bufferDesc = "Maximum buffer size (in accumulo memory spec) to use for buffering keys before throwing a BufferOverflowException. " + + "Users should keep this limit in mind when deciding what to transform. That is, if transforming the column family for example, then all " + + "keys sharing the same row and column family must fit within this limit (along with their associated values)"; HashMap<String,String> namedOptions = new HashMap<String,String>(); namedOptions.put(AUTH_OPT, authDesc); namedOptions.put(MAX_BUFFER_SIZE_OPT, bufferDesc); @@ -231,7 +231,7 @@ abstract public class TransformingIterat transformKeys(); } } - + private static class RangeIterator implements SortedKeyValueIterator<Key,Value> { private SortedKeyValueIterator<Key,Value> source; @@ -244,7 +244,7 @@ abstract public class TransformingIterat this.prefixKey = prefixKey; this.keyPrefix = keyPrefix; } - + @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { throw new UnsupportedOperationException(); @@ -286,7 +286,7 @@ abstract public class TransformingIterat } } - + /** * Reads all keys matching the first key's prefix from the source iterator, transforms them, and sorts the resulting keys. Transformed keys that fall outside * of our seek range or can't be seen by the user are excluded. @@ -299,7 +299,7 @@ abstract public class TransformingIterat transformRange(new RangeIterator(getSource(), prefixKey, getKeyPrefix()), new KVBuffer() { long appened = 0; - + @Override public void append(Key key, Value val) { // ensure the key provided by the user has the correct prefix @@ -314,7 +314,7 @@ abstract public class TransformingIterat // try to defend against a scan or compaction using all memory in a tablet server if (appened > maxBufferSize) throw new BufferOverflowException("Exceeded buffer size of " + maxBufferSize + ", prefixKey: " + prefixKey); - + if (getSource().hasTop() && key == getSource().getTopKey()) key = new Key(key); keys.add(new Pair<Key,Value>(key, new Value(val))); @@ -322,7 +322,7 @@ abstract public class TransformingIterat } } }); - + // consume any key in range that user did not consume while (super.hasTop() && super.getTopKey().equals(prefixKey, getKeyPrefix())) { super.next(); @@ -643,7 +643,7 @@ abstract public class TransformingIterat * @param config * @param auths */ - public static void setAutorizations(IteratorSetting config, Authorizations auths) { + public static void setAuthorizations(IteratorSetting config, Authorizations auths) { config.addOption(AUTH_OPT, auths.serialize()); } @@ -657,5 +657,5 @@ abstract public class TransformingIterat public static void setMaxBufferSize(IteratorSetting config, long maxBufferSize) { config.addOption(MAX_BUFFER_SIZE_OPT, maxBufferSize + ""); } - + } Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java?rev=1444244&r1=1444243&r2=1444244&view=diff ============================================================================== --- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java (original) +++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java Fri Feb 8 21:18:11 2013 @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -91,7 +91,7 @@ public class TransformingIteratorTest { private void setUpTransformIterator(Class<? extends TransformingIterator> clazz) { IteratorSetting cfg = new IteratorSetting(21, clazz); cfg.setName("keyTransformIter"); - TransformingIterator.setAutorizations(cfg, new Authorizations("vis0", "vis1", "vis2", "vis3")); + TransformingIterator.setAuthorizations(cfg, new Authorizations("vis0", "vis1", "vis2", "vis3")); scanner.addScanIterator(cfg); } @@ -183,7 +183,7 @@ public class TransformingIteratorTest { setUpTransformIterator(IllegalVisKeyTransformingIterator.class); checkExpected(new TreeMap<Key,Value>()); } - + @Test public void testRangeStart() throws Exception { setUpTransformIterator(ColVisReversingKeyTransformingIterator.class); @@ -296,7 +296,7 @@ public class TransformingIteratorTest { bw.addMutation(m1); bw.close(); - + BatchScanner bs = connector.createBatchScanner("shard_table", authorizations, 1); bs.addScanIterator(new IteratorSetting(21, ColVisReversingKeyTransformingIterator.class)); @@ -311,7 +311,7 @@ public class TransformingIteratorTest { assertEquals("shard001", docKey.getRowData().toString()); assertEquals("doc02", docKey.getColumnQualifierData().toString()); assertFalse(iter.hasNext()); - + bs.close(); } @@ -370,7 +370,7 @@ public class TransformingIteratorTest { } } - + @Test public void testDupes() throws Exception { setUpTransformIterator(DupeTransformingIterator.class); @@ -387,7 +387,7 @@ public class TransformingIteratorTest { assertEquals(81, count); } - + private Key createDeleteKey(String row, String colFam, String colQual, String colVis, long timestamp) { Key key = new Key(row, colFam, colQual, colVis, timestamp); key.setDeleted(true); @@ -518,7 +518,7 @@ public class TransformingIteratorTest { } } - + public static abstract class ReversingKeyTransformingIterator extends TransformingIterator { @Override @@ -579,7 +579,7 @@ public class TransformingIteratorTest { protected PartialKey getKeyPrefix() { return PartialKey.ROW_COLFAM_COLQUAL; } - + @Override protected void transformRange(SortedKeyValueIterator<Key,Value> input, KVBuffer output) throws IOException { while (input.hasTop()) { @@ -591,7 +591,7 @@ public class TransformingIteratorTest { } } } - + public static class IllegalVisCompactionKeyTransformingIterator extends IllegalVisKeyTransformingIterator { @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { @@ -599,7 +599,7 @@ public class TransformingIteratorTest { super.init(source, options, env); } } - + public static class BadVisKeyTransformingIterator extends TransformingIterator { @Override protected PartialKey getKeyPrefix() { @@ -667,22 +667,27 @@ public class TransformingIteratorTest { this.delegate = delegate; } + @Override public SortedKeyValueIterator<Key,Value> reserveMapFileReader(String mapFileName) throws IOException { return delegate.reserveMapFileReader(mapFileName); } + @Override public AccumuloConfiguration getConfig() { return delegate.getConfig(); } + @Override public IteratorScope getIteratorScope() { return IteratorScope.majc; } + @Override public boolean isFullMajorCompaction() { return delegate.isFullMajorCompaction(); } + @Override public void registerSideChannel(SortedKeyValueIterator<Key,Value> iter) { delegate.registerSideChannel(iter); }