Diff
stringlengths 10
2k
| Message
stringlengths 28
159
|
---|---|
* @return The number of the partition for a given article.
|
Either log or rethrow this exception.
|
import org.apache.accumulo.core.security.tokens.PasswordToken;
|
1 duplicated blocks of code must be removed.
|
public final class Compression {
public static enum Algorithm {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* @param fs
* @param dir
|
1 duplicated blocks of code must be removed.
|
import org.apache.accumulo.core.conf.AccumuloConfiguration;
public static ServerPort startServer(AccumuloConfiguration conf, Property portHintProperty, TProcessor processor, String serverName, String threadName,
Property portSearchProperty,
int portHint = conf.getPort(portHintProperty);
minThreads = conf.getCount(minThreadProperty);
timeBetweenThreadChecks = conf.getTimeInMillis(timeBetweenThreadChecksProperty);
portSearch = conf.getBoolean(portSearchProperty);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
iters.add(smi);
ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter);
ColumnQualifierFilter colFilter = new ColumnQualifierFilter(cfsi, columnSet);
|
Use "Integer.toString" instead.
|
@Test(timeout=30*1000)
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
MetadataTableUtil.deleteTable(tableInfo.tableId, false, SystemCredentials.get(), environment.getMasterLock());
security.grantTablePermission(SystemCredentials.get().toThrift(env.getInstance()), tableInfo.user, tableInfo.tableId, permission);
AuditedSecurityOperation.getInstance().deleteTable(SystemCredentials.get().toThrift(env.getInstance()), tableInfo.tableId);
|
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
|
if (TabletServerBatchReaderIterator.this.queryThreadPool.isShutdown())
log.debug("Failed to add Batch Scan result for key " + key, e);
else
log.warn("Failed to add Batch Scan result for key " + key, e);
if (nextEntry != null)
return true;
if (fatalException != null)
if (fatalException instanceof RuntimeException)
throw (RuntimeException) fatalException;
else
throw new RuntimeException(fatalException);
if (failures.size() >= lastFailureSize)
if (!Tables.exists(instance, table))
throw new TableDeletedException(table);
else if (Tables.getTableState(instance, table) == TableState.OFFLINE)
throw new TableOfflineException(instance, table);
if (log.isTraceEnabled())
log.trace("Failed to bin " + failures.size() + " ranges, tablet locations were null, retrying in 100ms");
if (log.isTraceEnabled())
log.trace("Failed to execute multiscans against " + failures.size() + " tablets, retrying...");
if (!Tables.exists(instance, table))
fatalException = new TableDeletedException(table);
else
fatalException = e;
if (queryThreadPool.isShutdown())
log.debug(t.getMessage(), t);
else
log.warn(t.getMessage(), t);
if (waitForWrites)
ThriftScanner.serversWaitedForWrites.get(ttype).add(server);
|
Remove this call to "exit" or ensure it is really required.
|
@Override
public void unableToMonitorLockNode(Throwable e) {
System.exit(-1);
}
|
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.
*/
private Option verboseOption;
@Override
public String description() {
return "displays information about this program";
}
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws IOException {
shellState.printInfo();
if (cl.hasOption(verboseOption.getOpt())) shellState.printVerboseInfo();
return 0;
}
@Override
public int numArgs() {
return 0;
}
@Override
public Options getOptions() {
Options opts = new Options();
verboseOption = new Option("v", "verbose", false, "displays details session information");
opts.addOption(verboseOption);
return opts;
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
iters.add(smi);
ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter);
ColumnQualifierFilter colFilter = new ColumnQualifierFilter(cfsi, columnSet);
|
Use "Integer.toString" instead.
|
* @since 1.5.0
* @since 1.5.0
* @since 1.5.0
|
Move this constructor to comply with Java Code Conventions.
|
package org.apache.accumulo.core.client;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.accumulo.core.data.ConstraintViolationSummary;
import org.apache.accumulo.core.data.KeyExtent;
/**
* Communicate the failed mutations of a BatchWriter back to the client.
*
*/
public class MutationsRejectedException extends AccumuloException {
private static final long serialVersionUID = 1L;
private List<ConstraintViolationSummary> cvsl;
private ArrayList<KeyExtent> af;
private Collection<String> es;
private int unknownErrors;
/**
* @param cvsList list of constraint violations
* @param af authorization failures
* @param serverSideErrors server side errors
* @param unknownErrors number of unknown errors
*/
public MutationsRejectedException(List<ConstraintViolationSummary> cvsList, ArrayList<KeyExtent> af, Collection<String> serverSideErrors, int unknownErrors, Throwable cause) {
super("# constraint violations : "+cvsList.size()+" # authorization failures : "+af.size()+" # server errors "+serverSideErrors.size()+" # exceptions "+unknownErrors, cause);
this.cvsl = cvsList;
this.af = af;
this.es = serverSideErrors;
this.unknownErrors = unknownErrors;
}
/**
* @return the internal list of constraint violations
*/
public List<ConstraintViolationSummary> getConstraintViolationSummaries(){
return cvsl;
}
/**
* @return the internal list of authorization failures
*/
public List<KeyExtent> getAuthorizationFailures(){
return af;
}
/**
*
* @return A list of servers that had internal errors when mutations were written
*
*/
public Collection<String> getErrorServers(){
return es;
}
/**
*
* @return a count of unknown exceptions that occurred during processing
*/
public int getUnknownExceptions(){
return unknownErrors;
}
}
|
Return empty string instead.
|
import org.apache.accumulo.core.client.BatchWriterConfig;
BatchWriter bw = connector.createBatchWriter(table_name, new BatchWriterConfig());
|
Remove this unused method parameter "e".
|
t.removeIterator("table", "someName", EnumSet.of(IteratorScope.scan));
Map<String,EnumSet<IteratorScope>> two = t.listIterators("table");
Assert.assertTrue(two.containsKey("otherName"));
Assert.assertTrue(two.get("otherName").size() == 2);
Assert.assertTrue(two.get("otherName").contains(IteratorScope.majc));
Assert.assertTrue(two.get("otherName").contains(IteratorScope.scan));
Assert.assertTrue(two.containsKey("someName"));
Assert.assertTrue(two.get("someName").size() == 1);
Assert.assertTrue(two.get("someName").contains(IteratorScope.majc));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* A map only job that reads a table created by continuous ingest and creates doubly linked list. This map reduce job tests the ability of a map only job to
* read and write to accumulo at the same time. This map reduce job mutates the table in such a way that it should not create any undefined nodes.
@Override
@Override
.toArray(), random, true);
@Parameter(names = "--maxColF", description = "maximum column family value to use")
@Parameter(names = "--maxColQ", description = "maximum column qualifier value to use")
@Parameter(names = "--maxMappers", description = "the maximum number of mappers to use", required = true, validateWith = PositiveInteger.class)
AccumuloInputFormat.setRanges(job, ranges);
AccumuloInputFormat.setAutoAdjustRanges(job, false);
AccumuloOutputFormat.setBatchWriterOptions(job, bwOpts.getBatchWriterConfig());
|
Return empty string instead.
|
NoSuchMethodException e = null;
// sync: send data to datanodes
sync = logFile.getClass().getMethod("sync");
} catch (NoSuchMethodException ex) {
e = ex;
}
try {
// hsync: send data to datanodes and sync the data to disk
e = null;
if (e != null)
throw new RuntimeException(e);
sync.invoke(logFile);
} catch (Exception ex) {
throw new IOException(ex);
sync.invoke(logFile);
} catch (Exception ex) {
throw new IOException(ex);
|
Extract this nested try block into a separate 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 interface VisibilityInterpreter extends Serializable {
public abstract String getAbbreviatedValue();
public abstract String getFullValue();
public abstract VisibilityInterpreter create();
public abstract VisibilityInterpreter create(ColumnVisibility visibility, Authorizations authorizations);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
opts.parseArgs(Merge.class.getName(), args);
|
Use "Integer.toString" instead.
|
ROW(1), ROW_COLFAM(2), ROW_COLFAM_COLQUAL(3), ROW_COLFAM_COLQUAL_COLVIS(4), ROW_COLFAM_COLQUAL_COLVIS_TIME(5),
//everything with delete flag
ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL(6)
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
|
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.
|
@Test(timeout = 10000)
public void testChangeData() throws Exception {
String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, null);
zk.addAuthInfo("digest", "secret".getBytes());
zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
TestALW lw = new TestALW();
zl.lockAsync(lw, "test1".getBytes());
Assert.assertEquals("test1", new String(zk.getData(zl.getLockPath(), null, null)));
zl.replaceLockData("test2".getBytes());
Assert.assertEquals("test2", new String(zk.getData(zl.getLockPath(), null, null)));
}
|
Either log or rethrow this exception.
|
import org.apache.accumulo.server.util.FastFormat;
try {
} catch (IOException ioe) {
log.warn("Failed to close " + path, ioe);
|
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
|
/*
* 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.
|
static final AtomicLong counter = new AtomicLong();
private static final Value ONE = new Value("1".getBytes());
String markerColumnQualifier = String.format("%07d", counter.incrementAndGet());
log.debug("preparing bulk files with start rows " + printRows + " last row " + String.format(FMT, LOTS - 1) + " marker " + markerColumnQualifier);
f.append(new Key(row, MARKER_CF, new Text(markerColumnQualifier)), ONE);
log.debug("Finished bulk import, start rows " + printRows + " last row " + String.format(FMT, LOTS - 1) + " marker " + markerColumnQualifier);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), "superSecret").setJWDPEnabled(true);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.cloudtrace.instrument.Trace;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.hadoop.net.NetUtils;
InputStream input = new BufferedInputStream(NetUtils.getInputStream(socket, timeoutMillis), 1024 * 10);
OutputStream output = new BufferedOutputStream(NetUtils.getOutputStream(socket, timeoutMillis), 1024 * 10);
|
This block of commented-out lines of code should be removed.
|
import org.apache.accumulo.server.security.SecurityOperationImpl;
security = SecurityOperationImpl.getInstance();
|
Either log or rethrow this exception.
|
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.junit.Assert;
put(tm1, "2;m", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1");
put(tm1, "2;m", DataFileColumnFamily.NAME, "/t1/file1", "1,1");
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file1", "5");
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file3", "7");
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file4", "9");
put(tm1, "2<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t2");
put(tm1, "2<", DataFileColumnFamily.NAME, "/t2/file2", "1,1");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file6", "5");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file7", "7");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file8", "9");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileC", null);
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file5", "8");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file9", "8");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileA", "2");
public void registerSideChannel(SortedKeyValueIterator<Key,Value> iter) {}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
*
*
*
*
*
|
Replace all tab characters in this file by sequences of white-spaces.
|
import org.apache.accumulo.examples.wikisearch.ingest.WikipediaMapper;
import org.apache.log4j.Logger;
private static final Logger log = Logger.getLogger(SortingRFileOutputFormat.class);
|
Remove this unused "log" private field.
|
if (entry.getKey().compareRow(rowName) == 0 && MetadataTable.TIME_COLUMN.hasColumns(entry.getKey())) {
ScannerImpl mdScanner = new ScannerImpl(HdfsZooInstance.getInstance(), SecurityConstants.getSystemCredentials(), MetadataTable.ID, Authorizations.EMPTY);
mdScanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
if (key.getColumnFamily().equals(MetadataTable.LOG_COLUMN_FAMILY)) {
if (key.getRow().equals(row) && key.getColumnFamily().equals(MetadataTable.SCANFILE_COLUMN_FAMILY)) {
if (key.getRow().equals(row) && MetadataTable.FLUSH_COLUMN.equals(key.getColumnFamily(), key.getColumnQualifier()))
if (key.getRow().equals(row) && MetadataTable.COMPACT_COLUMN.equals(key.getColumnFamily(), key.getColumnQualifier()))
if (entry.getKey().getColumnFamily().compareTo(MetadataTable.LAST_LOCATION_COLUMN_FAMILY) == 0) {
String msg = "Closed tablet " + extent + " has walog entries in " + MetadataTable.NAME + " " + fileLog.getFirst();
String msg = "Data file in " + MetadataTable.NAME + " differ from in memory data " + extent + " " + fileLog.getSecond().keySet() + " "
String msg = "Data file in " + MetadataTable.NAME + " differ from in memory data " + extent + " " + fileLog.getSecond() + " "
|
Use "Long.toString" instead.
|
public ZooQueueLock(String zookeepers, int timeInMillis, String scheme, byte[] auth, String path, boolean ephemeral) throws KeeperException,
InterruptedException {
this(ZooReaderWriter.getRetryingInstance(zookeepers, timeInMillis, scheme, auth), path, ephemeral);
|
Move this constructor to comply with Java Code Conventions.
|
*
*
*
*
*
*
*
*
*
*
*
*
*
*
|
Replace all tab characters in this file by sequences of white-spaces.
|
package org.apache.accumulo.server.master.state;
import java.util.Iterator;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Range;
import org.apache.hadoop.io.Text;
public class RootTabletStateStore extends MetaDataStateStore {
public RootTabletStateStore(CurrentState state) {
super(state);
}
@Override
public Iterator<TabletLocationState> iterator() {
Range range = new Range(Constants.ROOT_TABLET_EXTENT.getMetadataEntry(), false,
KeyExtent.getMetadataEntry(new Text(Constants.METADATA_TABLE_ID), null), true);
return new MetaDataTableScanner(range, state);
}
@Override
public String name() {
return "Non-Root Metadata Tablets";
}
}
|
Return empty string instead.
|
import java.util.Map.Entry;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
import org.apache.hadoop.io.Text;
import org.junit.rules.TemporaryFolder;
TemporaryFolder root = new TemporaryFolder();
root.create();
final String workdir = "file://" + root.getRoot().getAbsolutePath() + "/workdir";
VolumeManager fs = VolumeManagerImpl.getLocal();
fs.deleteRecursively(new Path(workdir));
ArrayList<Path> dirs = new ArrayList<Path>();
FileSystem ns = fs.getFileSystemByPath(new Path(path));
Writer map = new MapFile.Writer(ns.getConf(), ns, path + "/log1", LogFileKey.class, LogFileValue.class);
ns.create(new Path(path, "finished")).close();
dirs.add(new Path(path));
SortedLogRecovery recovery = new SortedLogRecovery(fs);
root.delete();
|
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.
*/
public static void checkSeps(String... s) {
Text t = KeyUtil.buildNullSepText(s);
String[] rets = KeyUtil.splitNullSepText(t);
int length = 0;
for (String str : s)
length += str.length();
assertEquals(t.getLength(), length + s.length - 1);
assertEquals(rets.length, s.length);
for (int i = 0; i < s.length; i++)
assertEquals(s[i], rets[i]);
}
public void testNullSep() {
checkSeps("abc", "d", "", "efgh");
checkSeps("ab", "");
checkSeps("abcde");
checkSeps("");
checkSeps("", "");
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
private static final String metricsFileName = "accumulo-metrics.xml";
String ACUHOME = getEnvironmentConfiguration().getString("ACCUMULO_CONF_DIR");
log.warn("ACCUMULO_CONF_DIR variable not found in environment. Metrics collection will be disabled.");
|
Return empty string instead.
|
import org.apache.accumulo.core.security.Credentials;
import org.apache.accumulo.server.cli.ClientOpts;
import org.apache.accumulo.trace.instrument.Tracer;
@Parameter(names = "--location", required = true)
client.update(Tracer.traceInfo(), new Credentials(opts.principal, opts.getToken()).toThrift(opts.getInstance()), new KeyExtent(new Text("!!"), null,
new Text("row_0003750000")).toThrift(), mutation.toThrift());
|
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.
*/
package org.apache.accumulo.wikisearch.sample;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
@XmlAccessorType(XmlAccessType.FIELD)
public class Field {
@XmlAttribute
private String name = null;
@XmlValue
private String value = null;
public Field() {
super();
}
public Field(String fieldName, String fieldValue) {
super();
this.name = fieldName;
this.value = fieldValue;
}
public String getFieldName() {
return name;
}
public String getFieldValue() {
return value;
}
public void setFieldName(String fieldName) {
this.name = fieldName;
}
public void setFieldValue(String fieldValue) {
this.value = fieldValue;
}
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
public class SimpleMacIT extends AbstractMacIT {
cleanUp(cluster, folder);
@Override
public MiniAccumuloCluster getCluster() {
return cluster;
}
|
Use "Integer.toString" instead.
|
+ "along with accumulo lib and zookeeper directory. Supports full regex on filename alone."), // needs special treatment in accumulo start jar
GENERAL_KERBEROS_KEYTAB("general.kerberos.keytab", "", PropertyType.PATH, "Path to the kerberos keytab to use. Leave blank if not using kerberoized hdfs"),
GENERAL_KERBEROS_PRINCIPAL("general.kerberos.principal", "", PropertyType.STRING, "Name of the kerberos principal to use. _HOST will automatically be "
+ "replaced by the machines hostname in the hostname portion of the principal. Leave blank if not using kerberoized hdfs"),
|
Move this variable to comply with Java Code Conventions.
|
if (lfv.mutations.length == 0)
return "";
|
Remove this call to "exit" or ensure it is really required.
|
@Parameter(names = "--table", description = "table to use")
@Override
AccumuloInputFormat.setInputInfo(job, user, getPassword(), getTableName(), auths);
AccumuloOutputFormat.setOutputInfo(job, user, getPassword(), true, getTableName());
|
Move this variable to comply with Java Code Conventions.
|
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.
|
/*
* 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.UserPassToken;
conn.securityOperations().createUser(new UserPassToken(userName, (userName + "pass")));
|
Immediately return this expression instead of assigning it to the temporary variable "ret".
|
}, false);
|
Remove this unused method parameter "extent".
|
import org.apache.accumulo.core.security.Authorizations;
Scanner scanner = getConnector().createScanner("tt", Authorizations.EMPTY);
BatchScanner bs = getConnector().createBatchScanner("tt", Authorizations.EMPTY, 2);
scanner = getConnector().createScanner("tt", Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
log.debug("mergeInfo overlaps: " + extent + " " + mergeInfo.overlaps(extent));
final TabletStateStore stores[] = {
new ZooTabletStateStore(new ZooStore(zroot)),
new RootTabletStateStore(instance, systemAuths, this),
new MetaDataStateStore(instance, systemAuths, this)
};
|
Either log or rethrow this exception.
|
c.printString("You can change the instance secret in accumulo by using:");
c.printNewline();
c.printString(" bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
c.printNewline();
c.printString("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
|
Either log or rethrow this exception.
|
import java.util.concurrent.Callable;
public List<TKeyExtent> bulkImport(TInfo tinfo, AuthInfo credentials, final long tid, final Map<TKeyExtent,Map<String,MapFileInfo>> files, final boolean setTime)
throws TException {
return transactionWatcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, new Callable<List<TKeyExtent>>() {
public List<TKeyExtent> call() throws Exception {
List<TKeyExtent> failures = new ArrayList<TKeyExtent>();
for (Entry<TKeyExtent,Map<String,MapFileInfo>> entry : files.entrySet()) {
TKeyExtent tke = entry.getKey();
Map<String,MapFileInfo> fileMap = entry.getValue();
Tablet importTablet = onlineTablets.get(new KeyExtent(tke));
if (importTablet == null) {
failures.add(tke);
} else {
try {
importTablet.importMapFiles(tid, fileMap, setTime);
} catch (IOException ioe) {
log.info("files " + fileMap.keySet() + " not imported to " + new KeyExtent(tke) + ": " + ioe.getMessage());
failures.add(tke);
}
}
}
return failures;
}
});
} catch (Exception ex) {
throw new TException(ex);
|
Replace all tab characters in this file by sequences of white-spaces.
|
if (getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
fs.create(new Path(ServerConstants.getDataVersionLocation() + "/" + ServerConstants.DATA_VERSION));
fs.delete(new Path(ServerConstants.getDataVersionLocation() + "/" + ServerConstants.PREV_DATA_VERSION), false);
if (dataVersion != ServerConstants.DATA_VERSION && dataVersion != ServerConstants.PREV_DATA_VERSION) {
|
Make the "audit" 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.
|
public class MiniAccumuloConfig {
* An empty or nonexistant temp directoy that Accumulo and Zookeeper can store data in. Creating the directory is left to the user. Java 7, Guava,
* and Junit provide methods for creating temporary directories.
public MiniAccumuloConfig(File dir, String rootPassword) {
public MiniAccumuloConfig setNumTservers(int numTservers) {
public MiniAccumuloConfig setSiteConfig(Map<String,String> siteConfig) {
|
Move this constructor to comply with Java Code Conventions.
|
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
deleteTest(c, cluster);
public static void deleteTest(Connector c, MiniAccumuloCluster cluster) throws Exception {
|
Define and throw a dedicated exception instead of using a generic one.
|
package org.apache.accumulo.core.util.shell.commands;
import org.apache.accumulo.core.util.format.DefaultFormatter;
import org.apache.accumulo.core.util.format.Formatter;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.accumulo.start.classloader.AccumuloClassLoader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class FormatterCommand extends Command {
private Option resetOption, formatterClassOption, listClassOption;
@Override
public String description() {
return "specifies a formatter to use for displaying database entries";
}
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
if (cl.hasOption(resetOption.getOpt()))
shellState.setFormatterClass(DefaultFormatter.class);
else if (cl.hasOption(formatterClassOption.getOpt()))
shellState.setFormatterClass(AccumuloClassLoader.loadClass(cl.getOptionValue(formatterClassOption.getOpt()), Formatter.class));
else if (cl.hasOption(listClassOption.getOpt()))
shellState.getReader().printString(shellState.getFormatterClass().getName() + "\n");
return 0;
}
@Override
public Options getOptions() {
Options o = new Options();
OptionGroup formatGroup = new OptionGroup();
resetOption = new Option("r", "reset", false, "reset to default formatter");
formatterClassOption = new Option("f", "formatter", true, "fully qualified name of formatter class to use");
formatterClassOption.setArgName("className");
listClassOption = new Option("l", "list", false, "display the current formatter");
formatGroup.addOption(resetOption);
formatGroup.addOption(formatterClassOption);
formatGroup.addOption(listClassOption);
formatGroup.setRequired(true);
o.addOptionGroup(formatGroup);
return o;
}
@Override
public int numArgs() {
return 0;
}
}
|
Return empty string instead.
|
import org.apache.accumulo.server.mini.MiniAccumuloCluster;
|
This block of commented-out lines of code should be removed.
|
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor;
Processor<Iface> processor = new Processor<Iface>(tch);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.server.cli.ClientOpts;
@Parameter(names = "-update", description = "Make changes to the " + Constants.METADATA_TABLE_NAME + " table to include missing files")
* A utility to add files to the {@value Constants#METADATA_TABLE_NAME} table that are not listed in the root tablet. This is a recovery tool for someone who
* knows what they are doing. It might be better to save off files, and recover your instance by re-initializing and importing the existing files.
private static int addUnknownFiles(FileSystem fs, String directory, Set<String> knownFiles, KeyExtent ke, MultiTableBatchWriter writer, boolean update)
throws Exception {
|
Immediately return this expression instead of assigning it to the temporary variable "client".
|
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
|
1 duplicated blocks of code must be removed.
|
String _val76; // required
String _val87; // required
|
Rename this package name to match the regular expression '^[a-z]+(\.[a-z][a-z0-9]*)*$'.
|
import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.tokens.AuthenticationToken;
public void initializeSecurity(TCredentials credentials, String principal, byte[] token) throws AccumuloSecurityException {
public boolean authenticateUser(String principal, AuthenticationToken token) {
public void createUser(String principal, AuthenticationToken token) throws AccumuloSecurityException {
public void changePassword(String user, AuthenticationToken token) throws AccumuloSecurityException {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.core.iterators.system;
|
Remove this unused method parameter "hasStart".
|
/*
* (non-Javadoc)
*
* @see cloudtrace.instrument.receivers.AsyncSpanReceiver#flush()
*/
@Override
public void flush() {
if (!hosts.isEmpty())
super.flush();
}
/*
* (non-Javadoc)
*
* @see cloudtrace.instrument.receivers.AsyncSpanReceiver#sendSpans()
*/
@Override
void sendSpans() {
if (hosts.isEmpty()) {
if (!sendQueue.isEmpty()) {
log.error("No hosts to send data to, dropping queued spans");
synchronized (sendQueue) {
sendQueue.clear();
sendQueue.notifyAll();
}
}
} else {
super.sendSpans();
}
}
|
Either log or rethrow this exception.
|
import org.apache.accumulo.core.security.tokens.PasswordToken;
|
Replace all tab characters in this file by sequences of white-spaces.
|
protected byte data[];
protected int offset;
protected int length;
public ArrayByteSequence(byte data[]) {
this.data = data;
this.offset = 0;
this.length = data.length;
}
public ArrayByteSequence(byte data[], int offset, int length) {
if (offset < 0 || offset > data.length || length < 0 || (offset + length) > data.length) {
throw new IllegalArgumentException(" Bad offset and/or length data.length = " + data.length + " offset = " + offset + " length = " + length);
this.data = data;
this.offset = offset;
this.length = length;
}
public ArrayByteSequence(String s) {
this(s.getBytes());
}
@Override
public byte byteAt(int i) {
if (i < 0) {
throw new IllegalArgumentException("i < 0, " + i);
if (i >= length) {
throw new IllegalArgumentException("i >= length, " + i + " >= " + length);
return data[offset + i];
}
@Override
public byte[] getBackingArray() {
return data;
}
@Override
public boolean isBackedByArray() {
return true;
}
@Override
public int length() {
return length;
}
@Override
public int offset() {
return offset;
}
@Override
public ByteSequence subSequence(int start, int end) {
if (start > end || start < 0 || end > length) {
throw new IllegalArgumentException("Bad start and/end start = " + start + " end=" + end + " offset=" + offset + " length=" + length);
return new ArrayByteSequence(data, offset + start, end - start);
}
@Override
public byte[] toArray() {
if (offset == 0 && length == data.length) return data;
byte[] copy = new byte[length];
System.arraycopy(data, offset, copy, 0, length);
return copy;
}
public String toString() {
return new String(data, offset, length);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
public void setInterruptFlag(AtomicBoolean flag);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import java.nio.charset.Charset;
final Charset utf8 = Charset.forName("UTF8");
args = processOptions(args);
pass = args[1].getBytes(utf8);
|
Move this variable to comply with Java Code Conventions.
|
/*
* 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.
|
if (super.validateOptions(options) == false)
return false;
} catch (Exception e) {
throw new IllegalArgumentException("bad long " + TTL + ":" + options.get(TTL));
|
Remove the literal "false" boolean value.
|
state.set("bulkImportSuccess", "false");
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* Group Key/Value pairs into Iterators over rows. Suggested usage:
*
* <pre>
* RowIterator rowIterator = new RowIterator(connector.createScanner(tableName, authorizations));
* </pre>
|
Move this constructor to comply with Java Code Conventions.
|
import org.apache.accumulo.core.util.MetadataTable;
Scanner mdScanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
Scanner scanner = connector.createScanner(MetadataTable.NAME, opts.auths);
Text mdrow = new Text(KeyExtent.getMetadataEntry(new Text(MetadataTable.ID), null));
if (entry.getKey().compareRow(mdrow) == 0 && entry.getKey().getColumnFamily().compareTo(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY) == 0) {
if (!entry.getKey().getRow().toString().startsWith(MetadataTable.ID))
|
Use "Long.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.
*/
|
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.Authorizations;
scanner = conn.createScanner("cct", Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
package org.apache.accumulo.core.client.mock;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.iterators.WrappingIterator;
import org.apache.hadoop.io.Text;
public class TransformIterator extends WrappingIterator {
@Override
public Key getTopKey() {
Key k = getSource().getTopKey();
return new Key(new Text(k.getRow().toString().toLowerCase()), k.getColumnFamily(), k.getColumnQualifier(), k.getColumnVisibility(), k.getTimestamp());
}
}
|
Move this constructor to comply with Java Code Conventions.
|
/**
* Constructor
*
* @param s
* message.
*/
MetaBlockDoesNotExist(String s) {
super(s);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
super(instance, auths, state, RootTable.NAME);
}
public RootTabletStateStore() {
super(RootTable.NAME);
return new MetaDataTableScanner(instance, auths, RootTable.METADATA_TABLETS_RANGE, state, RootTable.NAME);
|
Reduce this switch case number of lines from 12 to at most 5, for example by extracting code into methods.
|
import static org.junit.Assert.assertFalse;
assertTrue(((AgeOffFilter) a).validateOptions(is.getOptions()));
assertFalse(((AgeOffFilter) a).validateOptions(EMPTY_OPTS));
assertTrue(a.validateOptions(is.getOptions()));
assertTrue(a.validateOptions(is.getOptions()));
assertTrue(a.validateOptions(is.getOptions()));
TimestampFilter.setEnd(is, 253402300800001l, true);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
is.clearOptions();
is.addOption(TimestampFilter.START, "19990101000011GMT");
assertTrue(a.validateOptions(is.getOptions()));
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.seek(new Range(), EMPTY_COL_FAMS, false);
assertEquals(size(a), 89);
is.clearOptions();
is.addOption(TimestampFilter.END, "19990101000031GMT");
assertTrue(a.validateOptions(is.getOptions()));
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.seek(new Range(), EMPTY_COL_FAMS, false);
assertEquals(size(a), 32);
assertFalse(a.validateOptions(EMPTY_OPTS));
|
Rename "hasStart" which hides the field declared at line 53.
|
if (System.currentTimeMillis() - lastBalance < minimumTimeBetweenRebalances)
return;
if (loggers.size() <= 0)
return;
if (current.size() < 2)
return;
if (!counts.containsKey(logger))
counts.put(logger, new ArrayList<LoggerUser>());
if (byCount.get(0).getValue().size() <= average)
return;
if (servers.size() <= average)
return;
if (lowCountUsers.size() >= average)
continue;
if (notUsingLowCountLogger.isEmpty())
continue;
if (lowCountUsers.size() >= average)
break;
if (!assignmentsOut.containsKey(user))
assignmentsOut.put(user, new ArrayList<String>());
|
Remove this call to "exit" or ensure it is really required.
|
if (!exists(tableName))
throw new TableNotFoundException(null, tableName, null);
if (!exists(tableName))
throw new TableNotFoundException(null, tableName, null);
if (!exists(tableName))
throw new TableNotFoundException(null, tableName, null);
if (!exists(tableName))
throw new TableNotFoundException(null, tableName, null);
|
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.
|
public static void enable(Instance instance, ZooReader zoo, String application, String address) throws IOException, KeeperException, InterruptedException {
String path = ZooUtil.getRoot(instance) + Constants.ZTRACERS;
if (address == null) {
try {
address = InetAddress.getLocalHost().getHostAddress().toString();
} catch (UnknownHostException e) {
address = "unknown";
}
Tracer.getInstance().addReceiver(new ZooTraceClient(zoo, path, address, application, 1000));
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
String home = System.getProperty("HOME");
if (home == null)
home = System.getenv("HOME");
final String histDir = home + "/.accumulo";
shellState.getReader().printString(counter + " " + Line + "\n");
|
Either log or rethrow this exception.
|
import org.apache.accumulo.server.fs.VolumeManager;
public long close(Master master, VolumeManager fs, Path path) throws IOException;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.server.security.SecurityConstants;
Instance instance = HdfsZooInstance.getInstance();
MetaDataTableScanner scanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), new Range(KeyExtent.getMetadataEntry(new Text(
tableId), new Text()),
KeyExtent.getMetadataEntry(
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
return new TabletServerBatchReaderIterator(instance, credentials, table, authorizations, ranges, numThreads, queryThreadPool, this, timeOut * 1000l);
|
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.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.