Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
import org.apache.accumulo.core.iterators.LongCombiner.FixedLenEncoder;
import org.apache.accumulo.core.iterators.LongCombiner.VarLenEncoder;
Encoder<Long> encoder = LongCombiner.VAR_LEN_ENCODER;
Encoder<Long> encoder = LongCombiner.VAR_LEN_ENCODER;
LongCombiner.setEncodingType(is, VarLenEncoder.class);
Encoder<Long> encoder = LongCombiner.FIXED_LEN_ENCODER;
LongCombiner.setEncodingType(is, FixedLenEncoder.class.getName());
Encoder<Long> encoder = LongCombiner.STRING_ENCODER;
Encoder<Long> encoder = LongCombiner.STRING_ENCODER;
Encoder<Long> encoder = LongCombiner.VAR_LEN_ENCODER;
LongCombiner.setEncodingType(is, VarLenEncoder.class.getName());
Encoder<Long> encoder = LongCombiner.FIXED_LEN_ENCODER;
Encoder<Long> encoder = LongCombiner.VAR_LEN_ENCODER;
sumArray(SummingArrayCombiner.VarLongArrayEncoder.class, "VARNUM");
sumArray(SummingArrayCombiner.FixedLongArrayEncoder.class, "LONG"); | Either log or rethrow this exception. |
@Deprecated
@Override
ColumnUpdate upd = (ColumnUpdate) obj;
return Arrays.equals(getColumnFamily(), upd.getColumnFamily()) && Arrays.equals(getColumnQualifier(), upd.getColumnQualifier())
&& Arrays.equals(getColumnVisibility(), upd.getColumnVisibility()) && isDeleted() == upd.isDeleted() && Arrays.equals(getValue(), upd.getValue())
&& hasTimestamp() == upd.hasTimestamp() && getTimestamp() == upd.getTimestamp();
@Override
public int hashCode() {
return Arrays.hashCode(columnFamily) + Arrays.hashCode(columnQualifier) + Arrays.hashCode(columnVisibility)
+ (hasTimestamp ? (Boolean.TRUE.hashCode() + new Long(timestamp).hashCode()) : Boolean.FALSE.hashCode())
+ (deleted ? Boolean.TRUE.hashCode() : (Boolean.FALSE.hashCode() + Arrays.hashCode(val)));
} | Return empty string instead. |
* <li>{@link AccumuloOutputFormat#setConnectorInfo(Job, String, AuthenticationToken)} OR {@link AccumuloOutputFormat#setConnectorInfo(Job, Path)}
* {@link CredentialHelper#asBase64String(org.apache.accumulo.core.security.thrift.TCredentials)}.
* the path to a file in the configured file system, containing the serialized, base-64 encoded {@link AuthenticationToken} with the user's
* authentication
* @see #setConnectorInfo(Job, String, AuthenticationToken)
* @see #setConnectorInfo(Job, String, AuthenticationToken)
* @deprecated since 1.5.0; Use {@link #setConnectorInfo(Job, String, AuthenticationToken)}, {@link #setConnectorInfo(Job, Path)},
* {@link #setCreateTables(Job, boolean)}, and {@link #setDefaultTableName(Job, String)} instead. | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
/*
* 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public Repo<Master> call(long tid, Master master) throws Exception {
Instance instance = master.getInstance();
public void undo(long tid, Master master) throws Exception {
Instance instance = master.getInstance();
public Repo<Master> call(long tid, Master master) throws Exception {
tableInfo.tableId = Utils.getNextTableId(tableInfo.tableName, master.getInstance()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
static public InetSocketAddress parseAddress(String address, int defaultPort) throws NumberFormatException {
final String[] parts = address.split(":", 2);
if (parts.length == 2) {
if (parts[1].isEmpty()) return new InetSocketAddress(parts[0], defaultPort);
return new InetSocketAddress(parts[0], Integer.parseInt(parts[1]));
return new InetSocketAddress(address, defaultPort);
}
static public InetSocketAddress parseAddress(Text address, int defaultPort) {
return parseAddress(address.toString(), defaultPort);
}
static public TSocket createTSocket(String address, int defaultPort) {
InetSocketAddress addr = parseAddress(address, defaultPort);
return new TSocket(addr.getHostName(), addr.getPort());
}
static public String toString(InetSocketAddress addr) {
return addr.getAddress().getHostAddress() + ":" + addr.getPort();
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Connector conn = master.getConnector();
Instance instance = master.getInstance(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; | Move this constructor to comply with Java Code Conventions. |
import org.apache.accumulo.core.cli.Help;
import com.beust.jcommander.Parameter;
static class Opts extends Help {
@Parameter(names="--testId", required=true)
String testId;
@Parameter(names="--action", required=true, description="one of 'setup', 'teardown' or 'client'")
String action;
@Parameter(names="--count", description="number of tablet servers", required=true)
int numTabletServers;
}
Opts opts = new Opts();
opts.parseArgs(Run.class.getName(), args);
fs.copyToLocalFile(new Path(String.format("/accumulo-scale/conf/%s.conf", opts.testId)), new Path(testPath));
ScaleTest test = (ScaleTest) Class.forName(String.format("accumulo.server.test.scalability.%s", opts.testId)).newInstance();
test.init(scaleProps, testProps, opts.numTabletServers);
if (opts.action.equalsIgnoreCase("setup")) {
} else if (opts.action.equalsIgnoreCase("client")) {
} else if (opts.action.equalsIgnoreCase("teardown")) { | Remove this unused private "appendProp" method. |
private Key prevKey;
public BlockIndexEntry(int pos, int entriesLeft, Key prevKey) {
this.prevKey = prevKey;
this.prevKey = key;
return prevKey.compareTo(o.prevKey);
@Override
return prevKey + " " + entriesLeft + " " + pos;
}
public Key getPrevKey() {
return prevKey;
while (index > 0) {
if (blockIndex[index].getPrevKey().equals(startKey))
index--;
else
break;
}
if (blockIndex[index].getPrevKey().equals(blockIndex[index - 1].getPrevKey()))
if (index == 0 && blockIndex[index].getPrevKey().equals(startKey))
Key myPrevKey = rk.getKey();
index.add(new BlockIndexEntry(pos, indexEntry.getNumEntries() - count, myPrevKey));
BlockIndexEntry[] getIndexEntries() {
return blockIndex;
} | Remove this unused private "appendProp" method. |
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
if (e.getErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST))
return new org.apache.accumulo.proxy.thrift.TableNotFoundException(e.toString()); | 2 duplicated blocks of code must be removed. |
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
final HashMap<String,String> props = new HashMap<String,String>();
final HashSet<String> exclude = new HashSet<String>();
for (String key : keys) {
}
public void registerCompletion(final Token root, final Map<Command.CompletionSet,Set<String>> completionSet) {
final Options o = new Options(); | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import java.util.HashMap;
SecurityHelper.setSystemConnector(state, sysConn);
SecurityHelper.setSysUserName(state, systemUserName);
SecurityHelper.setSysUserPass(state, sysUserPass);
SecurityHelper.setTableExists(state, false);
SecurityHelper.setTableExists(state, false);
SecurityHelper.setTabUserPass(state, new byte[0]);
SecurityHelper.setTableName(state, secTableName);
SecurityHelper.setTabUserName(state, tableUserName);
SecurityHelper.setTabPerm(state, systemUserName, tp, false);
SecurityHelper.setTabPerm(state, tableUserName, tp, false);
SecurityHelper.setSysPerm(state, systemUserName, sp, false);
SecurityHelper.setSysPerm(state, tableUserName, sp, false);
SecurityHelper.setUserAuths(state, tableUserName, new Authorizations());
SecurityHelper.setAuthsMap(state, new HashMap<String,Integer>());
if (SecurityHelper.getTableExists(state)) {
String secTableName = SecurityHelper.getTableName(state);
if (SecurityHelper.getTabUserExists(state)) {
String tableUserName = SecurityHelper.getTabUserName(state);
String systemUserName = SecurityHelper.getSysUserName(state); | Either log or rethrow this exception. |
List<Text> range = ConcurrentFixture.generateRange(rand);
conn.tableOperations().compact(tableName, range.get(0), range.get(1), false, wait);
log.debug((wait ? "compacted " : "initiated compaction ") + tableName + " from " + range.get(0) + " to " + range.get(1));
log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, doesnt exist");
log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, offline"); | Define a constant instead of duplicating this literal " from " 3 times. |
osw.append(ExportTable.DATA_VERSION_PROP + ":" + ServerConstants.DATA_VERSION + "\n"); | Make the "audit" logger private static final and rename it to comply with the format "LOG(?:GER)?". |
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
public BatchWriterImpl(Instance instance, InstanceTokenWrapper credentials, String table, BatchWriterConfig config) { | Immediately return this expression instead of assigning it to the temporary variable "ret". |
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken; | 1 duplicated blocks of code must be removed. |
protected Class<? extends AuthenticationToken> tokenClass;
try {
tokenClass = Class.forName(props.getProperty("org.apache.accumulo.proxy.ProxyServer.tokenClass")).asSubclass(AuthenticationToken.class);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
AuthenticationToken token;
try {
token = tokenClass.newInstance();
} catch (InstantiationException e) {
throw new AccumuloException(e);
} catch (IllegalAccessException e) {
throw new AccumuloException(e);
}
token.init(props);
return token; | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import static org.apache.accumulo.core.data.Mutation.SERIALIZED_FORMAT.VERSION2;
@Override
protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
return new ServerColumnUpdate(cf, cq, cv, hasts, ts, deleted, val, this); | Constructor has 8 parameters, which is greater than 7 authorized. |
private final Instance instance;
public ClientServiceHandler(Instance instance, TransactionWatcher transactionWatcher) {
this.instance = instance;
return instance.getZooKeepers();
return conf(new ServerConfiguration(instance).getConfiguration());
return conf(new ServerConfiguration(instance).getTableConfiguration(tableId));
return BulkImporter.bulkLoad(new ServerConfiguration(instance).getConfiguration(), instance, credentials, tid, tableId, files, errorDir, | 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.
*/
super(iterator);
if (r.contains(k)) return true;
public Iterator<Entry<Key,Value>> iterator() {
SortedKeyValueIterator<Key,Value> i = new SortedMapIterator(table.table);
return new IteratorAdapter(i);
public void close() {}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
conn.securityOperations().createUser(userName, (userName + "pass").getBytes()); | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
public static String createTabletDirectory(VolumeManager fs, String tableId, Text endRow) {
String volume = fs.choose(ServerConstants.getTablesDirs());
Path lowDirectoryPath = new Path(volume + "/" + tableId + "/" + lowDirectory);
return lowDirectoryPath.makeQualified(fs.getFileSystemByPath(lowDirectoryPath)).toString();
Path lowDirectoryPath = new Path(volume + "/" + tableId + "/" + lowDirectory);
return lowDirectoryPath.makeQualified(fs.getFileSystemByPath(lowDirectoryPath)).toString();
log.warn("Failed to create dir for tablet in table " + tableId + " in volume " + volume + " + will retry ...");
VolumeManager fs = VolumeManagerImpl.get(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
// TODO maybe remove from bad servers
log.error("unable to get tablet server status " + server + " " + ex.getMessage());
log.debug("unable to get tablet server status " + server, ex); | Remove this unused method parameter "lock". |
package org.apache.accumulo.server.tabletserver.log;
import java.util.Set;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.server.conf.ServerConfiguration;
public abstract class LoggerStrategy {
// Called by the tablet server to get the list of loggers to use from the available set
public abstract Set<String> getLoggers(Set<String> allLoggers);
// Called by the master (via the tablet server) to prefer loggers for balancing
public abstract void preferLoggers(Set<String> preference);
public int getNumberOfLoggersToUse() {
return ServerConfiguration.getSystemConfiguration().getCount(Property.TSERV_LOGGER_COUNT);
}
} | Return empty string instead. |
* This class remains here for backwards compatibility.
* @deprecated since 1.4
* @see org.apache.accumulo.core.iterators.user.LargeRowFilter
public class LargeRowFilter extends org.apache.accumulo.core.iterators.user.LargeRowFilter { | Remove this unused private "match" 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.
*/ | 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.security.Credentials;
public ServicerForMetadataTable(Instance instance, Credentials credentials) { | Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable". |
import java.nio.charset.Charset;
private static final Charset utf8 = Charset.forName("UTF8");
new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY).addWork(file, source.getBytes(utf8)); | Move this variable to comply with Java Code Conventions. |
if (topKey != null)
return;
if (sourceIter.hasTop() == false)
return;
if (sourceIter != null)
return new WholeRowIterator(sourceIter.deepCopy(env));
if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
return; | Remove this call to "exit" or ensure it is really required. |
if (tablePropCache == null)
synchronized (TableConfiguration.class) {
if (tablePropCache == null)
tablePropCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), new TableConfWatcher(inst.getInstanceID()));
}
if (value != null)
log.error("Using default value for " + key + " due to improperly formatted " + property.getType() + ": " + value);
if (v != null)
value = new String(v);
if (tablePropCache != null)
tablePropCache.clear();
if (child != null && value != null)
entries.put(child, value); | 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.
*/
@Override
public void visit(State state, Properties props) throws Exception {} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Instance instance = new ZooKeeperInstance(cluster.getConfig().getInstanceName(), cluster.getConfig().getZooKeepers()); | Either log or rethrow this exception. |
return new Credentials(getSysUserName(), getSysToken()).toThrift(this.state.getInstance());
return new Credentials(getTabUserName(), getTabToken()).toThrift(this.state.getInstance()); | Remove this hard-coded password. |
/*
* 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("'", "'");
bannerBackground = ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_BACKGROUND).replace("'", "'");
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(" ", " ")).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");
} | Remove the literal "true" boolean value. |
@Test(timeout = 2 * 60 * 1000) | Either log or rethrow this exception. |
@Override | Make the "log" logger private static final and rename it 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
private static final int CORE_POOL_SIZE = 8;
private static final int MAX_POOL_SIZE = CORE_POOL_SIZE;
static String tableName = null;
@Override
public void visit(State state, Properties props) throws Exception {
Random rand = new Random();
tableName = Integer.toHexString(Math.abs(rand.nextInt()));
log.info("Starting bulk test on " + tableName);
List<PerColumnIteratorConfig> aggregators = Collections.singletonList(new PerColumnIteratorConfig(new Text("cf".getBytes()), null,
org.apache.accumulo.core.iterators.aggregation.StringSummation.class.getName()));
try {
if (!state.getConnector().tableOperations().exists(getTableName())) {
state.getConnector().tableOperations().create(getTableName());
state.getConnector().tableOperations().addAggregators(getTableName(), aggregators);
}
} catch (TableExistsException ex) {
// expected if there are multiple walkers
state.set("rand", rand);
state.set("fs", FileSystem.get(CachedConfiguration.getInstance()));
BlockingQueue<Runnable> q = new LinkedBlockingQueue<Runnable>();
ThreadFactory factory = new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Daemon(new LoggingRunnable(log, r));
}
};
ThreadPoolExecutor e = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, 1, TimeUnit.SECONDS, q, factory);
state.set("pool", e);
}
public static String getTableName() {
return tableName;
}
public static ThreadPoolExecutor getThreadPool(State state) {
return (ThreadPoolExecutor) state.get("pool");
}
public static void run(State state, Runnable r) {
getThreadPool(state).submit(r);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public final static String PARTITIONED_INPUT_MIN_SPLIT_SIZE = "wikipedia.min.input.split.size";
public static long getMinInputSplitSize(Configuration conf) {
return conf.getLong(PARTITIONED_INPUT_MIN_SPLIT_SIZE, 1l << 27);
}
| Complete the task associated to this TODO comment. |
// Set the formatter property on the table | Either log or rethrow this exception. |
if (parts.length > 1)
addr = new InetSocketAddress(parts[0], Integer.parseInt(parts[1]));
else
addr = new InetSocketAddress(parts[0], 2181);
if (line.startsWith(" "))
clients++;
if (line.startsWith("Mode"))
mode = line.split(":")[1]; | Remove this call to "exit" or ensure it is really required. |
AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), args[0], args[1]);
AccumuloInputFormat.setInputInfo(job.getConfiguration(), args[2], args[3].getBytes(), args[4], new Authorizations());
AccumuloInputFormat.addIterator(job.getConfiguration(), regex); | Remove this unused private "debugQuery" method. |
@Test(timeout = 2 * 60 *1000) | Either log or rethrow this exception. |
log.trace("Using existing connection to " + ttk.getLocation() + ":" + ttk.getPort() + " timeout " + ttk.getTimeout()); | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.core.security.Credentials;
private Credentials credentials;
serverQueue = serverQueues.get(location);
} catch (Exception e) {} finally {
locator.binMutations(credentials, mutations, binnedMutations, failures);
if (!serverQueue.taskQueued) {
private void reschedule(SendTask task) {
if (serverQueue.queue.size() > 0)
ConditionalWriterImpl(Instance instance, Credentials credentials, String tableId, ConditionalWriterConfig config) {
List<QCMutation> mutations = new ArrayList<QCMutation>();
failedMutations.drainTo(mutations);
queue(mutations);
@Override
private HashMap<String,SessionID> cachedSessionIDs = new HashMap<String,SessionID>();
// avoid cost of repeatedly making RPC to create sessions, reuse sessions
TConditionalSession tcs = client.startConditionalUpdate(tinfo, credentials.toThrift(instance), ByteBufferUtil.toByteBuffers(auths.getAuthorizations()),
tableId);
private void unreserveSessionID(String location) {
ignored.add(cmk.cm);
if (sessionId == null) {
} else {
} catch (Exception e2) {
@Override | Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable". |
/*
* 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. |
@Deprecated | Remove this unused method parameter "ex". |
package org.apache.accumulo.fate.zookeeper; | Remove this call to "exit" or ensure it is really required. |
void visit(int level, RemoteSpan parent, RemoteSpan node, Collection<RemoteSpan> children); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.math.BigInteger;
eid = new BigInteger(sa[1], 16).longValue(); | Return empty string instead. |
if (super.getTopKey().isDeleted()) | At most one statement is allowed per line, but 2 statements were found on this line. |
/*
* 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. |
Long next = iter.next();
sum = safeAdd(sum, next); | Remove this call to "exit" or ensure it is really required. |
super(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes()); | Remove this unused method parameter "ex". |
while ((totalMemUsed > maxMem || flushing) && !somethingFailed) { | Return empty string instead. |
import java.util.TreeMap; | Replace all tab characters in this file by sequences of white-spaces. |
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
if (args.length < 5 || args.length > 7) {
System.out
.println("bin/accumulo accumulo.examples.helloworld.ReadData <instance name> <zoo keepers> <tablename> <username> <password> [startkey [endkey]]");
System.exit(1);
String instanceName = args[0];
String zooKeepers = args[1];
String tableName = args[2];
String user = args[3];
byte[] pass = args[4].getBytes();
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
Connector connector = instance.getConnector(user, pass);
Scanner scan = connector.createScanner(tableName, Constants.NO_AUTHS);
Key start = null;
if (args.length > 5) start = new Key(new Text(args[5]));
Key end = null;
if (args.length > 6) end = new Key(new Text(args[6]));
scan.setRange(new Range(start, end));
Iterator<Entry<Key,Value>> iter = scan.iterator();
while (iter.hasNext()) {
Entry<Key,Value> e = iter.next();
Text colf = e.getKey().getColumnFamily();
Text colq = e.getKey().getColumnQualifier();
System.out.print("row: " + e.getKey().getRow() + ", colf: " + colf + ", colq: " + colq);
System.out.println(", value: " + e.getValue().toString());
}
} | 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.commons.cli.OptionGroup;
OptionGroup nameGroup = new OptionGroup();
allOpt = new Option("a", "all", false, "delete all scan iterators");
nameGroup.addOption(nameOpt);
nameGroup.addOption(allOpt);
nameGroup.setRequired(true);
o.addOptionGroup(nameGroup); | 2 duplicated blocks of code must be removed. |
} else {
shellState.checkTableState();
tablesToFlush.add(shellState.getTableName()); | Define and throw a dedicated exception instead of using a generic one. |
shellState.getReader().flush();
shellState.getReader().println(String.format(fmt, args)); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
private static String principal;
private static AuthenticationToken token;
Connector connector = HdfsZooInstance.getInstance().getConnector(principal, token); | Immediately return this expression instead of assigning it to the temporary variable "connector". |
* 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.
*/
class TableConfWatcher implements Watcher {
TableConfWatcher(String instanceId) {
public void process(WatchedEvent event) {
if (path.startsWith(tablesPrefix + tableId + Constants.ZTABLE_CONF + "/")) key = path.substring((tablesPrefix + tableId
+ Constants.ZTABLE_CONF + "/").length());
switch (event.getType()) {
if (log.isTraceEnabled()) log.trace("EventNodeDataChanged " + event.getPath());
if (key != null) ServerConfiguration.getTableConfiguration(instanceId, tableId).propertyChanged(key);
switch (event.getState()) {
switch (event.getState()) { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.core.util;
import org.apache.accumulo.core.data.ByteSequence;
public class ByteArrayBackedCharSequence implements CharSequence {
private byte[] data;
private int offset;
private int len;
public ByteArrayBackedCharSequence(byte[] data, int offset, int len){
this.data = data;
this.offset = offset;
this.len = len;
}
public ByteArrayBackedCharSequence(byte[] data){
this(data, 0, data.length);
}
public ByteArrayBackedCharSequence(){
this(null, 0, 0);
}
public void set(byte[] data, int offset, int len){
this.data = data;
this.offset = offset;
this.len = len;
}
@Override
public char charAt(int index) {
return (char) (0xff & data[offset + index]);
}
@Override
public int length() {
return len;
}
@Override
public CharSequence subSequence(int start, int end) {
return new ByteArrayBackedCharSequence(data, offset + start, end - start);
}
public String toString(){
return new String(data, offset, len);
}
public void set(ByteSequence bs) {
set(bs.getBackingArray(), bs.offset(), bs.length());
}
} | Return empty string instead. |
import org.apache.accumulo.core.client.security.SecurityErrorCode;
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 org.apache.accumulo.core.util.RootTable;
if (pr.getTableName().equals(MetadataTable.ID) || pr.getTableName().equals(RootTable.ID)) { | Reduce this switch case number of lines from 12 to at most 5, for example by extracting code into methods. |
/**
* This iterator facilitates document-partitioned indexing. It is an example of extending the IntersectingIterator to customize the placement of the term and
* docID. It expects a table structure of the following form:
*
* row: shardID, colfam: docColf\0type, colqual: docID, value: doc
*
* row: shardID, colfam: indexColf, colqual: term\0type\0docID\0info, value: (empty)
*
* When you configure this iterator with a set of terms, it will return only the docIDs and docs that appear with all of the specified terms. The result will
* have the following form:
*
* row: shardID, colfam: indexColf, colqual: type\0docID\0info, value: doc
*
* This iterator is commonly used with BatchScanner or AccumuloInputFormat, to parallelize the search over all shardIDs.
*/ | Refactor this code to not nest more than 3 if/for/while/switch/try statements. |
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import com.beust.jcommander.Parameter;
static class Opts extends ClientOnRequiredTable {
@Parameter(names="--output", description="output directory", required=true)
String output;
@Parameter(names="--columns", description="columns to extract, in cf:cq{,cf:cq,...} form")
String columns;
}
Opts opts = new Opts();
opts.parseArgs(getClass().getName(), args);
opts.setAccumuloConfigs(job);
for (String col : opts.columns.split(",")) {
TextOutputFormat.setOutputPath(job, new Path(opts.output)); | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.core.util.ServerServices.Service;
static volatile boolean warnedAboutTServersBeingDown = false;
if (!opened) {
if (!warnedAboutTServersBeingDown) {
if (servers.isEmpty()) {
log.warn("There are no tablet servers: check that zookeeper and tablet servers are running.");
} else {
log.warn("Failed to find an available server in the list of servers: " + servers);
}
warnedAboutTServersBeingDown = true;
}
} | Move this variable to comply with Java Code Conventions. |
private TabletServerStatus status;
private TServerInstance instance;
public TServerUsesLoggers(TServerInstance instance, TabletServerStatus status) {
this.instance = instance;
this.status = status;
}
@Override
public Set<String> getLoggers() {
return Collections.unmodifiableSet(status.loggers);
}
@Override
public int compareTo(LoggerUser o) {
if (o instanceof TServerUsesLoggers) return instance.compareTo(((TServerUsesLoggers) o).instance);
return -1;
}
@Override
public int hashCode() {
return instance.hashCode();
}
public TServerInstance getInstance() {
return instance;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.List;
map.put(new Key(new Text("r1"), new Text("cf1"), new Text("cq1"), new Text("cv1"), 1l), new Value("val1".getBytes()));
map.put(new Key(new Text("r1"), new Text("cf1"), new Text("cq2"), new Text("cv1"), 2l), new Value("val2".getBytes()));
map.put(new Key(new Text("r2"), new Text("cf1"), new Text("cq1"), new Text("cv1"), 3l), new Value("val3".getBytes()));
map.put(new Key(new Text("r2"), new Text("cf2"), new Text("cq1"), new Text("cv1"), 4l), new Value("val4".getBytes()));
map.put(new Key(new Text("r3"), new Text("cf1"), new Text("cq1"), new Text("cv1"), 5l), new Value("val4".getBytes()));
map.put(new Key(new Text("r3"), new Text("cf1"), new Text("cq1"), new Text("cv2"), 6l), new Value("val4".getBytes()));
map.put(new Key(new Text("r4"), new Text("cf1"), new Text("cq1"), new Text("cv1"), 7l), new Value("".getBytes()));
map.put(new Key(new Text("r4"), new Text("cf1"), new Text("cq1"), new Text(""), 8l), new Value("val1".getBytes()));
map.put(new Key(new Text("r4"), new Text("cf1"), new Text(""), new Text("cv1"), 9l), new Value("val1".getBytes()));
map.put(new Key(new Text("r4"), new Text(""), new Text("cq1"), new Text("cv1"), 10l), new Value("val1".getBytes()));
map.put(new Key(new Text(""), new Text("cf1"), new Text("cq1"), new Text("cv1"), 11l), new Value("val1".getBytes())); | 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.security.tokens.PasswordToken; | 1 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.security.thrift.Credential;
public void initializeSecurity(Credential itw, String rootuser) throws AccumuloSecurityException { | 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.core.cli.ClientOnRequiredTable;
import com.beust.jcommander.Parameter;
static class Opts extends ClientOnRequiredTable {
@Parameter(names="--num", required=true)
int num = 0;
@Parameter(names="--min")
long min = 0;
@Parameter(names="--max")
long max = Long.MAX_VALUE;
@Parameter(names="--size", required=true, description="size of the value to write")
int size = 0;
@Parameter(names="--vis", converter=VisibilityConverter.class)
ColumnVisibility visiblity = new ColumnVisibility("");
@Parameter(names="--seed", description="seed for pseudo-random number generator")
Long seed = null;
}
Opts opts = new Opts();
opts.parseArgs(RandomBatchWriter.class.getName(), args);
if (opts.seed == null)
r = new Random(opts.seed);
Connector connector = opts.getConnector();
BatchWriter bw = connector.createBatchWriter(opts.tableName, opts.getBatchWriterConfig());
ColumnVisibility cv = opts.visiblity;
for (int i = 0; i < opts.num; i++) {
long rowid = (Math.abs(r.nextLong()) % (opts.max - opts.min)) + opts.min;
Mutation m = createMutation(rowid, opts.size, cv); | 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.
*/
@SuppressWarnings("all") public enum IteratorScope implements org.apache.thrift.TEnum { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
if (!shellState.getConnector().tableOperations().exists(tableName))
throw new TableNotFoundException(null, tableName, null);
if (text == null)
return null; | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.server.iterators.MetadataBulkLoadFilter;
initialMetadataConf.put(Property.TABLE_ITERATOR_PREFIX.getKey() + "majc.bulkLoadFilter", "20," + MetadataBulkLoadFilter.class.getName()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.cli.BatchWriterOpts;
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(InsertWithBatchWriter.class.getName(), args, bwOpts);
MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(bwOpts.getBatchWriterConfig()); | Remove this unused method parameter "opts". |
public void setUser(String s) {
this.user = s;
}
| Remove this unused method parameter "ex". |
* jdwpEnabled=true
if (opts.prop.containsKey("jdwpEnabled"))
config.setJDWPEnabled(Boolean.parseBoolean(opts.prop.getProperty("jdwpEnabled"))); | Define a constant instead of duplicating this literal "superSecret" 3 times. |
import org.apache.accumulo.core.client.mapreduce.lib.util.OutputConfigurator; | 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.
*/
public long isReady(long tid, Master environment) throws Exception {
return 0;
}
// TODO move this to isReady() and drop while loop?
Map<String,String> loggers = m.getLoggers();
for (Entry<String,String> entry : loggers.entrySet()) {
public void undo(long tid, Master m) throws Exception {}
| 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.core.security.tokens.PasswordToken;
import org.apache.accumulo.core.security.tokens.SecurityToken; | 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.
*/
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { | 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.
*/
private boolean sortable = true;
abstract public String alignment();
abstract public String format(Object obj);
public final void setSortable(boolean sortable) {
this.sortable = sortable;
}
public final boolean isSortable() {
return sortable;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.instamo;
/**
* 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.
*/
import org.apache.accumulo.test.MacConfig;
import org.apache.accumulo.test.MiniAccumuloCluster;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
* An example unit test that shows how to use MiniAccumuloCluster in a unit test
*/
public class ExampleAccumuloUnitTest {
public static TemporaryFolder folder = new TemporaryFolder();
private static MiniAccumuloCluster accumulo;
@BeforeClass
public static void setupMiniCluster() throws Exception {
folder.create();
accumulo = new MiniAccumuloCluster(new MacConfig(folder.getRoot(), "superSecret"));
accumulo.start();
}
@Test(timeout = 30000)
public void test() throws Exception {
AccumuloApp.run(accumulo.getInstanceName(), accumulo.getZookeepers(), "superSecret", new String[0]);
}
@AfterClass
public static void tearDownMiniCluster() throws Exception {
accumulo.stop();
folder.delete();
}
} | Remove this unused private "appendProp" method. |
package org.apache.accumulo.examples.simple.filedata; | 2 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public Writer(Instance instance, Credential credentials, Text table) {
public Writer(Instance instance, Credential credentials, String table) {
private static void updateServer(Mutation m, KeyExtent extent, String server, Credential ai, AccumuloConfiguration configuration) throws TException, | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.List;
List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(shellState.getTableName());
if (tableScanIterators == null) {
Shell.log.debug("Found no scan iterators to set");
}
Shell.log.debug("Found " + tableScanIterators.size() + " scan iterators to set");
for (IteratorSetting setting : tableScanIterators) {
Shell.log.debug("Setting scan iterator " + setting.getName() + " at priority " + setting.getPriority() + " using class name "
+ setting.getIteratorClass());
for (Entry<String,String> option : setting.getProperties().entrySet()) {
Shell.log.debug("Setting option for " + setting.getName() + ": " + option.getKey() + "=" + option.getValue());
scanner.addScanIterator(setting);
} | Remove the literal "true" boolean value. |
/*
* 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.client.IteratorSetting;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.iterators.LongCombiner;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
TableOperations tableOps = state.getConnector().tableOperations();
if (!tableOps.exists(getTableName())) {
tableOps.create(getTableName());
IteratorSetting is = new IteratorSetting(10, org.apache.accumulo.core.iterators.user.SummingCombiner.class);
SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING);
SummingCombiner.setColumns(is, BulkPlusOne.COLNAMES);
tableOps.attachIterator(getTableName(), is); | This block of commented-out lines of code should be removed. |
@SuppressWarnings("all") public enum ScanState implements org.apache.thrift.TEnum { | 300 duplicated blocks of code must be removed. |
package org.apache.accumulo.server.test;
import java.io.IOException;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.map.MyMapFile;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.log4j.Logger;
public class DumpMapFile {
private static final Logger log = Logger.getLogger(DumpMapFile.class);
public static void main(String[] args) {
try {
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = FileSystem.get(conf);
MyMapFile.Reader mr = new MyMapFile.Reader(fs, args[0], conf);
Key key = new Key();
Value value = new Value();
long start = System.currentTimeMillis();
while(mr.next(key, value)) {
log.info(key + " -> " + value);
}
long stop = System.currentTimeMillis();
log.info(stop - start);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | Return empty string instead. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.