Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NewTableConfiguration (and also trivial code cleanup) #960

Merged
merged 2 commits into from
Nov 10, 2017
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# the License.
language: java
jdk:
- oraclejdk8
script: mvn verify javadoc:jar
- openjdk8
script: mvn clean verify javadoc:jar -Daccumulo.version=1.8.1 -Dthrift.version=0.9.3
notifications:
irc:
channels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -15,7 +15,6 @@

package org.apache.fluo.accumulo.iterators;

import java.lang.IllegalArgumentException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.LongPredicate;
Expand All @@ -25,9 +24,8 @@
import org.apache.accumulo.core.data.Value;

/**
* This class buffers Keys that all have the same row+column. Internally
* it only stores one Key, a list of timestamps and a list of values. At iteration
* time it materializes each Key+Value.
* This class buffers Keys that all have the same row+column. Internally it only stores one Key, a
* list of timestamps and a list of values. At iteration time it materializes each Key+Value.
*/
class ColumnBuffer {

Expand All @@ -53,11 +51,11 @@ private void add(long timestamp, byte[] v) {
}

/**
* When empty, the first key added sets the row+column. After this all keys
* added must have the same row+column.
* When empty, the first key added sets the row+column. After this all keys added must have the
* same row+column.
*
* @param k Key to be added to buffer
* @param v Value to be added to buffer
* @param vByte Value to be added to buffer
*/
public void add(Key k, byte[] vByte) throws IllegalArgumentException {
vByte = Arrays.copyOf(vByte, vByte.length);
Expand All @@ -73,8 +71,8 @@ public void add(Key k, byte[] vByte) throws IllegalArgumentException {
}

/**
* When empty, the first key added sets the row+column. After this all keys
* added must have the same row+column.
* When empty, the first key added sets the row+column. After this all keys added must have the
* same row+column.
*
* @param k Key to be added to buffer
* @param v Value to be added to buffer
Expand All @@ -84,8 +82,8 @@ public void add(Key k, Value v) throws IllegalArgumentException {
}

/**
* Clears the dest ColumnBuffer and inserts all entries in dest where the timestamp passes
* the timestampTest.
* Clears the dest ColumnBuffer and inserts all entries in dest where the timestamp passes the
* timestampTest.
*
* @param dest Destination ColumnBuffer
* @param timestampTest Test to determine which timestamps get added to dest
Expand Down Expand Up @@ -119,7 +117,7 @@ public int size() {
}

/**
* @param pos Position of the Key that will be retrieved
* @param pos Position of the Key that will be retrieved
* @return The key at a given position
*/
public Key getKey(int pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -16,12 +16,9 @@
package org.apache.fluo.accumulo.iterators;

import java.io.IOException;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.function.LongPredicate;

import com.google.common.annotations.VisibleForTesting;
import org.apache.accumulo.core.client.IteratorSetting;
Expand Down Expand Up @@ -87,7 +84,6 @@ public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String>
}
}


@Override
public boolean hasTop() {
return position < keysFiltered.size() || source.hasTop();
Expand Down Expand Up @@ -259,7 +255,8 @@ private void readColMetadata() throws IOException {
if (isFullMajc) {
if (isDelete) {
if (DelReadLockValue.isRollback(source.getTopValue().get())) {
// can drop rolled back read lock delete markers on any full majc, do not need to consider gcTimestamp
// can drop rolled back read lock delete markers on any full majc, do not need to
// consider gcTimestamp
keep = false;
} else {
long rlockCommitTs =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -21,5 +21,8 @@ public class AccumuloProps {
public static final String TABLE_CLASSPATH = "table.classpath.context";
public static final String TABLE_BLOCKCACHE_ENABLED = "table.cache.block.enable";
public static final String TABLE_FORMATTER_CLASS = "table.formatter";
public static final String TABLE_GROUP_PREFIX = "table.group.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is much nicer.

public static final String TABLE_GROUPS_ENABLED = "table.groups.enabled";
public static final Object TABLE_ITERATOR_PREFIX = "table.iterator.";

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -32,6 +32,8 @@ public class ColumnConstants {
public static final long DATA_PREFIX = 0xa000000000000000L;
public static final long TIMESTAMP_MASK = 0x1fffffffffffffffL;
public static final Bytes NOTIFY_CF = Bytes.of("ntfy");
public static final String NOTIFY_LOCALITY_GROUP_NAME = "notify";
public static final Bytes GC_CF = Bytes.of("gc");

private ColumnConstants() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public TestData addIfInRange(String key, String value, Range range) {
String cq = fields[2];
String ct;
long ts;
byte[] val = new byte[0];;
byte[] val = new byte[0];

if (cf.equals("ntfy")) {
ts = Long.parseLong(fields[3]) << 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class AbstractSnapshotBase implements SnapshotBase {
* toString(). Second, the actual Transaction implementation will under some circumstances return
* the Bytes object that was passed in.
*/
private Map<String, Bytes> s2bCache = new WeakHashMap<String, Bytes>();
private Map<String, Bytes> s2bCache = new WeakHashMap<>();

public AbstractSnapshotBase() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Bytes get(Bytes row, Column column) {

@Override
public Map<Column, Bytes> get(Bytes row, Set<Column> columns) {
HashMap<Column, Bytes> ret = new HashMap<Column, Bytes>();
HashMap<Column, Bytes> ret = new HashMap<>();
for (Column column : columns) {
RowColumn rc = new RowColumn(row, column);
if (snapshot.containsKey(rc)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand Down Expand Up @@ -49,8 +49,11 @@ public void testDefaults() {
base.getConnectionRetryTimeout());
Assert.assertEquals(FluoConfiguration.ACCUMULO_ZOOKEEPERS_DEFAULT,
base.getAccumuloZookeepers());
Assert.assertEquals(FluoConfiguration.ADMIN_ACCUMULO_CLASSPATH_DEFAULT,
base.getAccumuloClasspath());
@SuppressWarnings("deprecation")
String tmpFieldName = FluoConfiguration.ADMIN_ACCUMULO_CLASSPATH_DEFAULT;
@SuppressWarnings("deprecation")
String tmpCP = base.getAccumuloClasspath();
Assert.assertEquals(tmpFieldName, tmpCP);
Assert.assertEquals(FluoConfiguration.WORKER_NUM_THREADS_DEFAULT, base.getWorkerThreads());
Assert.assertEquals(FluoConfiguration.TRANSACTION_ROLLBACK_TIME_DEFAULT,
base.getTransactionRollbackTime());
Expand Down Expand Up @@ -86,8 +89,9 @@ public void testTable() {
@Test
public void testSetGet() {
FluoConfiguration config = new FluoConfiguration();
Assert.assertEquals("path1,path2",
config.setAccumuloClasspath("path1,path2").getAccumuloClasspath());
@SuppressWarnings("deprecation")
String tmpCP = config.setAccumuloClasspath("path1,path2").getAccumuloClasspath();
Assert.assertEquals("path1,path2", tmpCP);
Assert.assertEquals("path1,path2", config.setAccumuloJars("path1,path2").getAccumuloJars());
Assert.assertEquals("instance", config.setAccumuloInstance("instance").getAccumuloInstance());
Assert.assertEquals("pass", config.setAccumuloPassword("pass").getAccumuloPassword());
Expand Down Expand Up @@ -184,7 +188,9 @@ public void testLoadingOldPropsFile() {

FluoConfiguration config = new FluoConfiguration(propsFile);
// make sure classpath contains comma. otherwise it was shortened
Assert.assertTrue(config.getAccumuloClasspath().contains(","));
@SuppressWarnings("deprecation")
String tmpCP = config.getAccumuloClasspath();
Assert.assertTrue(tmpCP.contains(","));
// check for values set in prop file
Assert.assertEquals("localhost/fluo", config.getInstanceZookeepers());
Assert.assertEquals("localhost", config.getAccumuloZookeepers());
Expand Down Expand Up @@ -249,7 +255,9 @@ public void testLoadingOldTestPropsFile() {

FluoConfiguration config = new FluoConfiguration(propsFile);
// make sure classpath contains comma. otherwise it was shortened
Assert.assertTrue(config.getAccumuloClasspath().contains(","));
@SuppressWarnings("deprecation")
String tmpCP = config.getAccumuloClasspath();
Assert.assertTrue(tmpCP.contains(","));
// check for values set in prop file
Assert.assertEquals("app1", config.getApplicationName());
Assert.assertEquals("localhost/fluo2", config.getInstanceZookeepers());
Expand All @@ -258,7 +266,9 @@ public void testLoadingOldTestPropsFile() {
Assert.assertEquals("user5", config.getAccumuloUser());
Assert.assertEquals("pass6", config.getAccumuloPassword());
Assert.assertEquals("zoo7", config.getAccumuloZookeepers());
Assert.assertEquals(8, config.getClientRetryTimeout());
@SuppressWarnings("deprecation")
int tmpTimeout = config.getClientRetryTimeout();
Assert.assertEquals(8, tmpTimeout);
Assert.assertEquals(8, config.getConnectionRetryTimeout());
Assert.assertEquals("table9", config.getAccumuloTable());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -21,7 +21,6 @@

import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.api.service.FluoOracle;
import org.apache.fluo.cluster.util.LogbackUtil;
import org.apache.fluo.core.metrics.MetricNames;
import org.apache.fluo.core.oracle.FluoOracleImpl;
import org.apache.fluo.core.util.UtilWaitThread;
Expand Down Expand Up @@ -61,7 +60,7 @@ public void run() {

try {
if (!logDir.equals(STDOUT)) {
LogbackUtil.init("oracle", configDir, logDir);
org.apache.fluo.cluster.util.LogbackUtil.init("oracle", configDir, logDir);
}
} catch (Exception e) {
System.err.println("Exception while starting FluoOracle: " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -21,7 +21,6 @@

import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.api.service.FluoWorker;
import org.apache.fluo.cluster.util.LogbackUtil;
import org.apache.fluo.core.metrics.MetricNames;
import org.apache.fluo.core.util.UtilWaitThread;
import org.apache.fluo.core.worker.FluoWorkerImpl;
Expand Down Expand Up @@ -61,7 +60,7 @@ public void run() {

try {
if (!logDir.equals(STDOUT)) {
LogbackUtil.init("worker", configDir, logDir);
org.apache.fluo.cluster.util.LogbackUtil.init("worker", configDir, logDir);
}
} catch (Exception e) {
System.err.println("Exception while starting FluoWorker: " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -33,7 +33,6 @@
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.api.exceptions.FluoException;
import org.apache.fluo.cluster.util.FluoYarnConfig;
import org.apache.fluo.core.impl.Environment;
import org.apache.fluo.core.impl.Notification;
import org.apache.fluo.core.util.ScanUtil;
Expand Down Expand Up @@ -118,7 +117,8 @@ public void waitUntilFinished(FluoConfiguration config) {
}

try {
long sleepSec = calculateSleep(ntfyCount, FluoYarnConfig.getWorkerInstances(config));
long sleepSec = calculateSleep(ntfyCount,
org.apache.fluo.cluster.util.FluoYarnConfig.getWorkerInstances(config));
log.info("{} notifications are still outstanding. Will try again in {} seconds...",
ntfyCount, sleepSec);
Thread.sleep(1000 * sleepSec);
Expand Down
Loading