Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Dave Brosius 2014-05-14 20:45:57 -04:00
commit 15e0814c5b
11 changed files with 2 additions and 438 deletions

View File

@ -21,6 +21,7 @@
* Allow c* to be shutdown in an embedded mode (CASSANDRA-5635)
* Add server side batching to native transport (CASSANDRA-5663)
* Make batchlog replay asynchronous (CASSANDRA-6134)
* remove unused classes (CASSANDRA-7197)
Merged from 2.0:
* (Hadoop) support authentication in CqlRecordReader (CASSANDRA-7221)
* (Hadoop) Close java driver Cluster in CQLRR.close (CASSANDRA-7228)

View File

@ -1,29 +0,0 @@
/*
* 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.cassandra.db.columniterator;
import java.io.IOException;
import com.google.common.collect.AbstractIterator;
import org.apache.cassandra.db.OnDiskAtom;
public abstract class SimpleAbstractColumnIterator extends AbstractIterator<OnDiskAtom> implements OnDiskAtomIterator
{
public void close() throws IOException {}
}

View File

@ -1,75 +0,0 @@
/*
* 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.cassandra.db.context;
import java.nio.ByteBuffer;
import org.apache.cassandra.utils.memory.AbstractAllocator;
/**
* An opaque commutative context.
*
* Maintains a ByteBuffer context that represents a partitioned commutative value.
*/
public interface IContext
{
public static enum ContextRelationship
{
EQUAL,
GREATER_THAN,
LESS_THAN,
DISJOINT
};
/**
* Determine the relationship between two contexts.
*
* EQUAL: Equal set of nodes and every count is equal.
* GREATER_THAN: Superset of nodes and every count is equal or greater than its corollary.
* LESS_THAN: Subset of nodes and every count is equal or less than its corollary.
* DISJOINT: Node sets are not equal and/or counts are not all greater or less than.
*
* @param left
* context.
* @param right
* context.
* @return the ContextRelationship between the contexts.
*/
public ContextRelationship diff(ByteBuffer left, ByteBuffer right);
/**
* Return a context w/ an aggregated count for each node id.
*
* @param left
* context.
* @param right
* context.
* @param allocator
* an allocator to allocate the new context from.
*/
public ByteBuffer merge(ByteBuffer left, ByteBuffer right, AbstractAllocator allocator);
/**
* Human-readable String from context.
*
* @param context
* context.
* @return a human-readable String of the context.
*/
public String toString(ByteBuffer context);
}

View File

@ -1,27 +0,0 @@
/*
* 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.cassandra.gms;
import java.net.InetAddress;
public interface IFailureNotification
{
public void convict(InetAddress ep);
public void revive(InetAddress ep);
}

View File

@ -43,7 +43,7 @@ import java.util.Set;
import java.util.Collection;
import java.util.concurrent.*;
public class PendingRangeCalculatorService extends PendingRangeCalculatorServiceMBean
public class PendingRangeCalculatorService
{
public static final PendingRangeCalculatorService instance = new PendingRangeCalculatorService();

View File

@ -1,23 +0,0 @@
/**
* 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.cassandra.service;
public class PendingRangeCalculatorServiceMBean
{
}

View File

@ -1,24 +0,0 @@
/*
* 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.cassandra.thrift;
public enum RequestType
{
READ,
WRITE
}

View File

@ -1,91 +0,0 @@
/*
* 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.cassandra.utils;
import sun.misc.Unsafe;
import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
public final class AtomicLongArrayUpdater {
private static final long offset;
private static final int shift;
static final Unsafe theUnsafe;
static {
theUnsafe = (Unsafe) AccessController.doPrivileged(
new PrivilegedAction<Object>()
{
@Override
public Object run()
{
try
{
Field f = Unsafe.class.getDeclaredField("theUnsafe");
f.setAccessible(true);
return f.get(null);
} catch (NoSuchFieldException e)
{
// It doesn't matter what we throw;
// it's swallowed in getBest().
throw new Error();
} catch (IllegalAccessException e)
{
throw new Error();
}
}
});
Class<?> clazz = long[].class;
offset = theUnsafe.arrayBaseOffset(clazz);
shift = shift(theUnsafe.arrayIndexScale(clazz));
}
private static int shift(int scale)
{
if (Integer.bitCount(scale) != 1)
throw new IllegalStateException();
return Integer.bitCount(scale - 1);
}
public AtomicLongArrayUpdater() { }
public final boolean compareAndSet(Object trg, int i, long exp, long upd) {
return theUnsafe.compareAndSwapLong(trg, offset + (i << shift), exp, upd);
}
public final void putVolatile(Object trg, int i, long val) {
theUnsafe.putLongVolatile(trg, offset + (i << shift), val);
}
public final void putOrdered(Object trg, int i, long val) {
theUnsafe.putOrderedLong(trg, offset + (i << shift), val);
}
public final long get(Object trg, int i) {
return theUnsafe.getLong(trg, offset + (i << shift));
}
public final long getVolatile(Object trg, int i) {
return theUnsafe.getLongVolatile(trg, offset + (i << shift));
}
}

View File

@ -1,46 +0,0 @@
/*
* 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.cassandra.utils;
public class DefaultDouble
{
private final double originalValue;
private double currentValue;
public DefaultDouble(double value)
{
originalValue = value;
currentValue = value;
}
public double value()
{
return currentValue;
}
public void set(double d)
{
currentValue = d;
}
public boolean isModified()
{
return originalValue != currentValue;
}
}

View File

@ -1,82 +0,0 @@
/*
* 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.cassandra.utils;
import java.util.concurrent.atomic.AtomicLong;
public class LatencyTracker
{
private final AtomicLong opCount = new AtomicLong(0);
private final AtomicLong totalLatency = new AtomicLong(0);
private long lastLatency = 0;
private long lastOpCount = 0;
private final EstimatedHistogram totalHistogram = new EstimatedHistogram();
private final EstimatedHistogram recentHistogram = new EstimatedHistogram();
/** takes nanoseconds **/
public void addNano(long nanos)
{
// convert to microseconds. 1 millionth
addMicro(nanos / 1000);
}
public void addMicro(long micros)
{
opCount.incrementAndGet();
totalLatency.addAndGet(micros);
totalHistogram.add(micros);
recentHistogram.add(micros);
}
public long getOpCount()
{
return opCount.get();
}
/** returns microseconds */
public long getTotalLatencyMicros()
{
return totalLatency.get();
}
/** returns microseconds */
public double getRecentLatencyMicros()
{
long ops = opCount.get();
long n = totalLatency.get();
try
{
return ((double)n - lastLatency) / (ops - lastOpCount);
}
finally
{
lastLatency = n;
lastOpCount = ops;
}
}
public long[] getTotalLatencyHistogramMicros()
{
return totalHistogram.getBuckets(false);
}
public long[] getRecentLatencyHistogramMicros()
{
return recentHistogram.getBuckets(true);
}
}

View File

@ -1,40 +0,0 @@
/*
* 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.cassandra.utils;
import org.yaml.snakeyaml.introspector.Property;
import org.yaml.snakeyaml.nodes.NodeTuple;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Representer;
/* used to prevent null values from being included in generated YAML */
public class SkipNullRepresenter extends Representer
{
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag)
{
if (propertyValue == null)
{
return null;
}
else
{
return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
}
}
}