Addressed review comments.

Changed naming for NewMin and NewAnd to MinV2 and AndV2
This commit is contained in:
Balachandar Namasivayam 2017-10-25 14:48:05 -07:00
parent 2f6d55a52f
commit 9dd588dcce
10 changed files with 35 additions and 35 deletions

View File

@ -25,7 +25,7 @@ and add it to your classpath.<br>
<h3>Getting started</h3> <h3>Getting started</h3>
To start using FoundationDB from Java, create an instance of the To start using FoundationDB from Java, create an instance of the
{@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the {@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the
API that you want to use (this release of the FoundationDB Java API supports only version {@code 510}). API that you want to use (this release of the FoundationDB Java API supports versions between {@code 500} and {@code 510}).
With this API object you can then open {@link com.apple.foundationdb.Cluster Cluster}s and With this API object you can then open {@link com.apple.foundationdb.Cluster Cluster}s and
{@link com.apple.foundationdb.Database Database}s and start using {@link com.apple.foundationdb.Database Database}s and start using
{@link com.apple.foundationdb.Transaction Transactions}s. {@link com.apple.foundationdb.Transaction Transactions}s.

View File

@ -25,7 +25,7 @@ and add it to your classpath.<br>
<h3>Getting started</h3> <h3>Getting started</h3>
To start using FoundationDB from Java, create an instance of the To start using FoundationDB from Java, create an instance of the
{@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the {@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the
API that you want to use (this release of the FoundationDB Java API supports only version {@code 510}). API that you want to use (this release of the FoundationDB Java API supports versions between {@code 500} and {@code 510}).
With this API object you can then open {@link com.apple.foundationdb.Cluster}s and With this API object you can then open {@link com.apple.foundationdb.Cluster}s and
{@link com.apple.foundationdb.Database}s and start using {@link com.apple.foundationdb.Database}s and start using
{@link com.apple.foundationdb.Transaction}s. Here we give an example. The example relies on a {@link com.apple.foundationdb.Transaction}s. Here we give an example. The example relies on a

View File

@ -62,7 +62,7 @@ static ValueRef doAnd(const Optional<ValueRef>& existingValueOptional, const Val
return StringRef(buf, i); return StringRef(buf, i);
} }
static ValueRef doNewAnd(const Optional<ValueRef>& existingValueOptional, const ValueRef& otherOperand, Arena& ar) { static ValueRef doAndV2(const Optional<ValueRef>& existingValueOptional, const ValueRef& otherOperand, Arena& ar) {
if (!existingValueOptional.present()) if (!existingValueOptional.present())
return otherOperand; return otherOperand;
@ -203,7 +203,7 @@ static ValueRef doMin(const Optional<ValueRef>& existingValueOptional, const Val
return otherOperand; return otherOperand;
} }
static ValueRef doNewMin(const Optional<ValueRef>& existingValueOptional, const ValueRef& otherOperand, Arena& ar) { static ValueRef doMinV2(const Optional<ValueRef>& existingValueOptional, const ValueRef& otherOperand, Arena& ar) {
if (!existingValueOptional.present()) if (!existingValueOptional.present())
return otherOperand; return otherOperand;

View File

@ -26,8 +26,8 @@
struct MutationRef { struct MutationRef {
static const int OVERHEAD_BYTES = 12; //12 is the size of Header in MutationList entries static const int OVERHEAD_BYTES = 12; //12 is the size of Header in MutationList entries
enum Type : uint8_t { SetValue=0, ClearRange, AddValue, DebugKeyRange, DebugKey, NoOp, And, Or, Xor, AppendIfFits, AvailableForReuse, Reserved_For_LogProtocolMessage /* See fdbserver/LogProtocolMessage.h */, Max, Min, SetVersionstampedKey, SetVersionstampedValue, ByteMin, ByteMax, NewMin, NewAnd, MAX_ATOMIC_OP }; enum Type : uint8_t { SetValue=0, ClearRange, AddValue, DebugKeyRange, DebugKey, NoOp, And, Or, Xor, AppendIfFits, AvailableForReuse, Reserved_For_LogProtocolMessage /* See fdbserver/LogProtocolMessage.h */, Max, Min, SetVersionstampedKey, SetVersionstampedValue, ByteMin, ByteMax, MinV2, AndV2, MAX_ATOMIC_OP };
const char * typeString[MAX_ATOMIC_OP] = { "SetValue", "ClearRange", "AddValue", "DebugKeyRange", "DebugKey", "NoOp", "And", "Or", "Xor", "AppendIfFits", "AvailableForReuse", "Reserved_For_LogProtocolMessage", "Max", "Min", "SetVersionstampedKey", "SetVersionstampedValue", "ByteMin", "ByteMax", "NewMin", "NewAnd" }; const char * typeString[MAX_ATOMIC_OP] = { "SetValue", "ClearRange", "AddValue", "DebugKeyRange", "DebugKey", "NoOp", "And", "Or", "Xor", "AppendIfFits", "AvailableForReuse", "Reserved_For_LogProtocolMessage", "Max", "Min", "SetVersionstampedKey", "SetVersionstampedValue", "ByteMin", "ByteMax", "MinV2", "AndV2" };
// This is stored this way for serialization purposes. // This is stored this way for serialization purposes.
uint8_t type; uint8_t type;
StringRef param1, param2; StringRef param1, param2;
@ -54,9 +54,9 @@ struct MutationRef {
// These masks define which mutation types have particular properties (they are used to implement isSingleKeyMutation() etc) // These masks define which mutation types have particular properties (they are used to implement isSingleKeyMutation() etc)
enum { enum {
ATOMIC_MASK = (1 << AddValue) | (1 << And) | (1 << Or) | (1 << Xor) | (1 << AppendIfFits) | (1 << Max) | (1 << Min) | (1 << SetVersionstampedKey) | (1 << SetVersionstampedValue) | (1 << ByteMin) | (1 << ByteMax) | (1 << NewMin) | (1 << NewAnd), ATOMIC_MASK = (1 << AddValue) | (1 << And) | (1 << Or) | (1 << Xor) | (1 << AppendIfFits) | (1 << Max) | (1 << Min) | (1 << SetVersionstampedKey) | (1 << SetVersionstampedValue) | (1 << ByteMin) | (1 << ByteMax) | (1 << MinV2) | (1 << AndV2),
SINGLE_KEY_MASK = ATOMIC_MASK | (1<<SetValue), SINGLE_KEY_MASK = ATOMIC_MASK | (1<<SetValue),
NON_ASSOCIATIVE_MASK = (1 << AddValue) | (1 << Or) | (1 << Xor) | (1 << Max) | (1 << Min) | (1 << SetVersionstampedKey) | (1 << SetVersionstampedValue) | (1 << NewMin) NON_ASSOCIATIVE_MASK = (1 << AddValue) | (1 << Or) | (1 << Xor) | (1 << Max) | (1 << Min) | (1 << SetVersionstampedKey) | (1 << SetVersionstampedValue) | (1 << MinV2)
}; };
}; };

View File

@ -2208,9 +2208,9 @@ void Transaction::atomicOp(const KeyRef& key, const ValueRef& operand, MutationR
if (apiVersionAtLeast(510)) { if (apiVersionAtLeast(510)) {
if (operationType == MutationRef::Min) if (operationType == MutationRef::Min)
operationType = MutationRef::NewMin; operationType = MutationRef::MinV2;
else if (operationType == MutationRef::And) else if (operationType == MutationRef::And)
operationType = MutationRef::NewAnd; operationType = MutationRef::AndV2;
} }
auto &req = tr; auto &req = tr;
auto &t = req.transaction; auto &t = req.transaction;

View File

@ -1419,8 +1419,8 @@ void ReadYourWritesTransaction::writeRangeToNativeTransaction( KeyRangeRef const
case MutationRef::SetVersionstampedValue: case MutationRef::SetVersionstampedValue:
case MutationRef::ByteMin: case MutationRef::ByteMin:
case MutationRef::ByteMax: case MutationRef::ByteMax:
case MutationRef::NewMin: case MutationRef::MinV2:
case MutationRef::NewAnd: case MutationRef::AndV2:
tr.atomicOp( it.beginKey().assertRef(), op[i].value.get(), op[i].type, false ); tr.atomicOp( it.beginKey().assertRef(), op[i].value.get(), op[i].type, false );
break; break;
default: default:
@ -1494,9 +1494,9 @@ void ReadYourWritesTransaction::atomicOp( const KeyRef& key, const ValueRef& ope
if (tr.apiVersionAtLeast(510)) { if (tr.apiVersionAtLeast(510)) {
if (operationType == MutationRef::Min) if (operationType == MutationRef::Min)
operationType = MutationRef::NewMin; operationType = MutationRef::MinV2;
else if (operationType == MutationRef::And) else if (operationType == MutationRef::And)
operationType = MutationRef::NewAnd; operationType = MutationRef::AndV2;
} }
if(options.readYourWritesDisabled) { if(options.readYourWritesDisabled) {

View File

@ -475,22 +475,22 @@ public:
throw operation_failed(); throw operation_failed();
} }
} }
else if (newEntry.type == MutationRef::NewMin) { else if (newEntry.type == MutationRef::MinV2) {
switch (existingEntry.type) { switch (existingEntry.type) {
case MutationRef::SetValue: case MutationRef::SetValue:
return RYWMutation(doNewMin(existingEntry.value, newEntry.value.get(), arena), MutationRef::SetValue); return RYWMutation(doMinV2(existingEntry.value, newEntry.value.get(), arena), MutationRef::SetValue);
case MutationRef::NewMin: case MutationRef::MinV2:
return RYWMutation(doNewMin(existingEntry.value, newEntry.value.get(), arena), MutationRef::NewMin); return RYWMutation(doMinV2(existingEntry.value, newEntry.value.get(), arena), MutationRef::MinV2);
default: default:
throw operation_failed(); throw operation_failed();
} }
} }
else if (newEntry.type == MutationRef::NewAnd) { else if (newEntry.type == MutationRef::AndV2) {
switch (existingEntry.type) { switch (existingEntry.type) {
case MutationRef::SetValue: case MutationRef::SetValue:
return RYWMutation(doNewAnd(existingEntry.value, newEntry.value.get(), arena), MutationRef::SetValue); return RYWMutation(doAndV2(existingEntry.value, newEntry.value.get(), arena), MutationRef::SetValue);
case MutationRef::NewAnd: case MutationRef::AndV2:
return RYWMutation(doNewAnd(existingEntry.value, newEntry.value.get(), arena), MutationRef::NewAnd); return RYWMutation(doAndV2(existingEntry.value, newEntry.value.get(), arena), MutationRef::AndV2);
default: default:
throw operation_failed(); throw operation_failed();
} }

View File

@ -1502,11 +1502,11 @@ bool expandMutation( MutationRef& m, StorageServer::VersionedData const& data, U
case MutationRef::ByteMax: case MutationRef::ByteMax:
m.param2 = doByteMax(oldVal, m.param2, ar); m.param2 = doByteMax(oldVal, m.param2, ar);
break; break;
case MutationRef::NewMin: case MutationRef::MinV2:
m.param2 = doNewMin(oldVal, m.param2, ar); m.param2 = doMinV2(oldVal, m.param2, ar);
break; break;
case MutationRef::NewAnd: case MutationRef::AndV2:
m.param2 = doNewAnd(oldVal, m.param2, ar); m.param2 = doAndV2(oldVal, m.param2, ar);
break; break;
} }
m.type = MutationRef::SetValue; m.type = MutationRef::SetValue;

View File

@ -554,7 +554,7 @@ struct WriteDuringReadWorkload : TestWorkload {
else if (type == MutationRef::AppendIfFits) else if (type == MutationRef::AppendIfFits)
return doAppendIfFits(existingValue, value, arena); return doAppendIfFits(existingValue, value, arena);
else if (type == MutationRef::And) else if (type == MutationRef::And)
return doNewAnd(existingValue, value, arena); return doAndV2(existingValue, value, arena);
else if (type == MutationRef::Or) else if (type == MutationRef::Or)
return doOr(existingValue, value, arena); return doOr(existingValue, value, arena);
else if (type == MutationRef::Xor) else if (type == MutationRef::Xor)
@ -562,15 +562,15 @@ struct WriteDuringReadWorkload : TestWorkload {
else if (type == MutationRef::Max) else if (type == MutationRef::Max)
return doMax(existingValue, value, arena); return doMax(existingValue, value, arena);
else if (type == MutationRef::Min) else if (type == MutationRef::Min)
return doNewMin(existingValue, value, arena); return doMinV2(existingValue, value, arena);
else if (type == MutationRef::ByteMin) else if (type == MutationRef::ByteMin)
return doByteMin(existingValue, value, arena); return doByteMin(existingValue, value, arena);
else if (type == MutationRef::ByteMax) else if (type == MutationRef::ByteMax)
return doByteMax(existingValue, value, arena); return doByteMax(existingValue, value, arena);
else if (type == MutationRef::NewMin) else if (type == MutationRef::MinV2)
return doNewMin(existingValue, value, arena); return doMinV2(existingValue, value, arena);
else if (type == MutationRef::NewAnd) else if (type == MutationRef::AndV2)
return doNewAnd(existingValue, value, arena); return doAndV2(existingValue, value, arena);
ASSERT(false); ASSERT(false);
return Value(); return Value();
} }
@ -764,10 +764,10 @@ struct WriteDuringReadWorkload : TestWorkload {
opType = MutationRef::ByteMax; opType = MutationRef::ByteMax;
break; break;
case 8: case 8:
opType = MutationRef::NewMin; opType = MutationRef::MinV2;
break; break;
case 9: case 9:
opType = MutationRef::NewAnd; opType = MutationRef::AndV2;
break; break;
} }
self->changeCount.insert( key, changeNum++ ); self->changeCount.insert( key, changeNum++ );

View File

@ -51,7 +51,7 @@ using namespace boost::asio::ip;
// These impact both communications and the deserialization of certain zookeeper, database and IKeyValueStore keys // These impact both communications and the deserialization of certain zookeeper, database and IKeyValueStore keys
// xyzdev // xyzdev
// vvvv // vvvv
uint64_t currentProtocolVersion = 0x0FDB00A551010001LL; uint64_t currentProtocolVersion = 0x0FDB00A551020001LL;
uint64_t compatibleProtocolVersionMask = 0xffffffffffff0000LL; uint64_t compatibleProtocolVersionMask = 0xffffffffffff0000LL;
uint64_t minValidProtocolVersion = 0x0FDB00A200060001LL; uint64_t minValidProtocolVersion = 0x0FDB00A200060001LL;