You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/05/19 17:51:10 UTC
svn commit: r776365 - in /incubator/cassandra/trunk: interface/
interface/gen-java/org/apache/cassandra/service/
src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/
src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/se...
Author: jbellis
Date: Tue May 19 15:51:10 2009
New Revision: 776365
URL: http://svn.apache.org/viewvc?rev=776365&view=rev
Log:
add block_for parameter to insert calls. patch by Sandeep Tata; reviewed by jbellis for CASSANDRA-154
Modified:
incubator/cassandra/trunk/interface/cassandra.thrift
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
Modified: incubator/cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/cassandra.thrift?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/cassandra.thrift (original)
+++ incubator/cassandra/trunk/interface/cassandra.thrift Tue May 19 15:51:10 2009
@@ -92,13 +92,13 @@
i32 get_column_count(1:string tablename, 2:string key, 3:string columnFamily_column)
throws (1: InvalidRequestException ire),
- void insert(1:string tablename, 2:string key, 3:string columnFamily_column, 4:binary cellData, 5:i64 timestamp, 6:bool block=0)
+ void insert(1:string tablename, 2:string key, 3:string columnFamily_column, 4:binary cellData, 5:i64 timestamp, 6:i32 block_for=0)
throws (1: InvalidRequestException ire, 2: UnavailableException ue),
- void batch_insert(1: batch_mutation_t batchMutation, 2:bool block=0)
+ void batch_insert(1: batch_mutation_t batchMutation, 2:i32 block_for=0)
throws (1: InvalidRequestException ire, 2: UnavailableException ue),
- void remove(1:string tablename, 2:string key, 3:string columnFamily_column, 4:i64 timestamp, 5:bool block=0)
+ void remove(1:string tablename, 2:string key, 3:string columnFamily_column, 4:i64 timestamp, 5:i32 block_for=0)
throws (1: InvalidRequestException ire, 2: UnavailableException ue),
list<column_t> get_columns_since(1:string tablename, 2:string key, 3:string columnFamily_column, 4:i64 timeStamp)
@@ -113,7 +113,7 @@
superColumn_t get_superColumn(1:string tablename, 2:string key, 3:string columnFamily)
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
- void batch_insert_superColumn(1:batch_mutation_super_t batchMutationSuper, 2:bool block=0)
+ void batch_insert_superColumn(1:batch_mutation_super_t batchMutationSuper, 2:i32 block_for=0)
throws (1: InvalidRequestException ire, 2: UnavailableException ue),
oneway void touch(1:string key, 2:bool fData),
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java Tue May 19 15:51:10 2009
@@ -32,11 +32,11 @@
public int get_column_count(String tablename, String key, String columnFamily_column) throws InvalidRequestException, TException;
- public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, boolean block) throws InvalidRequestException, UnavailableException, TException;
+ public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, int block_for) throws InvalidRequestException, UnavailableException, TException;
- public void batch_insert(batch_mutation_t batchMutation, boolean block) throws InvalidRequestException, UnavailableException, TException;
+ public void batch_insert(batch_mutation_t batchMutation, int block_for) throws InvalidRequestException, UnavailableException, TException;
- public void remove(String tablename, String key, String columnFamily_column, long timestamp, boolean block) throws InvalidRequestException, UnavailableException, TException;
+ public void remove(String tablename, String key, String columnFamily_column, long timestamp, int block_for) throws InvalidRequestException, UnavailableException, TException;
public List<column_t> get_columns_since(String tablename, String key, String columnFamily_column, long timeStamp) throws InvalidRequestException, NotFoundException, TException;
@@ -46,7 +46,7 @@
public superColumn_t get_superColumn(String tablename, String key, String columnFamily) throws InvalidRequestException, NotFoundException, TException;
- public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, boolean block) throws InvalidRequestException, UnavailableException, TException;
+ public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, int block_for) throws InvalidRequestException, UnavailableException, TException;
public void touch(String key, boolean fData) throws TException;
@@ -297,13 +297,13 @@
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_column_count failed: unknown result");
}
- public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, boolean block) throws InvalidRequestException, UnavailableException, TException
+ public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, int block_for) throws InvalidRequestException, UnavailableException, TException
{
- send_insert(tablename, key, columnFamily_column, cellData, timestamp, block);
+ send_insert(tablename, key, columnFamily_column, cellData, timestamp, block_for);
recv_insert();
}
- public void send_insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, boolean block) throws TException
+ public void send_insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, int block_for) throws TException
{
oprot_.writeMessageBegin(new TMessage("insert", TMessageType.CALL, seqid_));
insert_args args = new insert_args();
@@ -312,7 +312,7 @@
args.columnFamily_column = columnFamily_column;
args.cellData = cellData;
args.timestamp = timestamp;
- args.block = block;
+ args.block_for = block_for;
args.write(oprot_);
oprot_.writeMessageEnd();
oprot_.getTransport().flush();
@@ -338,18 +338,18 @@
return;
}
- public void batch_insert(batch_mutation_t batchMutation, boolean block) throws InvalidRequestException, UnavailableException, TException
+ public void batch_insert(batch_mutation_t batchMutation, int block_for) throws InvalidRequestException, UnavailableException, TException
{
- send_batch_insert(batchMutation, block);
+ send_batch_insert(batchMutation, block_for);
recv_batch_insert();
}
- public void send_batch_insert(batch_mutation_t batchMutation, boolean block) throws TException
+ public void send_batch_insert(batch_mutation_t batchMutation, int block_for) throws TException
{
oprot_.writeMessageBegin(new TMessage("batch_insert", TMessageType.CALL, seqid_));
batch_insert_args args = new batch_insert_args();
args.batchMutation = batchMutation;
- args.block = block;
+ args.block_for = block_for;
args.write(oprot_);
oprot_.writeMessageEnd();
oprot_.getTransport().flush();
@@ -375,13 +375,13 @@
return;
}
- public void remove(String tablename, String key, String columnFamily_column, long timestamp, boolean block) throws InvalidRequestException, UnavailableException, TException
+ public void remove(String tablename, String key, String columnFamily_column, long timestamp, int block_for) throws InvalidRequestException, UnavailableException, TException
{
- send_remove(tablename, key, columnFamily_column, timestamp, block);
+ send_remove(tablename, key, columnFamily_column, timestamp, block_for);
recv_remove();
}
- public void send_remove(String tablename, String key, String columnFamily_column, long timestamp, boolean block) throws TException
+ public void send_remove(String tablename, String key, String columnFamily_column, long timestamp, int block_for) throws TException
{
oprot_.writeMessageBegin(new TMessage("remove", TMessageType.CALL, seqid_));
remove_args args = new remove_args();
@@ -389,7 +389,7 @@
args.key = key;
args.columnFamily_column = columnFamily_column;
args.timestamp = timestamp;
- args.block = block;
+ args.block_for = block_for;
args.write(oprot_);
oprot_.writeMessageEnd();
oprot_.getTransport().flush();
@@ -577,18 +577,18 @@
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_superColumn failed: unknown result");
}
- public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, boolean block) throws InvalidRequestException, UnavailableException, TException
+ public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, int block_for) throws InvalidRequestException, UnavailableException, TException
{
- send_batch_insert_superColumn(batchMutationSuper, block);
+ send_batch_insert_superColumn(batchMutationSuper, block_for);
recv_batch_insert_superColumn();
}
- public void send_batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, boolean block) throws TException
+ public void send_batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, int block_for) throws TException
{
oprot_.writeMessageBegin(new TMessage("batch_insert_superColumn", TMessageType.CALL, seqid_));
batch_insert_superColumn_args args = new batch_insert_superColumn_args();
args.batchMutationSuper = batchMutationSuper;
- args.block = block;
+ args.block_for = block_for;
args.write(oprot_);
oprot_.writeMessageEnd();
oprot_.getTransport().flush();
@@ -1010,7 +1010,7 @@
iprot.readMessageEnd();
insert_result result = new insert_result();
try {
- iface_.insert(args.tablename, args.key, args.columnFamily_column, args.cellData, args.timestamp, args.block);
+ iface_.insert(args.tablename, args.key, args.columnFamily_column, args.cellData, args.timestamp, args.block_for);
} catch (InvalidRequestException ire) {
result.ire = ire;
} catch (UnavailableException ue) {
@@ -1040,7 +1040,7 @@
iprot.readMessageEnd();
batch_insert_result result = new batch_insert_result();
try {
- iface_.batch_insert(args.batchMutation, args.block);
+ iface_.batch_insert(args.batchMutation, args.block_for);
} catch (InvalidRequestException ire) {
result.ire = ire;
} catch (UnavailableException ue) {
@@ -1070,7 +1070,7 @@
iprot.readMessageEnd();
remove_result result = new remove_result();
try {
- iface_.remove(args.tablename, args.key, args.columnFamily_column, args.timestamp, args.block);
+ iface_.remove(args.tablename, args.key, args.columnFamily_column, args.timestamp, args.block_for);
} catch (InvalidRequestException ire) {
result.ire = ire;
} catch (UnavailableException ue) {
@@ -1216,7 +1216,7 @@
iprot.readMessageEnd();
batch_insert_superColumn_result result = new batch_insert_superColumn_result();
try {
- iface_.batch_insert_superColumn(args.batchMutationSuper, args.block);
+ iface_.batch_insert_superColumn(args.batchMutationSuper, args.block_for);
} catch (InvalidRequestException ire) {
result.ire = ire;
} catch (UnavailableException ue) {
@@ -5346,7 +5346,7 @@
private static final TField COLUMN_FAMILY_COLUMN_FIELD_DESC = new TField("columnFamily_column", TType.STRING, (short)3);
private static final TField CELL_DATA_FIELD_DESC = new TField("cellData", TType.STRING, (short)4);
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)5);
- private static final TField BLOCK_FIELD_DESC = new TField("block", TType.BOOL, (short)6);
+ private static final TField BLOCK_FOR_FIELD_DESC = new TField("block_for", TType.I32, (short)6);
public String tablename;
public static final int TABLENAME = 1;
@@ -5358,13 +5358,13 @@
public static final int CELLDATA = 4;
public long timestamp;
public static final int TIMESTAMP = 5;
- public boolean block;
- public static final int BLOCK = 6;
+ public int block_for;
+ public static final int BLOCK_FOR = 6;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
public boolean timestamp = false;
- public boolean block = false;
+ public boolean block_for = false;
}
public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -5378,8 +5378,8 @@
new FieldValueMetaData(TType.STRING)));
put(TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
- put(BLOCK, new FieldMetaData("block", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
+ put(BLOCK_FOR, new FieldMetaData("block_for", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
}});
static {
@@ -5387,7 +5387,7 @@
}
public insert_args() {
- this.block = false;
+ this.block_for = 0;
}
@@ -5397,7 +5397,7 @@
String columnFamily_column,
byte[] cellData,
long timestamp,
- boolean block)
+ int block_for)
{
this();
this.tablename = tablename;
@@ -5406,8 +5406,8 @@
this.cellData = cellData;
this.timestamp = timestamp;
this.__isset.timestamp = true;
- this.block = block;
- this.__isset.block = true;
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
/**
@@ -5429,8 +5429,8 @@
}
__isset.timestamp = other.__isset.timestamp;
this.timestamp = other.timestamp;
- __isset.block = other.__isset.block;
- this.block = other.block;
+ __isset.block_for = other.__isset.block_for;
+ this.block_for = other.block_for;
}
@Override
@@ -5552,26 +5552,26 @@
this.__isset.timestamp = value;
}
- public boolean isBlock() {
- return this.block;
+ public int getBlock_for() {
+ return this.block_for;
}
- public void setBlock(boolean block) {
- this.block = block;
- this.__isset.block = true;
+ public void setBlock_for(int block_for) {
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
- public void unsetBlock() {
- this.__isset.block = false;
+ public void unsetBlock_for() {
+ this.__isset.block_for = false;
}
- // Returns true if field block is set (has been asigned a value) and false otherwise
- public boolean isSetBlock() {
- return this.__isset.block;
+ // Returns true if field block_for is set (has been asigned a value) and false otherwise
+ public boolean isSetBlock_for() {
+ return this.__isset.block_for;
}
- public void setBlockIsSet(boolean value) {
- this.__isset.block = value;
+ public void setBlock_forIsSet(boolean value) {
+ this.__isset.block_for = value;
}
public void setFieldValue(int fieldID, Object value) {
@@ -5616,11 +5616,11 @@
}
break;
- case BLOCK:
+ case BLOCK_FOR:
if (value == null) {
- unsetBlock();
+ unsetBlock_for();
} else {
- setBlock((Boolean)value);
+ setBlock_for((Integer)value);
}
break;
@@ -5646,8 +5646,8 @@
case TIMESTAMP:
return new Long(getTimestamp());
- case BLOCK:
- return new Boolean(isBlock());
+ case BLOCK_FOR:
+ return new Integer(getBlock_for());
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
@@ -5667,8 +5667,8 @@
return isSetCellData();
case TIMESTAMP:
return isSetTimestamp();
- case BLOCK:
- return isSetBlock();
+ case BLOCK_FOR:
+ return isSetBlock_for();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
@@ -5732,12 +5732,12 @@
return false;
}
- boolean this_present_block = true;
- boolean that_present_block = true;
- if (this_present_block || that_present_block) {
- if (!(this_present_block && that_present_block))
+ boolean this_present_block_for = true;
+ boolean that_present_block_for = true;
+ if (this_present_block_for || that_present_block_for) {
+ if (!(this_present_block_for && that_present_block_for))
return false;
- if (this.block != that.block)
+ if (this.block_for != that.block_for)
return false;
}
@@ -5796,10 +5796,10 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case BLOCK:
- if (field.type == TType.BOOL) {
- this.block = iprot.readBool();
- this.__isset.block = true;
+ case BLOCK_FOR:
+ if (field.type == TType.I32) {
+ this.block_for = iprot.readI32();
+ this.__isset.block_for = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -5844,8 +5844,8 @@
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(this.timestamp);
oprot.writeFieldEnd();
- oprot.writeFieldBegin(BLOCK_FIELD_DESC);
- oprot.writeBool(this.block);
+ oprot.writeFieldBegin(BLOCK_FOR_FIELD_DESC);
+ oprot.writeI32(this.block_for);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
@@ -5897,8 +5897,8 @@
sb.append(this.timestamp);
first = false;
if (!first) sb.append(", ");
- sb.append("block:");
- sb.append(this.block);
+ sb.append("block_for:");
+ sb.append(this.block_for);
first = false;
sb.append(")");
return sb.toString();
@@ -6188,23 +6188,23 @@
public static class batch_insert_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("batch_insert_args");
private static final TField BATCH_MUTATION_FIELD_DESC = new TField("batchMutation", TType.STRUCT, (short)1);
- private static final TField BLOCK_FIELD_DESC = new TField("block", TType.BOOL, (short)2);
+ private static final TField BLOCK_FOR_FIELD_DESC = new TField("block_for", TType.I32, (short)2);
public batch_mutation_t batchMutation;
public static final int BATCHMUTATION = 1;
- public boolean block;
- public static final int BLOCK = 2;
+ public int block_for;
+ public static final int BLOCK_FOR = 2;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
- public boolean block = false;
+ public boolean block_for = false;
}
public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
put(BATCHMUTATION, new FieldMetaData("batchMutation", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, batch_mutation_t.class)));
- put(BLOCK, new FieldMetaData("block", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
+ put(BLOCK_FOR, new FieldMetaData("block_for", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
}});
static {
@@ -6212,18 +6212,18 @@
}
public batch_insert_args() {
- this.block = false;
+ this.block_for = 0;
}
public batch_insert_args(
batch_mutation_t batchMutation,
- boolean block)
+ int block_for)
{
this();
this.batchMutation = batchMutation;
- this.block = block;
- this.__isset.block = true;
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
/**
@@ -6233,8 +6233,8 @@
if (other.isSetBatchMutation()) {
this.batchMutation = new batch_mutation_t(other.batchMutation);
}
- __isset.block = other.__isset.block;
- this.block = other.block;
+ __isset.block_for = other.__isset.block_for;
+ this.block_for = other.block_for;
}
@Override
@@ -6265,26 +6265,26 @@
}
}
- public boolean isBlock() {
- return this.block;
+ public int getBlock_for() {
+ return this.block_for;
}
- public void setBlock(boolean block) {
- this.block = block;
- this.__isset.block = true;
+ public void setBlock_for(int block_for) {
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
- public void unsetBlock() {
- this.__isset.block = false;
+ public void unsetBlock_for() {
+ this.__isset.block_for = false;
}
- // Returns true if field block is set (has been asigned a value) and false otherwise
- public boolean isSetBlock() {
- return this.__isset.block;
+ // Returns true if field block_for is set (has been asigned a value) and false otherwise
+ public boolean isSetBlock_for() {
+ return this.__isset.block_for;
}
- public void setBlockIsSet(boolean value) {
- this.__isset.block = value;
+ public void setBlock_forIsSet(boolean value) {
+ this.__isset.block_for = value;
}
public void setFieldValue(int fieldID, Object value) {
@@ -6297,11 +6297,11 @@
}
break;
- case BLOCK:
+ case BLOCK_FOR:
if (value == null) {
- unsetBlock();
+ unsetBlock_for();
} else {
- setBlock((Boolean)value);
+ setBlock_for((Integer)value);
}
break;
@@ -6315,8 +6315,8 @@
case BATCHMUTATION:
return getBatchMutation();
- case BLOCK:
- return new Boolean(isBlock());
+ case BLOCK_FOR:
+ return new Integer(getBlock_for());
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
@@ -6328,8 +6328,8 @@
switch (fieldID) {
case BATCHMUTATION:
return isSetBatchMutation();
- case BLOCK:
- return isSetBlock();
+ case BLOCK_FOR:
+ return isSetBlock_for();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
@@ -6357,12 +6357,12 @@
return false;
}
- boolean this_present_block = true;
- boolean that_present_block = true;
- if (this_present_block || that_present_block) {
- if (!(this_present_block && that_present_block))
+ boolean this_present_block_for = true;
+ boolean that_present_block_for = true;
+ if (this_present_block_for || that_present_block_for) {
+ if (!(this_present_block_for && that_present_block_for))
return false;
- if (this.block != that.block)
+ if (this.block_for != that.block_for)
return false;
}
@@ -6393,10 +6393,10 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case BLOCK:
- if (field.type == TType.BOOL) {
- this.block = iprot.readBool();
- this.__isset.block = true;
+ case BLOCK_FOR:
+ if (field.type == TType.I32) {
+ this.block_for = iprot.readI32();
+ this.__isset.block_for = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -6423,8 +6423,8 @@
this.batchMutation.write(oprot);
oprot.writeFieldEnd();
}
- oprot.writeFieldBegin(BLOCK_FIELD_DESC);
- oprot.writeBool(this.block);
+ oprot.writeFieldBegin(BLOCK_FOR_FIELD_DESC);
+ oprot.writeI32(this.block_for);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
@@ -6443,8 +6443,8 @@
}
first = false;
if (!first) sb.append(", ");
- sb.append("block:");
- sb.append(this.block);
+ sb.append("block_for:");
+ sb.append(this.block_for);
first = false;
sb.append(")");
return sb.toString();
@@ -6737,7 +6737,7 @@
private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)2);
private static final TField COLUMN_FAMILY_COLUMN_FIELD_DESC = new TField("columnFamily_column", TType.STRING, (short)3);
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)4);
- private static final TField BLOCK_FIELD_DESC = new TField("block", TType.BOOL, (short)5);
+ private static final TField BLOCK_FOR_FIELD_DESC = new TField("block_for", TType.I32, (short)5);
public String tablename;
public static final int TABLENAME = 1;
@@ -6747,13 +6747,13 @@
public static final int COLUMNFAMILY_COLUMN = 3;
public long timestamp;
public static final int TIMESTAMP = 4;
- public boolean block;
- public static final int BLOCK = 5;
+ public int block_for;
+ public static final int BLOCK_FOR = 5;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
public boolean timestamp = false;
- public boolean block = false;
+ public boolean block_for = false;
}
public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -6765,8 +6765,8 @@
new FieldValueMetaData(TType.STRING)));
put(TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
- put(BLOCK, new FieldMetaData("block", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
+ put(BLOCK_FOR, new FieldMetaData("block_for", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
}});
static {
@@ -6774,7 +6774,7 @@
}
public remove_args() {
- this.block = false;
+ this.block_for = 0;
}
@@ -6783,7 +6783,7 @@
String key,
String columnFamily_column,
long timestamp,
- boolean block)
+ int block_for)
{
this();
this.tablename = tablename;
@@ -6791,8 +6791,8 @@
this.columnFamily_column = columnFamily_column;
this.timestamp = timestamp;
this.__isset.timestamp = true;
- this.block = block;
- this.__isset.block = true;
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
/**
@@ -6810,8 +6810,8 @@
}
__isset.timestamp = other.__isset.timestamp;
this.timestamp = other.timestamp;
- __isset.block = other.__isset.block;
- this.block = other.block;
+ __isset.block_for = other.__isset.block_for;
+ this.block_for = other.block_for;
}
@Override
@@ -6910,26 +6910,26 @@
this.__isset.timestamp = value;
}
- public boolean isBlock() {
- return this.block;
+ public int getBlock_for() {
+ return this.block_for;
}
- public void setBlock(boolean block) {
- this.block = block;
- this.__isset.block = true;
+ public void setBlock_for(int block_for) {
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
- public void unsetBlock() {
- this.__isset.block = false;
+ public void unsetBlock_for() {
+ this.__isset.block_for = false;
}
- // Returns true if field block is set (has been asigned a value) and false otherwise
- public boolean isSetBlock() {
- return this.__isset.block;
+ // Returns true if field block_for is set (has been asigned a value) and false otherwise
+ public boolean isSetBlock_for() {
+ return this.__isset.block_for;
}
- public void setBlockIsSet(boolean value) {
- this.__isset.block = value;
+ public void setBlock_forIsSet(boolean value) {
+ this.__isset.block_for = value;
}
public void setFieldValue(int fieldID, Object value) {
@@ -6966,11 +6966,11 @@
}
break;
- case BLOCK:
+ case BLOCK_FOR:
if (value == null) {
- unsetBlock();
+ unsetBlock_for();
} else {
- setBlock((Boolean)value);
+ setBlock_for((Integer)value);
}
break;
@@ -6993,8 +6993,8 @@
case TIMESTAMP:
return new Long(getTimestamp());
- case BLOCK:
- return new Boolean(isBlock());
+ case BLOCK_FOR:
+ return new Integer(getBlock_for());
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
@@ -7012,8 +7012,8 @@
return isSetColumnFamily_column();
case TIMESTAMP:
return isSetTimestamp();
- case BLOCK:
- return isSetBlock();
+ case BLOCK_FOR:
+ return isSetBlock_for();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
@@ -7068,12 +7068,12 @@
return false;
}
- boolean this_present_block = true;
- boolean that_present_block = true;
- if (this_present_block || that_present_block) {
- if (!(this_present_block && that_present_block))
+ boolean this_present_block_for = true;
+ boolean that_present_block_for = true;
+ if (this_present_block_for || that_present_block_for) {
+ if (!(this_present_block_for && that_present_block_for))
return false;
- if (this.block != that.block)
+ if (this.block_for != that.block_for)
return false;
}
@@ -7125,10 +7125,10 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case BLOCK:
- if (field.type == TType.BOOL) {
- this.block = iprot.readBool();
- this.__isset.block = true;
+ case BLOCK_FOR:
+ if (field.type == TType.I32) {
+ this.block_for = iprot.readI32();
+ this.__isset.block_for = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -7168,8 +7168,8 @@
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(this.timestamp);
oprot.writeFieldEnd();
- oprot.writeFieldBegin(BLOCK_FIELD_DESC);
- oprot.writeBool(this.block);
+ oprot.writeFieldBegin(BLOCK_FOR_FIELD_DESC);
+ oprot.writeI32(this.block_for);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
@@ -7208,8 +7208,8 @@
sb.append(this.timestamp);
first = false;
if (!first) sb.append(", ");
- sb.append("block:");
- sb.append(this.block);
+ sb.append("block_for:");
+ sb.append(this.block_for);
first = false;
sb.append(")");
return sb.toString();
@@ -10574,23 +10574,23 @@
public static class batch_insert_superColumn_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("batch_insert_superColumn_args");
private static final TField BATCH_MUTATION_SUPER_FIELD_DESC = new TField("batchMutationSuper", TType.STRUCT, (short)1);
- private static final TField BLOCK_FIELD_DESC = new TField("block", TType.BOOL, (short)2);
+ private static final TField BLOCK_FOR_FIELD_DESC = new TField("block_for", TType.I32, (short)2);
public batch_mutation_super_t batchMutationSuper;
public static final int BATCHMUTATIONSUPER = 1;
- public boolean block;
- public static final int BLOCK = 2;
+ public int block_for;
+ public static final int BLOCK_FOR = 2;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
- public boolean block = false;
+ public boolean block_for = false;
}
public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
put(BATCHMUTATIONSUPER, new FieldMetaData("batchMutationSuper", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, batch_mutation_super_t.class)));
- put(BLOCK, new FieldMetaData("block", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
+ put(BLOCK_FOR, new FieldMetaData("block_for", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
}});
static {
@@ -10598,18 +10598,18 @@
}
public batch_insert_superColumn_args() {
- this.block = false;
+ this.block_for = 0;
}
public batch_insert_superColumn_args(
batch_mutation_super_t batchMutationSuper,
- boolean block)
+ int block_for)
{
this();
this.batchMutationSuper = batchMutationSuper;
- this.block = block;
- this.__isset.block = true;
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
/**
@@ -10619,8 +10619,8 @@
if (other.isSetBatchMutationSuper()) {
this.batchMutationSuper = new batch_mutation_super_t(other.batchMutationSuper);
}
- __isset.block = other.__isset.block;
- this.block = other.block;
+ __isset.block_for = other.__isset.block_for;
+ this.block_for = other.block_for;
}
@Override
@@ -10651,26 +10651,26 @@
}
}
- public boolean isBlock() {
- return this.block;
+ public int getBlock_for() {
+ return this.block_for;
}
- public void setBlock(boolean block) {
- this.block = block;
- this.__isset.block = true;
+ public void setBlock_for(int block_for) {
+ this.block_for = block_for;
+ this.__isset.block_for = true;
}
- public void unsetBlock() {
- this.__isset.block = false;
+ public void unsetBlock_for() {
+ this.__isset.block_for = false;
}
- // Returns true if field block is set (has been asigned a value) and false otherwise
- public boolean isSetBlock() {
- return this.__isset.block;
+ // Returns true if field block_for is set (has been asigned a value) and false otherwise
+ public boolean isSetBlock_for() {
+ return this.__isset.block_for;
}
- public void setBlockIsSet(boolean value) {
- this.__isset.block = value;
+ public void setBlock_forIsSet(boolean value) {
+ this.__isset.block_for = value;
}
public void setFieldValue(int fieldID, Object value) {
@@ -10683,11 +10683,11 @@
}
break;
- case BLOCK:
+ case BLOCK_FOR:
if (value == null) {
- unsetBlock();
+ unsetBlock_for();
} else {
- setBlock((Boolean)value);
+ setBlock_for((Integer)value);
}
break;
@@ -10701,8 +10701,8 @@
case BATCHMUTATIONSUPER:
return getBatchMutationSuper();
- case BLOCK:
- return new Boolean(isBlock());
+ case BLOCK_FOR:
+ return new Integer(getBlock_for());
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
@@ -10714,8 +10714,8 @@
switch (fieldID) {
case BATCHMUTATIONSUPER:
return isSetBatchMutationSuper();
- case BLOCK:
- return isSetBlock();
+ case BLOCK_FOR:
+ return isSetBlock_for();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
@@ -10743,12 +10743,12 @@
return false;
}
- boolean this_present_block = true;
- boolean that_present_block = true;
- if (this_present_block || that_present_block) {
- if (!(this_present_block && that_present_block))
+ boolean this_present_block_for = true;
+ boolean that_present_block_for = true;
+ if (this_present_block_for || that_present_block_for) {
+ if (!(this_present_block_for && that_present_block_for))
return false;
- if (this.block != that.block)
+ if (this.block_for != that.block_for)
return false;
}
@@ -10779,10 +10779,10 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case BLOCK:
- if (field.type == TType.BOOL) {
- this.block = iprot.readBool();
- this.__isset.block = true;
+ case BLOCK_FOR:
+ if (field.type == TType.I32) {
+ this.block_for = iprot.readI32();
+ this.__isset.block_for = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -10809,8 +10809,8 @@
this.batchMutationSuper.write(oprot);
oprot.writeFieldEnd();
}
- oprot.writeFieldBegin(BLOCK_FIELD_DESC);
- oprot.writeBool(this.block);
+ oprot.writeFieldBegin(BLOCK_FOR_FIELD_DESC);
+ oprot.writeI32(this.block_for);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
@@ -10829,8 +10829,8 @@
}
first = false;
if (!first) sb.append(", ");
- sb.append("block:");
- sb.append(this.block);
+ sb.append("block_for:");
+ sb.append(this.block_for);
first = false;
sb.append(")");
return sb.toString();
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Tue May 19 15:51:10 2009
@@ -188,7 +188,7 @@
// do the insert
thriftClient_.insert(tableName, key, columnFamily + ":" + columnName,
- value.getBytes(), System.currentTimeMillis(), true);
+ value.getBytes(), System.currentTimeMillis(), 1);
css_.out.println("Value inserted.");
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Tue May 19 15:51:10 2009
@@ -693,6 +693,11 @@
return replicationFactor_;
}
+ public static int getQuorum()
+ {
+ return (replicationFactor_ / 2) + 1;
+ }
+
public static long getRpcTimeout()
{
return rpcTimeoutInMillis_;
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java Tue May 19 15:51:10 2009
@@ -76,7 +76,7 @@
return instance_;
}
- private static boolean sendMessage(String endpointAddress, String key) throws DigestMismatchException, TimeoutException, IOException
+ private static boolean sendMessage(String endpointAddress, String key) throws DigestMismatchException, TimeoutException, IOException, InvalidRequestException
{
EndPoint endPoint = new EndPoint(endpointAddress, DatabaseDescriptor.getStoragePort());
if (!FailureDetector.instance().isAlive(endPoint))
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java Tue May 19 15:51:10 2009
@@ -294,7 +294,7 @@
return columns.size();
}
- public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, boolean block)
+ public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp, int block)
throws InvalidRequestException, UnavailableException
{
logger.debug("insert");
@@ -303,34 +303,20 @@
Set<String> cfNames = rm.columnFamilyNames();
validateCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
- if (block)
- {
- StorageProxy.insertBlocking(rm);
- }
- else
- {
- StorageProxy.insert(rm);
- }
+ doInsert(block, rm);
}
- public void batch_insert(batch_mutation_t batchMutation, boolean block) throws InvalidRequestException, UnavailableException
+ public void batch_insert(batch_mutation_t batchMutation, int block) throws InvalidRequestException, UnavailableException
{
logger.debug("batch_insert");
RowMutation rm = RowMutation.getRowMutation(batchMutation);
Set<String> cfNames = rm.columnFamilyNames();
validateCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
- if (block)
- {
- StorageProxy.insertBlocking(rm);
- }
- else
- {
- StorageProxy.insert(rm);
- }
+ doInsert(block, rm);
}
- public void remove(String tablename, String key, String columnFamily_column, long timestamp, boolean block)
+ public void remove(String tablename, String key, String columnFamily_column, long timestamp, int block)
throws InvalidRequestException, UnavailableException
{
logger.debug("remove");
@@ -338,15 +324,21 @@
rm.delete(columnFamily_column, timestamp);
Set<String> cfNames = rm.columnFamilyNames();
validateCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
- if (block)
+ doInsert(block, rm);
+ }
+
+ private void doInsert(int block, RowMutation rm)
+ throws UnavailableException
+ {
+ if (block>0)
{
- StorageProxy.insertBlocking(rm);
+ StorageProxy.insertBlocking(rm,block);
}
else
{
StorageProxy.insert(rm);
}
- }
+ }
public List<superColumn_t> get_slice_super_by_names(String tablename, String key, String columnFamily, List<String> superColumnNames) throws InvalidRequestException
{
@@ -416,20 +408,13 @@
return new superColumn_t(column.name(), thriftifyColumns(column.getSubColumns()));
}
- public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, boolean block) throws InvalidRequestException, UnavailableException
+ public void batch_insert_superColumn(batch_mutation_super_t batchMutationSuper, int block) throws InvalidRequestException, UnavailableException
{
logger.debug("batch_insert_SuperColumn");
RowMutation rm = RowMutation.getRowMutation(batchMutationSuper);
Set<String> cfNames = rm.columnFamilyNames();
validateCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
- if (block)
- {
- StorageProxy.insertBlocking(rm);
- }
- else
- {
- StorageProxy.insert(rm);
- }
+ doInsert(block, rm);
}
public String getStringProperty(String propertyName)
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java Tue May 19 15:51:10 2009
@@ -45,19 +45,18 @@
private List<Message> responses_ = new ArrayList<Message>();
private IResponseResolver<T> responseResolver_;
private AtomicBoolean done_ = new AtomicBoolean(false);
-
- public QuorumResponseHandler(int responseCount, IResponseResolver<T> responseResolver)
- {
+
+ public QuorumResponseHandler(int responseCount, IResponseResolver<T> responseResolver) throws InvalidRequestException
+ {
+ if (responseCount > DatabaseDescriptor.getReplicationFactor())
+ throw new InvalidRequestException("Cannot block for more than the replication factor of " + DatabaseDescriptor.getReplicationFactor());
+ if (responseCount < 1)
+ throw new InvalidRequestException("Cannot block for less than one replica");
condition_ = lock_.newCondition();
responseCount_ = responseCount;
responseResolver_ = responseResolver;
}
- public void setResponseCount(int responseCount)
- {
- responseCount_ = responseCount;
- }
-
public T get() throws TimeoutException, DigestMismatchException
{
lock_.lock();
@@ -102,12 +101,11 @@
{
lock_.lock();
try
- {
- int majority = (responseCount_ >> 1) + 1;
+ {
if ( !done_.get() )
{
responses_.add( message );
- if ( responses_.size() >= majority && responseResolver_.isDataPresent(responses_))
+ if ( responses_.size() >= responseCount_ && responseResolver_.isDataPresent(responses_))
{
done_.set(true);
condition_.signal();
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=776365&r1=776364&r2=776365&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Tue May 19 15:51:10 2009
@@ -134,8 +134,8 @@
writeStats.add(System.currentTimeMillis() - startTime);
}
}
-
- public static void insertBlocking(RowMutation rm) throws UnavailableException
+
+ public static void insertBlocking(RowMutation rm, int blockFor) throws UnavailableException
{
long startTime = System.currentTimeMillis();
Message message = null;
@@ -154,9 +154,7 @@
{
throw new UnavailableException();
}
- QuorumResponseHandler<Boolean> quorumResponseHandler = new QuorumResponseHandler<Boolean>(
- DatabaseDescriptor.getReplicationFactor(),
- new WriteResponseResolver());
+ QuorumResponseHandler<Boolean> quorumResponseHandler = new QuorumResponseHandler<Boolean>(blockFor, new WriteResponseResolver());
logger.debug("insertBlocking writing key " + rm.key() + " to " + message.getMessageId() + "@[" + StringUtils.join(endpoints, ", ") + "]");
MessagingService.getMessagingInstance().sendRR(message, endpoints, quorumResponseHandler);
@@ -173,6 +171,11 @@
writeStats.add(System.currentTimeMillis() - startTime);
}
}
+
+ public static void insertBlocking(RowMutation rm) throws UnavailableException
+ {
+ insertBlocking(rm, (DatabaseDescriptor.getReplicationFactor() >> 1) + 1);
+ }
private static Map<String, Message> constructMessages(Map<String, ReadCommand> readMessages) throws IOException
{
@@ -347,7 +350,7 @@
* a specific set of column names from a given column family.
*/
public static Row readProtocol(ReadCommand command, StorageService.ConsistencyLevel consistencyLevel)
- throws IOException, TimeoutException
+ throws IOException, TimeoutException, InvalidRequestException
{
long startTime = System.currentTimeMillis();
@@ -437,7 +440,7 @@
* 7. else carry out read repair by getting data from all the nodes.
// 5. return success
*/
- private static Row strongRead(ReadCommand command) throws IOException, TimeoutException
+ private static Row strongRead(ReadCommand command) throws IOException, TimeoutException, InvalidRequestException
{
// TODO: throw a thrift exception if we do not have N nodes
assert !command.isDigestQuery();
@@ -450,7 +453,7 @@
IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
QuorumResponseHandler<Row> quorumResponseHandler = new QuorumResponseHandler<Row>(
- DatabaseDescriptor.getReplicationFactor(),
+ DatabaseDescriptor.getQuorum(),
readResponseResolver);
EndPoint dataPoint = StorageService.instance().findSuitableEndPoint(command.key);
List<EndPoint> endpointList = new ArrayList<EndPoint>(Arrays.asList(StorageService.instance().getNStorageEndPoint(command.key)));
@@ -489,7 +492,7 @@
{
IResponseResolver<Row> readResponseResolverRepair = new ReadResponseResolver();
QuorumResponseHandler<Row> quorumResponseHandlerRepair = new QuorumResponseHandler<Row>(
- DatabaseDescriptor.getReplicationFactor(),
+ DatabaseDescriptor.getQuorum(),
readResponseResolverRepair);
logger.info("DigestMismatchException: " + command.key);
Message messageRepair = command.makeReadMessage();