Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* An {@link AuthenticationToken} backed by a Hadoop CredentialProvider.
*/
public class CredentialProviderToken extends PasswordToken {
public static final String NAME_PROPERTY = "name",
CREDENTIAL_PROVIDERS_PROPERTY = "credentialProviders";
public static final String NAME_PROPERTY = "name";
public static final String CREDENTIAL_PROVIDERS_PROPERTY = "credentialProviders";

private String name;
private String credentialProviders;
Expand Down Expand Up @@ -104,8 +104,8 @@ public String getCredentialProviders() {

@Override
public void init(Properties properties) {
char[] nameCharArray = properties.get(NAME_PROPERTY),
credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY);
char[] nameCharArray = properties.get(NAME_PROPERTY);
char[] credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY);
if (nameCharArray != null && credentialProvidersCharArray != null) {
try {
this.setWithCredentialProviders(new String(nameCharArray),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,10 @@ public boolean test(final String input) {

private static class Bounds implements Predicate<String> {

private final long lowerBound, upperBound;
private final boolean lowerInclusive, upperInclusive;
private final long lowerBound;
private final long upperBound;
private final boolean lowerInclusive;
private final boolean upperInclusive;

public Bounds(final long lowerBound, final long upperBound) {
this(lowerBound, true, upperBound, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class BlockedInputStream extends InputStream {
byte[] array;
// ReadPos is where to start reading
// WritePos is the last position written to
int readPos, writePos;
int readPos;
int writePos;
DataInputStream in;
int blockSize;
boolean finished = false;
Expand Down
17 changes: 14 additions & 3 deletions core/src/main/java/org/apache/accumulo/core/data/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,20 @@ public Key(CharSequence row, CharSequence cf, CharSequence cq, ColumnVisibility
* @since 3.1.0
*/
public Key(ByteSequence row, ByteSequence cf, ByteSequence cq, ByteSequence cv, long ts) {
byte[] rowBytes, cfBytes, cqBytes, cvBytes;
int rowOffset, cfOffset, cqOffset, cvOffset;
int rowLen, cfLen, cqLen, cvLen;
byte[] rowBytes;
byte[] cfBytes;
byte[] cqBytes;
byte[] cvBytes;

int rowOffset;
int cfOffset;
int cqOffset;
int cvOffset;

int rowLen;
int cfLen;
int cqLen;
int cvLen;

if (row.isBackedByArray()) {
rowBytes = row.getBackingArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ public void readFields(DataInput in) throws IOException {
fieldsPrefixed = 0;
}

final byte[] row, cf, cq, cv;
final byte[] row;
final byte[] cf;
final byte[] cq;
final byte[] cv;
final long ts;

row = getData(in, ROW_SAME, ROW_COMMON_PREFIX, () -> prevKey.getRowData());
Expand Down Expand Up @@ -219,8 +222,15 @@ public static SkippR fastSkip(DataInput in, Key seekKey, ArrayByteSequence value
Key currKey, int entriesLeft) throws IOException {
// this method mostly avoids object allocation and only does compares when the row changes

ArrayByteSequence row, cf, cq, cv;
ArrayByteSequence prow, pcf, pcq, pcv;
ArrayByteSequence row;
ArrayByteSequence cf;
ArrayByteSequence cq;
ArrayByteSequence cv;

ArrayByteSequence prow;
ArrayByteSequence pcf;
ArrayByteSequence pcq;
ArrayByteSequence pcv;

ByteSequence stopRow = seekKey.getRowData();
ByteSequence stopCF = seekKey.getColumnFamilyData();
Expand All @@ -230,7 +240,9 @@ public static SkippR fastSkip(DataInput in, Key seekKey, ArrayByteSequence value
long pts = -1;
boolean pdel = false;

int rowCmp = -1, cfCmp = -1, cqCmp = -1;
int rowCmp = -1;
int cfCmp = -1;
int cqCmp = -1;

if (currKey != null) {

Expand Down Expand Up @@ -397,7 +409,10 @@ public static SkippR fastSkip(DataInput in, Key seekKey, ArrayByteSequence value
}

if (count > 1) {
ArrayByteSequence trow, tcf, tcq, tcv;
ArrayByteSequence trow;
ArrayByteSequence tcf;
ArrayByteSequence tcq;
ArrayByteSequence tcv;
long tts;

// when the current keys field is same as the last, then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public class ThriftUtil {
new AccumuloTFramedTransportFactory(Integer.MAX_VALUE);
private static final Map<Integer,TTransportFactory> factoryCache = new HashMap<>();

public static final String GSSAPI = "GSSAPI", DIGEST_MD5 = "DIGEST-MD5";
public static final String GSSAPI = "GSSAPI";
public static final String DIGEST_MD5 = "DIGEST-MD5";

private static final int RELOGIN_MAX_BACKOFF = 5000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ public class DurationFormat {

public DurationFormat(long time, String space) {
String dash = "-";
long ms, sec, min, hr, day, yr;
long ms;
long sec;
long min;
long hr;
long day;
long yr;

if (time == 0) {
str = dash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ public void testSerialize() throws IOException {

@Test
public void testDefaultEquality() {
BatchWriterConfig cfg1 = new BatchWriterConfig(), cfg2 = new BatchWriterConfig();
BatchWriterConfig cfg1 = new BatchWriterConfig();
BatchWriterConfig cfg2 = new BatchWriterConfig();
assertEquals(cfg1, cfg2);
assertEquals(cfg1.hashCode(), cfg2.hashCode());
cfg2.setMaxMemory(1);
Expand All @@ -193,7 +194,8 @@ public void testDefaultEquality() {

@Test
public void testManualEquality() {
BatchWriterConfig cfg1 = new BatchWriterConfig(), cfg2 = new BatchWriterConfig();
BatchWriterConfig cfg1 = new BatchWriterConfig();
BatchWriterConfig cfg2 = new BatchWriterConfig();
cfg1.setMaxLatency(10, SECONDS);
cfg2.setMaxLatency(10000, MILLISECONDS);

Expand All @@ -210,7 +212,9 @@ public void testManualEquality() {

@Test
public void testMerge() {
BatchWriterConfig cfg1 = new BatchWriterConfig(), cfg2 = new BatchWriterConfig();
BatchWriterConfig cfg1 = new BatchWriterConfig();
BatchWriterConfig cfg2 = new BatchWriterConfig();

cfg1.setMaxMemory(1234);
cfg2.setMaxMemory(5858);
cfg2.setDurability(Durability.LOG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class DelegationTokenConfigTest {

@Test
public void testTimeUnit() {
DelegationTokenConfig config1 = new DelegationTokenConfig(),
config2 = new DelegationTokenConfig();
DelegationTokenConfig config1 = new DelegationTokenConfig();
DelegationTokenConfig config2 = new DelegationTokenConfig();

config1.setTokenLifetime(1000, MILLISECONDS);
config2.setTokenLifetime(1, SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ public void testConnectionCaching() throws IOException, InterruptedException {
SaslConnectionParams saslParams2 =
user1.doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token));

ThriftTransportKey ttk1 =
new ThriftTransportKey(ThriftClientTypes.CLIENT, HostAndPort.fromParts("localhost", 9997),
1L, null, saslParams1),
ttk2 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams2);
ThriftTransportKey ttk1 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams1);
ThriftTransportKey ttk2 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams2);

// Should equals() and hashCode() to make sure we don't throw away thrift cnxns
assertEquals(ttk1, ttk2);
Expand All @@ -120,11 +119,10 @@ public void testSaslPrincipalIsSignificant() throws IOException, InterruptedExce
SaslConnectionParams saslParams2 =
user2.doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token));

ThriftTransportKey ttk1 =
new ThriftTransportKey(ThriftClientTypes.CLIENT, HostAndPort.fromParts("localhost", 9997),
1L, null, saslParams1),
ttk2 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams2);
ThriftTransportKey ttk1 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams1);
ThriftTransportKey ttk2 = new ThriftTransportKey(ThriftClientTypes.CLIENT,
HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams2);

assertNotEquals(ttk1, ttk2);
assertNotEquals(ttk1.hashCode(), ttk2.hashCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ public class HadoopCredentialProviderTest {
private static final Configuration hadoopConf = new Configuration();
private static final Logger log = LoggerFactory.getLogger(HadoopCredentialProviderTest.class);

private static final String populatedKeyStoreName = "/accumulo.jceks",
emptyKeyStoreName = "/empty.jceks";
private static File emptyKeyStore, populatedKeyStore;
private static final String populatedKeyStoreName = "/accumulo.jceks";
private static final String emptyKeyStoreName = "/empty.jceks";
private static File emptyKeyStore;
private static File populatedKeyStore;

@BeforeAll
public static void checkCredentialProviderAvailable() throws Exception {
URL populatedKeyStoreUrl =
HadoopCredentialProviderTest.class.getResource(populatedKeyStoreName),
emptyKeyStoreUrl = HadoopCredentialProviderTest.class.getResource(emptyKeyStoreName);
HadoopCredentialProviderTest.class.getResource(populatedKeyStoreName);
URL emptyKeyStoreUrl = HadoopCredentialProviderTest.class.getResource(emptyKeyStoreName);

assertNotNull(populatedKeyStoreUrl, "Could not find " + populatedKeyStoreName);
assertNotNull(emptyKeyStoreUrl, "Could not find " + emptyKeyStoreName);
Expand Down Expand Up @@ -117,8 +118,8 @@ public void testEmptyKeyStoreParses() {

@Test
public void testEmptyAndPopulatedKeyStores() {
String populatedAbsPath = getKeyStoreUrl(populatedKeyStore),
emptyAbsPath = getKeyStoreUrl(emptyKeyStore);
String populatedAbsPath = getKeyStoreUrl(populatedKeyStore);
String emptyAbsPath = getKeyStoreUrl(emptyKeyStore);
Configuration conf = new Configuration();
HadoopCredentialProvider.setPath(conf, populatedAbsPath + "," + emptyAbsPath);
Map<String,String> expectations = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public void testPropertyValidation() {
continue;
}
PropertyType propertyType = property.getType();
String invalidValue, validValue = property.getDefaultValue();
String invalidValue;
String validValue = property.getDefaultValue();
LOG.debug("Testing property: {} with type: {}", property.getKey(), propertyType);

switch (propertyType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public class ConditionalMutationTest {
private static final ColumnVisibility CVIS2 = new ColumnVisibility("B|C");
private static final long TIMESTAMP = 1234567890;

private Condition c1, c2;
private Condition c1;
private Condition c2;
private ConditionalMutation cm;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,11 @@ public void test1() throws IOException {
public void testNullByteInKey() throws IOException {
TreeMap<Key,Value> tm = new TreeMap<>();

String s1 = "first", s2 = "second";
byte[] b1 = s1.getBytes(UTF_8), b2 = s2.getBytes(UTF_8), ball;
String s1 = "first";
String s2 = "second";
byte[] b1 = s1.getBytes(UTF_8);
byte[] b2 = s2.getBytes(UTF_8);
byte[] ball;
ball = new byte[b1.length + b2.length + 1];
System.arraycopy(b1, 0, ball, 0, b1.length);
ball[b1.length] = (byte) 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ public TreeMap<Key,Value> createKeyValues() {
List<Mutation> mutations = createMutations();
TreeMap<Key,Value> keyValues = new TreeMap<>();

final Text cf = new Text(), cq = new Text();
final Text cf = new Text();
final Text cq = new Text();
for (Mutation m : mutations) {
final Text row = new Text(m.getRow());
for (ColumnUpdate update : m.getUpdates()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public class SaslClientDigestCallbackHandlerTest {
@Test
public void testEquality() {
SaslClientDigestCallbackHandler handler1 =
new SaslClientDigestCallbackHandler("user", "mypass".toCharArray()),
handler2 = new SaslClientDigestCallbackHandler("user", "mypass".toCharArray());
new SaslClientDigestCallbackHandler("user", "mypass".toCharArray());
SaslClientDigestCallbackHandler handler2 =
new SaslClientDigestCallbackHandler("user", "mypass".toCharArray());
assertEquals(handler1, handler2);
assertEquals(handler1.hashCode(), handler2.hashCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ public void test() {

replay(environment);

String t1Id = TABLE_ID_MAP.get("t1"), t2Id = TABLE_ID_MAP.get("t2"),
t3Id = TABLE_ID_MAP.get("t3");
String t1Id = TABLE_ID_MAP.get("t1");
String t2Id = TABLE_ID_MAP.get("t2");
String t3Id = TABLE_ID_MAP.get("t3");
state.clear();
TabletServerId svr = mkts("10.0.0.1", 1234, "0x01020304");
state.put(svr, status(t1Id, 10, t2Id, 10, t3Id, 10));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ public void testBackOffFactor() throws InterruptedException {
retry.setMaxRetries(MAX_RETRIES);
retry.setBackOffFactor(1.5);
retry.setStartWait(INITIAL_WAIT);
Duration waitIncrement, currentWait = INITIAL_WAIT;
Duration waitIncrement;
Duration currentWait = INITIAL_WAIT;
retry.setWaitIncrement(WAIT_INC);
retry.setMaxWait(Duration.ofSeconds(128).multipliedBy(MAX_RETRIES));
retry.setDoTimeJitter(false);
double backOfFactor = 1.5, originalBackoff = 1.5;
double backOfFactor = 1.5;
double originalBackoff = 1.5;

for (int i = 1; i <= MAX_RETRIES; i++) {
retry.sleep(currentWait);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

public class ValidatorTest {

private Validator<String> v, v2, v3;
private Validator<String> v;
private Validator<String> v2;
private Validator<String> v3;
private static final Pattern STARTSWITH_C = Pattern.compile("c.*");

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class VolumeImplTest {
@Test
public void testFileSystemInequivalence() {
Configuration hadoopConf = createMock(Configuration.class);
FileSystem fs = createMock(FileSystem.class), other = createMock(FileSystem.class);
FileSystem fs = createMock(FileSystem.class);
FileSystem other = createMock(FileSystem.class);

String basePath = "/accumulo";

Expand All @@ -62,7 +63,8 @@ public void testFileSystemInequivalence() {
@Test
public void testFileSystemEquivalence() {
Configuration hadoopConf = createMock(Configuration.class);
FileSystem fs = createMock(FileSystem.class), other = createMock(FileSystem.class);
FileSystem fs = createMock(FileSystem.class);
FileSystem other = createMock(FileSystem.class);
String basePath = "/accumulo";

expect(fs.getConf()).andReturn(hadoopConf).anyTimes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@
public class RangeInputSplit extends InputSplit implements Writable {
private Range range;
private String[] locations;
private String tableId, tableName;
private Boolean offline, isolatedScan, localIterators;
private String tableId;
private String tableName;
private Boolean offline;
private Boolean isolatedScan;
private Boolean localIterators;
private Set<IteratorSetting.Column> fetchedColumns;
private List<IteratorSetting> iterators;
private SamplerConfiguration samplerConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ private void checkExpectedRangeBins(int numSubBins, String[] strings, int[] rang
private void checkExpectedBins(int numSubBins, String[] strings, int[] bins) throws IOException {
assertEquals(strings.length, bins.length);
for (int i = 0; i < strings.length; ++i) {
int bin = bins[i], part =
int bin = bins[i];
int part =
prepPartitioner(numSubBins).findPartition(new Text(strings[i]), cutArray, numSubBins);
assertEquals(bin, part);
}
Expand Down
Loading