Diff
stringlengths
10
2k
Message
stringlengths
28
159
/* * 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. */
Remove this unused private "appendProp" method.
import org.apache.accumulo.core.util.shell.Token;
Replace all tab characters in this file by sequences of white-spaces.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.server.conf.ServerConfiguration; private String bannerText; private String bannerColor; private String bannerBackground; bannerText = sanitize(ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_TEXT)); bannerColor = ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_COLOR).replace("'", "&#39;"); bannerBackground = ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_BACKGROUND).replace("'", "&#39;"); sb.append("<div id='header'>"); if (!bannerText.isEmpty()) { sb.append("<div id='banner' style='color:").append(bannerColor).append(";background:").append(bannerBackground).append("'>").append(bannerText) .append("</div>\n"); } sb.append("<div id='headertitle'>"); sb.append("<h1>").append(getTitle(req)).append("</h1></div>\n"); sb.append("<br><span class='smalltext'>").append(new Date().toString().replace(" ", "&nbsp;")).append("</span>"); sb.append("</div>\n"); // end <div id='subheader'> sb.append("</div>\n"); // end <div id='header'> sb.append("<div id='main'"); if (bannerText.isEmpty()) sb.append(" style='bottom:0'"); sb.append(">\n"); if (!bannerText.isEmpty()) { sb.append("<div id='footer' style='color:").append(bannerColor).append(";background:").append(bannerBackground).append("'>").append(bannerText) .append("</div>\n"); }
Define a constant instead of duplicating this literal "</div>\n" 8 times.
import org.junit.Assert;
Remove this unused private "appendProp" method.
/** * An InputFormat that turns the file data ingested with FileDataIngest into an InputStream. Mappers used with this InputFormat must close the InputStream. */
Either log or rethrow this exception.
// Surprised we got away without pausing before. try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } public static void main(String args[]) throws Exception { FunctionalTest.main(args); new TablePermissionsTest().run(); }
Rename the "log" logger to comply with the format "LOG(?:GER)?".
/* * 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. */ /** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.apache.accumulo.proxy.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; @SuppressWarnings("all") public enum CompactionReason implements org.apache.thrift.TEnum { USER(0), SYSTEM(1), CHOP(2), IDLE(3), CLOSE(4); private final int value; private CompactionReason(int value) { this.value = value; } /** * Get the integer value of this enum value, as defined in the Thrift IDL. */ public int getValue() { return value; } /** * Find a the enum type by its integer value, as defined in the Thrift IDL. * @return null if the value is not found. */ public static CompactionReason findByValue(int value) { switch (value) { case 0: return USER; case 1: return SYSTEM; case 2: return CHOP; case 3: return IDLE; case 4: return CLOSE; default: return null; } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.thrift.TCredentials; TCredentials auth;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* * {@link columnFamilies} is used, at the lowest level, to determine which data blocks inside of an RFile need to be opened for this iterator. This set of data * blocks is also the set of locality groups defined for the given table. If no columnFamilies are provided, the data blocks for all locality groups inside of * the correct RFile will be opened and seeked in an attempt to find the correct start key, irregardless of the startKey in the {@link range}. * * In an Accumulo instance in which multiple locality groups exist for a table, it is important to ensure that {@link columnFamilies} is properly set to the * minimum required column families to ensure that data from separate locality groups is not inadvertently read.
2 duplicated blocks of code must be removed.
package org.apache.accumulo.wikisearch.iterator;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.metadata.MetadataLocationObtainer; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; public static synchronized TabletLocator getLocator(Instance instance, Text tableId) { tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getLocator(instance, new Text(RootTable.ID)), mlo); tl = new TabletLocatorImpl(tableId, getLocator(instance, new Text(MetadataTable.ID)), mlo);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/** * Unescapes 0x00 0x01 0x01 with 0x00 and 0x01 0x01 0x2 with 0x01 */ /** * Splits a byte array by 0x00 */ /** * Concatenates byte arrays with 0x00 as a delimiter */
Remove this unused import 'java.util.Date'.
package org.apache.accumulo.examples.simple.filedata;
Rename "table" which hides the field declared at line 107.
import org.apache.accumulo.core.util.ContextFactory; TaskAttemptContext context = ContextFactory.createTaskAttemptContext(conf); Mapper<LongWritable,Text,Text,Mutation>.Context con = ContextFactory.createMapContext(mapper, context, rr, rw, oc, sr, split);
Rename this generic name to match the regular expression '^[A-Z]$'.
/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.proxy.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; public enum CompactionReason implements org.apache.thrift.TEnum { USER(0), SYSTEM(1), CHOP(2), IDLE(3), CLOSE(4); private final int value; private CompactionReason(int value) { this.value = value; } /** * Get the integer value of this enum value, as defined in the Thrift IDL. */ public int getValue() { return value; } /** * Find a the enum type by its integer value, as defined in the Thrift IDL. * @return null if the value is not found. */ public static CompactionReason findByValue(int value) { switch (value) { case 0: return USER; case 1: return SYSTEM; case 2: return CHOP; case 3: return IDLE; case 4: return CLOSE; default: return null; } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
List<Range> ranges = null; if (ranges == null || ranges.size() == 0) { throw new IllegalArgumentException("ranges must be non null and contain at least 1 range"); } this.ranges = new ArrayList<Range>(ranges); if (ranges == null) { throw new IllegalStateException("ranges not set"); }
Remove the literal "true" boolean value.
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); if (!(fs instanceof DistributedFileSystem)) break;
Remove this unused private "match" method.
import junit.framework.Assert; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); @Test public void testMockConnectorReturnsCorrectInstance() throws AccumuloException, AccumuloSecurityException{ String name = "an-interesting-instance-name"; Instance mockInstance = new MockInstance(name); Assert.assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance()); Assert.assertEquals(name, mockInstance.getConnector("foo","bar").getInstance().getInstanceName()); }
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import org.apache.accumulo.core.cli.Help; import com.beust.jcommander.Parameter; static class Opts extends Help { @Parameter(names={"-z", "--keepers"}) String keepers = "localhost:2181"; @Parameter(names="--overwrite") boolean overwrite = false; @Parameter(names="--file") String file; } Opts opts = new Opts(); opts.parseArgs(RestoreZookeeper.class.getName(), args); if (opts.file != null) { in = new FileInputStream(opts.file); ZooKeeper zk = new ZooKeeper(opts.keepers, timeout, new Watcher() { parser.parse(in, new Restore(zk, opts.overwrite));
Remove this call to "exit" or ensure it is really required.
* 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. */ static private void readWrite(LogEvents event, long seq, int tid, String filename, KeyExtent tablet, Mutation[] mutations, LogFileKey keyResult, LogFileValue valueResult) throws IOException { key.tablet = tablet; if (a.length == b.length) for (int i = 0; i < a.length; i++) { assertEquals(a[i], b[i]); Collection<ColumnUpdate> au = a[i].getUpdates(); Collection<ColumnUpdate> bu = a[i].getUpdates(); assertEquals(au, bu); } readWrite(MUTATION, 7, 8, null, null, new Mutation[] {m}, key, value); readWrite(MANY_MUTATIONS, 9, 10, null, null, new Mutation[] {m, m}, key, value); assertEqualsMutations(value.mutations, new Mutation[] {m, m}); assertEquals(LogFileKey.eventType(MUTATION), LogFileKey.eventType(MANY_MUTATIONS)); assertEquals(LogFileKey.eventType(COMPACTION_START), LogFileKey.eventType(COMPACTION_FINISH)); assertTrue(LogFileKey.eventType(DEFINE_TABLET) < LogFileKey.eventType(COMPACTION_FINISH)); assertTrue(LogFileKey.eventType(COMPACTION_FINISH) < LogFileKey.eventType(MUTATION));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
/* * 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. */
296 duplicated blocks of code must be removed.
@SuppressWarnings("unchecked") @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TypedValueCombiner<V> newInstance = (TypedValueCombiner<V>) super.deepCopy(env); newInstance.setEncoder(encoder); return newInstance; }
Define and throw a dedicated exception instead of using a generic one.
package org.apache.accumulo.examples.simple.mapreduce.bulk;
2 duplicated blocks of code must be removed.
} else if (currentRange.start.equals(range.start)) {
Replace all tab characters in this file by sequences of white-spaces.
package org.apache.accumulo.server.tabletserver; import org.apache.log4j.Level; public class TLevel extends Level { private static final long serialVersionUID = 1L; public final static Level TABLET_HIST = new TLevel(); protected TLevel() { super(Level.DEBUG_INT + 100, "TABLET_HIST", Level.DEBUG_INT + 100); } static public Level toLevel(int val) { if (val == Level.DEBUG_INT + 100) return Level.DEBUG; return Level.toLevel(val); } }
Return empty string instead.
package org.apache.accumulo.examples.simple.constraints;
2 duplicated blocks of code must be removed.
import org.apache.accumulo.core.security.tokens.AccumuloToken; import org.apache.hadoop.fs.Path; * <li>{@link AccumuloRowInputFormat#setConnectorInfo(Job, AccumuloToken)} OR {@link AccumuloRowInputFormat#setConnectorInfo(Job, Path)}
Define and throw a dedicated exception instead of using a generic one.
package org.apache.accumulo.examples.wikisearch.logic; import org.apache.accumulo.examples.wikisearch.iterator.EvaluatingIterator; import org.apache.accumulo.examples.wikisearch.normalizer.LcNoDiacriticsNormalizer; import org.apache.accumulo.examples.wikisearch.normalizer.Normalizer; import org.apache.accumulo.examples.wikisearch.parser.RangeCalculator; import org.apache.accumulo.examples.wikisearch.parser.QueryParser.QueryTerm; import org.apache.accumulo.examples.wikisearch.protobuf.Uid; import org.apache.accumulo.examples.wikisearch.util.TextUtil; import org.apache.hadoop.io.Text; import org.apache.log4j.Logger;
Rename "table" which hides the field declared at line 107.
import java.util.ArrayList; private String uris; private FileObject[] files; private synchronized VFSClassLoader getClassloader() { if (cl == null) { try { files = AccumuloVFSClassLoader.resolve(vfs, uris); if (null != parent) setClassloader(new VFSClassLoader(files, vfs, parent)); else setClassloader(new VFSClassLoader(files, vfs)); } catch (FileSystemException fse) { throw new RuntimeException(fse); } } return cl; private synchronized void setClassloader(VFSClassLoader cl) { this.cl = cl; } public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ClassLoader parent, long monitorDelay) throws FileSystemException { super(parent); this.uris = uris; ArrayList<FileObject> pathsToMonitor = new ArrayList<FileObject>(); files = AccumuloVFSClassLoader.resolve(vfs, uris, pathsToMonitor); monitor.setRecursive(false); for (FileObject file : pathsToMonitor) { log.debug("monitoring " + file); } public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ClassLoader parent) throws FileSystemException { this(uris, vfs, parent, DEFAULT_TIMEOUT); } setClassloader(null); setClassloader(null); setClassloader(null); return this.getClassloader().loadClass(name); return this.getClassloader().getResource(name); return this.getClassloader().getResources(name); return this.getClassloader().getResourceAsStream(name); this.getClassloader().setDefaultAssertionStatus(enabled); this.getClassloader().setPackageAssertionStatus(packageName, enabled); this.getClassloader().setClassAssertionStatus(className, enabled); this.getClassloader().clearAssertionStatus();
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
private VisibilityEvaluator ve; private Text defaultVisibility; private LRUMap cache; private Text tmpVis; private static final Logger log = Logger.getLogger(VisibilityFilter.class); public VisibilityFilter(Authorizations authorizations, byte[] defaultVisibility) { this.ve = new VisibilityEvaluator(authorizations); this.defaultVisibility = new Text(defaultVisibility); this.cache = new LRUMap(1000); this.tmpVis = new Text(); } public boolean accept(Key k, Value v) { Text testVis = k.getColumnVisibility(tmpVis); if (testVis.getLength() == 0 && defaultVisibility.getLength() == 0) return true; else if (testVis.getLength() == 0) testVis = defaultVisibility; Boolean b = (Boolean) cache.get(testVis); if (b != null) return b; try { Boolean bb = ve.evaluate(new ColumnVisibility(testVis)); cache.put(new Text(testVis), bb); return bb; } catch (VisibilityParseException e) { log.error("Parse Error", e); return false; } @Override public void init(Map<String,String> options) {}
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.ArrayList; static abstract class GetRanges<K, V> extends InputFormatBase<K,V> { public static List<Range> getRanges(Configuration conf) throws IOException { return InputFormatBase.getRanges(conf); } }; @Test public void testSetRanges() throws IOException { JobContext job = new JobContext(new Configuration(), new JobID()); List<Range> ranges = new ArrayList<Range>(); for (int i = 0; i < 100000; i++) { ranges.add(new Range(new Text(String.format("%05x", i)))); } AccumuloInputFormat.setRanges(job.getConfiguration(), ranges); List<Range> ranges2 = GetRanges.getRanges(job.getConfiguration()); assertEquals(ranges, ranges2); }
Return empty string instead.
public class DeleteIT extends ConfigurableMacIT { assertEquals(0, cluster.exec(TestRandomDeletes.class, "-u", "root", "-p", ROOT_PASSWORD, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers()).waitFor());
Use "Integer.toString" instead.
/* * 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. */ public void testSerialization() throws IOException { String[] hosts = new String[2]; FileSplit fSplit = new FileSplit(testPath, 1, 2, hosts); WikipediaInputSplit split = new WikipediaInputSplit(fSplit, 7); out.close(); String[] hosts2 = fSplit2.getLocations(); for (int i = 0; i < hosts.length; i++) { Assert.assertEquals(hosts[i], hosts2[i]);
Remove this unused private "match" method.
* Autogenerated by Thrift Compiler (0.9.0)
Rename this class name to match the regular expression '^[A-Z][a-zA-Z0-9]*$'.
package org.apache.accumulo.core.util; import org.apache.log4j.Logger; public class UtilWaitThread { private static final Logger log = Logger.getLogger(UtilWaitThread.class); public static void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { log.error(e.getMessage(),e); } } }
Return empty string instead.
MASTER_LEASE_RECOVERY_IMPLEMETATION("master.lease.recovery.implementation", "org.apache.accumulo.server.master.recovery.RecoverLease", PropertyType.CLASSNAME, "A class that implements a mechansim to steal write access to a file"),
Rename the "log" logger to comply with the format "LOG(?:GER)?".
if (mergeFile == null) return EMPTY_MAP;
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.client.IteratorSetting; static private final String SLEEP_TIME = "sleepTime"; public static void setSleepTime(IteratorSetting is, long millis) { is.addOption(SLEEP_TIME, Long.toString(millis)); } sleepTime = Long.parseLong(options.get(SLEEP_TIME));
Either log or rethrow this exception.
data.queueTime += q;
Remove this unused private "appendProp" method.
// instead of setting table properties, just put the options in a list to use at scan time Class<?> loadClass; try { loadClass = getClass().getClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + classname); } try { loadClass.asSubclass(SortedKeyValueIterator.class); } catch (ClassCastException ex) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "xUnable to load " + classname + " as type "
Either log or rethrow this exception.
pranges.add(new PRange(null, false, stop, false)); String cookie = tpc.proxy().createScanner(userpass, testtable, null, null, new PRange(null, false, stop, false));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);
Complete the task associated to this TODO comment.
import org.apache.accumulo.core.cli.Help; import com.beust.jcommander.Parameter; static class Opts extends Help { @Parameter(names="-list") boolean list = false; @Parameter(names="-delete") String delete = null; } Opts opts = new Opts(); opts.parseArgs(TabletServerLocks.class.getName(), args); if (opts.list) { } else if (opts.delete != null) {
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
package org.apache.accumulo.cloudtrace.thrift;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* Returns the location of the tablet server that is serving the root tablet. * @return location in "hostname:port" form * Returns the location(s) of the accumulo master and any redundant servers. * @return a list of locations in "hostname:port" form * Returns a unique string that identifies this instance of accumulo. * Returns a comma-separated list of zookeeper servers the instance is using. * * @return the zookeeper servers this instance is using in "hostname:port" form * Returns the zookeeper connection timeout. * * Returns a connection to accumulo. * a valid accumulo user * @return the accumulo Connector * when a generic exception occurs * when a user's credentials are invalid * Returns a connection to accumulo. * a valid accumulo user * @return the accumulo Connector * when a generic exception occurs * when a user's credentials are invalid * Returns a connection to accumulo. * a valid accumulo user * @return the accumulo Connector * when a generic exception occurs * when a user's credentials are invalid * Returns a connection to this instance of accumulo. * a valid accumulo user * @return the accumulo Connector * when a generic exception occurs * when a user's credentials are invalid * Returns the AccumuloConfiguration to use when interacting with this instance. * Set the AccumuloConfiguration to use when interacting with this instance. * accumulo configuration
Complete the task associated to this TODO comment.
@Override public void visit(State state, Properties props) throws Exception { String indexTableName = (String) state.get("indexTableName"); String tmpIndexTableName = indexTableName + "_tmp"; // scan new and old index and verify identical Scanner indexScanner1 = state.getConnector().createScanner(tmpIndexTableName, Constants.NO_AUTHS); Scanner indexScanner2 = state.getConnector().createScanner(indexTableName, Constants.NO_AUTHS); Iterator<Entry<Key,Value>> iter = indexScanner2.iterator(); int count = 0; for (Entry<Key,Value> entry : indexScanner1) { if (!iter.hasNext()) throw new Exception("index rebuild mismatch " + entry.getKey() + " " + indexTableName); Key key1 = entry.getKey(); Key key2 = iter.next().getKey(); if (key1.compareTo(key2, PartialKey.ROW_COLFAM_COLQUAL) != 0) throw new Exception("index rebuild mismatch " + key1 + " " + key2 + " " + indexTableName + " " + tmpIndexTableName); count++; if (iter.hasNext()) throw new Exception("index rebuild mismatch " + iter.next().getKey() + " " + tmpIndexTableName); log.debug("Verified " + count + " index entries "); state.getConnector().tableOperations().delete(indexTableName); state.getConnector().tableOperations().rename(tmpIndexTableName, indexTableName); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.tabletserver.thrift.MutationLogger.log_args; import org.apache.log4j.Logger; private static final Logger log = Logger.getLogger(WikipediaPartitionedIngester.class); private int runPartitionerJob() throws Exception private int runIngestJob() throws Exception ingestJob.setOutputFormatClass(SortingRFileOutputFormat.class); SortingRFileOutputFormat.setMaxBufferSize(ingestConf, WikipediaConfiguration.bulkIngestBufferSize(ingestConf)); String bulkIngestDir = WikipediaConfiguration.bulkIngestDir(ingestConf); if(bulkIngestDir == null) { log.error("Bulk ingest dir not set"); return 1; } SortingRFileOutputFormat.setPathName(ingestConf, WikipediaConfiguration.bulkIngestDir(ingestConf)); } else { private int loadBulkFiles() throws IOException, AccumuloException, AccumuloSecurityException, TableNotFoundException Path failPath = new Path(failureDirectory+"/"+dir.getName()); fs.mkdirs(failPath); connector.tableOperations().importDirectory(dir.getName(), dir.toString(), failPath.toString(), true);
Remove this unused "log" private field.
package org.apache.accumulo.test.randomwalk.image; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
final private static Text ROOT_TABLE_ID = new Text(RootTable.ID); /* UNLOAD_ROOT_TABLET */ {_, _, _, X, X, X, X}, /* STOP */ {_, _, _, _, _, X, X}}; result += watcher.getStats(METADATA_TABLE_ID).unassigned(); result += watcher.getStats(METADATA_TABLE_ID).unassigned(); { int count = nonMetaDataTabletsAssignedOrHosted(); } break; { int count = assignedOrHosted(METADATA_TABLE_ID); if (count == 0) } break; { int count = assignedOrHosted(METADATA_TABLE_ID); if (count > 0) { log.debug(String.format("%d metadata tablets online", count)); setMasterState(MasterState.UNLOAD_ROOT_TABLET); } int root_count = assignedOrHosted(ROOT_TABLE_ID); if (root_count > 0) log.debug("The root tablet is still assigned or hosted"); if (count + root_count == 0) { } break; public void assignedTablet(KeyExtent extent) { if (extent.isMeta()) { if (getMasterState().equals(MasterState.UNLOAD_ROOT_TABLET)) { setMasterState(MasterState.UNLOAD_METADATA_TABLETS); } } if (extent.isRootTablet()) { // probably too late, but try anyhow if (getMasterState().equals(MasterState.STOP)) { setMasterState(MasterState.UNLOAD_ROOT_TABLET); } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public static void clearInstance() { instance = null; }
1 duplicated blocks of code must be removed.
TableInfo _val3; // optional
Replace all tab characters in this file by sequences of white-spaces.
public class ServerSideErrorIT extends SimpleMacIT { String tableName = makeTableName(); c.tableOperations().create(tableName); c.tableOperations().attachIterator(tableName, is); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY); BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 2); for (Entry<String,String> e : to.getProperties(tableName)) { to.removeProperty(tableName, e.getKey()); scanner = c.createScanner(tableName, Authorizations.EMPTY);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
String path = ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table; ZooReaderWriter.getRetryingInstance().sync(path); serializedPerms = ZooReaderWriter.getRetryingInstance().getData(path, null); String path = ZKUserPath + "/" + user + ZKUserSysPerms; ZooReaderWriter.getRetryingInstance().sync(path); perms = ZooReaderWriter.getRetryingInstance().getData(path, null);
3 duplicated blocks of code must be removed.
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
300 duplicated blocks of code must be removed.
ByteBuffer _elem72; // optional ByteBuffer _elem83; // optional
277 duplicated blocks of code must be removed.
import org.apache.accumulo.trace.instrument.Span; import org.apache.accumulo.trace.instrument.Trace; import org.apache.accumulo.trace.instrument.Tracer; import org.apache.accumulo.trace.thrift.TInfo; Text tableId; public ScanState(TCredentials credentials, Text tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns, int size, this.tableId = tableId; loc = TabletLocator.getInstance(instance, scanState.tableId).locateTablet(scanState.startRow, scanState.skipStartRow, false, credentials); if (!Tables.exists(instance, scanState.tableId.toString())) throw new TableDeletedException(scanState.tableId.toString()); else if (Tables.getTableState(instance, scanState.tableId.toString()) == TableState.OFFLINE) throw new TableOfflineException(instance, scanState.tableId.toString()); error = "Failed to locate tablet for table : " + scanState.tableId + " row : " + scanState.startRow; if (!Tables.exists(instance, scanState.tableId.toString())) throw new TableDeletedException(scanState.tableId.toString()); e.setTableInfo(Tables.getPrintableTableInfoFromId(instance, scanState.tableId.toString())); TabletLocator.getInstance(instance, scanState.tableId).invalidateCache(loc.tablet_extent); TabletLocator.getInstance(instance, scanState.tableId).invalidateCache(loc.tablet_location);
Constructor has 9 parameters, which is greater than 7 authorized.
return Authorizations.EMPTY; zoo.putPersistentData(ZKUserPath + "/" + rootuser + ZKUserAuths, ZKSecurityTool.convertAuthorizations(Authorizations.EMPTY), NodeExistsPolicy.FAIL);
Remove this unused method parameter "range".
/** * 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.start.classloader.vfs; /** * */ public interface ReloadingClassLoader { ClassLoader getClassLoader(); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.fate.zookeeper.ZooCache;
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
1 duplicated blocks of code must be removed.
import static org.junit.Assert.assertTrue; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; Map<String,String> siteConfig = new HashMap<String,String>(); cfg.setSiteConfig(siteConfig); @Test(timeout = 60 * 1000) for (@SuppressWarnings("unused") Entry<Key,Value> entry : c.createScanner(RootTable.NAME, Authorizations.EMPTY))
Remove this unused "entry" local variable.
import org.apache.accumulo.server.tabletserver.compaction.CompactionStrategy; import org.apache.accumulo.server.tabletserver.compaction.CompactionStrategy.Writer; import org.apache.accumulo.server.tabletserver.compaction.DefaultWriter; import org.apache.accumulo.server.tabletserver.compaction.MajorCompactionReason; private Writer writer; TableConfiguration acuTableConf, KeyExtent extent, CompactionEnv env, List<IteratorSetting> iterators, MajorCompactionReason reason, CompactionStrategy.Writer writer) { this.writer = writer; this(conf, fs, files, imm, outputFile, propogateDeletes, acuTableConf, extent, env, new ArrayList<IteratorSetting>(), null, new DefaultWriter()); List<FileSKVWriter> writers = Collections.singletonList(mfw); writer.write(itr.getTopKey(), itr.getTopValue(), writers);
Immediately return this expression instead of assigning it to the temporary variable "openReader".
return Arrays.copyOfRange(buffer.array(), buffer.position(), buffer.limit());
Return empty string instead.
import org.apache.accumulo.server.ServerConstants; import org.apache.accumulo.server.fs.VolumeManager.FileType; datafiles.add(new FileRef(entry.getValue().toString(), this.master.fs.getFullPath(FileType.TABLE, entry.getValue().toString()))); String tdir = master.getFileSystem().choose(ServerConstants.getTablesDirs()) + "/" + extent.getTableId() + Constants.DEFAULT_TABLET_LOCATION; MetadataTableUtil.addTablet(new KeyExtent(extent.getTableId(), null, extent.getPrevEndRow()), tdir,
Remove this unused private "FileType" constructor.
* 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. */ @Override public Value reduce(Key key, Iterator<Value> iter) { }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (orFields) return matches(rowMatcher, key.getRowData()) || matches(colfMatcher, key.getColumnFamilyData()) || matches(colqMatcher, key.getColumnQualifierData()) || matches(valueMatcher, value.get(), 0, value.get().length); if (options.containsKey(ROW_REGEX)) Pattern.compile(options.get(ROW_REGEX)).matcher(""); if (options.containsKey(COLF_REGEX)) Pattern.compile(options.get(COLF_REGEX)).matcher(""); if (options.containsKey(COLQ_REGEX)) Pattern.compile(options.get(COLQ_REGEX)).matcher(""); if (options.containsKey(VALUE_REGEX)) Pattern.compile(options.get(VALUE_REGEX)).matcher("");
Remove this call to "exit" or ensure it is really required.
protected static String encodeColumns(Text[] columns) { protected static String encodeBooleans(boolean[] flags) { protected static boolean[] decodeBooleans(String flags) {
Move this constructor to comply with Java Code Conventions.
import org.apache.accumulo.core.client.security.SecurityErrorCode; if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) { if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_AUTHORIZATIONS)) { && ((AccumuloSecurityException) re.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) { && ((AccumuloSecurityException) re.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.BAD_AUTHORIZATIONS)) { if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) { } else if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS)) {
Do not forget to remove this deprecated code someday.
import java.nio.charset.Charset; final Charset utf8 = Charset.forName("UTF8"); Connector connector = HdfsZooInstance.getInstance().getConnector(args[0], args[1].getBytes(utf8));
Move this variable to comply with Java Code Conventions.
final String tablename; final MockAccumulo acu; MockBatchWriter(MockAccumulo acu, String tablename) { this.acu = acu; this.tablename = tablename; } @Override public void addMutation(Mutation m) throws MutationsRejectedException { acu.addMutation(tablename, m); } @Override public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException { for (Mutation m : iterable) { acu.addMutation(tablename, m); } @Override public void flush() throws MutationsRejectedException {} @Override public void close() throws MutationsRejectedException {}
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.util.UnsynchronizedBuffer; private UnsynchronizedBuffer.Writer buffer; buffer = new UnsynchronizedBuffer.Writer(); private byte[] oldReadBytes(UnsynchronizedBuffer.Reader in) { private byte[] readBytes(UnsynchronizedBuffer.Reader in) { UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(data); private ColumnUpdate deserializeColumnUpdate(UnsynchronizedBuffer.Reader in) { UnsynchronizedBuffer.Reader din = new UnsynchronizedBuffer.Reader(localData); buffer = new UnsynchronizedBuffer.Writer();
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* 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. */ * Hijack log4j and capture log events for display. * * if (instance == null) return new LogService(); private LinkedHashMap<String,DedupedLogEvent> events = new LinkedHashMap<String,DedupedLogEvent>(MAX_LOGS + 1, (float) .75, true) { private static final long serialVersionUID = 1L; @Override @SuppressWarnings("rawtypes") protected boolean removeEldestEntry(Map.Entry eldest) { return size() > MAX_LOGS; } public LogService() { synchronized (LogService.class) { if (application == null || application.toString().isEmpty()) return; DedupedLogEvent oldDev = events.remove(dev.toString()); dev.setCount(oldDev.getCount() + 1); synchronized public List<DedupedLogEvent> getEvents() { return new ArrayList<DedupedLogEvent>(events.values()); } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.MutationsRejectedException; testBatchScannerTimeout(); testBatchWriterTimeout(); } public void testBatchWriterTimeout() throws Exception { Connector conn = getConnector(); conn.tableOperations().create("foo1"); conn.tableOperations().addConstraint("foo1", SlowConstraint.class.getName()); // give constraint time to propogate through zookeeper UtilWaitThread.sleep(250); BatchWriter bw = conn.createBatchWriter("foo1", new BatchWriterConfig().setTimeout(3, TimeUnit.SECONDS)); Mutation mut = new Mutation("r1"); mut.put("cf1", "cq1", "v1"); bw.addMutation(mut); try { bw.close(); throw new Exception("batch writer did not timeout"); } catch (MutationsRejectedException mre) { if (!(mre.getCause() instanceof TimedOutException)) { throw mre; } } } public void testBatchScannerTimeout() throws Exception { BatchWriter bw = getConnector().createBatchWriter("timeout", new BatchWriterConfig()); throw new Exception("batch scanner did not time out");
Remove this unused method parameter "e".
/* * 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.functional; import static org.junit.Assert.*; import org.apache.accumulo.start.TestMain; import org.junit.Test; public class StartIT extends MacTest { @Test(timeout=10*1000) public void test() throws Exception { assertTrue(cluster.exec(TestMain.class, "exception").waitFor() != 0); assertEquals(0, cluster.exec(TestMain.class, "success").waitFor()); assertTrue(cluster.exec(TestMain.class).waitFor() != 0); } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* Connector facilitates connecting to an Accumulo instance. One of the main purposes of this class is to make it easy to connect to multiple Accumulo instances
2 duplicated blocks of code must be removed.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
super(max, max, 4l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamingThreadFactory(name));
Remove this unused private "appendProp" method.
* 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. */ public class QuitCommand extends ExitCommand {}
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
@Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException { String user = cl.getArgs()[0]; if (shellState.getConnector().whoami().equals(user)) throw new BadArgumentException("You cannot delete yourself", fullCommand, fullCommand.indexOf(user)); shellState.getConnector().securityOperations().dropUser(user); Shell.log.debug("Deleted user " + user); return 0; } @Override public String description() { return "deletes a user"; } @Override public String usage() { return getName() + " <username>"; } @Override public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) { registerCompletionForUsers(root, completionSet); } @Override public int numArgs() { return 1; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* @deprecated since 1.4, replaced by {@link org.apache.accumulo.core.iterators.Combiner}
Either log or rethrow this exception.
if (expectedCount != 0) throw new Exception(" expected count !=0 " + expectedCount);
Remove this call to "exit" or ensure it is really required.
scanner.setTimeout(3, TimeUnit.SECONDS);
Rename this class name to match the regular expression '^[A-Z][a-zA-Z0-9]*$'.
* @throws IllegalArgumentException * if the setting conflicts with existing iterators
Either log or rethrow this exception.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
/* * 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.wikisearch.logic; import org.apache.hadoop.mapreduce.Counter; import org.apache.hadoop.mapreduce.Counters; import org.apache.hadoop.mapreduce.StatusReporter; public class StandaloneStatusReporter extends StatusReporter { private Counters c = new Counters(); private long filesProcessed = 0; private long recordsProcessed = 0; public Counters getCounters() { return c; } @Override public Counter getCounter(Enum<?> name) { return c.findCounter(name); } @Override public Counter getCounter(String group, String name) { return c.findCounter(group, name); } @Override public void progress() { // do nothing } @Override public void setStatus(String status) { // do nothing } public long getFilesProcessed() { return filesProcessed; } public long getRecordsProcessed() { return recordsProcessed; } public void incrementFilesProcessed() { filesProcessed++; recordsProcessed = 0; } public void incrementRecordsProcessed() { recordsProcessed++; } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * 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. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.server.ServerOpts;
2 duplicated blocks of code must be removed.
import org.apache.accumulo.core.metadata.MetadataTable;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.ServerOpts; private Credentials credentials; gc.init(fs, instance, SystemCredentials.get(), serverConf.getConfiguration().getBoolean(Property.GC_TRASH_IGNORE)); public void init(VolumeManager fs, Instance instance, Credentials credentials, boolean noTrash) throws IOException { Connector connector = instance.getConnector(credentials.getPrincipal(), credentials.getToken()); Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, Authorizations.EMPTY); scanner = new IsolatedScanner(instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, Authorizations.EMPTY));
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
@Deprecated @Deprecated
Remove this unused private "appendProp" method.
throw new IllegalArgumentException("Invalid options");
Complete the task associated to this TODO comment.
import static org.junit.Assert.assertTrue;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.proxy.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; public enum ScanType implements org.apache.thrift.TEnum { SINGLE(0), BATCH(1); private final int value; private ScanType(int value) { this.value = value; } /** * Get the integer value of this enum value, as defined in the Thrift IDL. */ public int getValue() { return value; } /** * Find a the enum type by its integer value, as defined in the Thrift IDL. * @return null if the value is not found. */ public static ScanType findByValue(int value) { switch (value) { case 0: return SINGLE; case 1: return BATCH; default: return null; } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
@Deprecated return Authorizations.EMPTY; public boolean canScan(TCredentials credentials, String table, TRange range, List<TColumn> columns, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException { public boolean canScan(TCredentials credentials, String table, Map<TKeyExtent,List<TRange>> tbatch, List<TColumn> tcolumns, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException {
Remove this unused method parameter "range".