add APPEND_IF_FITS to workload and remove guard ; add command to vexillographer
This commit is contained in:
parent
ac1f3a20e8
commit
218b7a41e2
|
@ -1479,7 +1479,7 @@ void ReadYourWritesTransaction::atomicOp( const KeyRef& key, const ValueRef& ope
|
|||
if(key >= getMaxWriteKey())
|
||||
throw key_outside_legal_range();
|
||||
|
||||
if(!isValidMutationType(operationType) || !isAtomicOp((MutationRef::Type) operationType) || operationType == MutationRef::AppendIfFits)
|
||||
if(!isValidMutationType(operationType) || !isAtomicOp((MutationRef::Type) operationType))
|
||||
throw invalid_mutation_type();
|
||||
|
||||
if(key.size() > (key.startsWith(systemKeys.begin) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT : CLIENT_KNOBS->KEY_SIZE_LIMIT))
|
||||
|
@ -1898,4 +1898,4 @@ void ReadYourWritesTransaction::debugLogRetries(Optional<Error> error) {
|
|||
transactionDebugInfo->lastRetryLogTime = now();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,6 +217,9 @@ description is not currently required but encouraged.
|
|||
<Option name="bit_xor" code="8"
|
||||
paramType="Bytes" paramDescription="value with which to perform bitwise xor"
|
||||
description="Performs a bitwise ``xor`` operation. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``."/>
|
||||
<Option name="append_if_fits" code="9"
|
||||
paramType="Bytes" paramDescription="value to append to the database value"
|
||||
description="Append the value provided to the end of the existing value already in the database at the given key. This will only append the value if the final value is less than or equal to the maximum value size. Warning: However, no error is surfaced back to the user because the mutation will not be applied until after the transaction has been committed. Therefore, it is only safe to use this mutation type if one can guarantee that one will keep the total value under the maximum size."/>
|
||||
<Option name="max" code="12"
|
||||
paramType="Bytes" paramDescription="value to check against database value"
|
||||
description="Performs a little-endian comparison of byte strings. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. The larger of the two values is then stored in the database."/>
|
||||
|
|
|
@ -862,7 +862,7 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
|
|||
std::make_pair( error_code_key_too_large, ExceptionContract::requiredIf(key.size() > (key.startsWith(systemKeys.begin) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT : CLIENT_KNOBS->KEY_SIZE_LIMIT)) ),
|
||||
std::make_pair( error_code_value_too_large, ExceptionContract::requiredIf(value.size() > CLIENT_KNOBS->VALUE_SIZE_LIMIT) ),
|
||||
std::make_pair( error_code_invalid_mutation_type, ExceptionContract::requiredIf(
|
||||
!isValidMutationType(op) || !isAtomicOp((MutationRef::Type) op) || op == MutationRef::AppendIfFits ) ),
|
||||
!isValidMutationType(op) || !isAtomicOp((MutationRef::Type) op)) ),
|
||||
std::make_pair( error_code_key_outside_legal_range, ExceptionContract::requiredIf(
|
||||
(key >= (workload->useSystemKeys ? systemKeys.end : normalKeys.end))) ),
|
||||
std::make_pair( error_code_client_invalid_operation, ExceptionContract::requiredIf(
|
||||
|
|
|
@ -138,7 +138,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
|
||||
try {
|
||||
for(i = 0; i < g_random->randomInt(self->minOperationsPerTransaction,self->maxOperationsPerTransaction+1); i++) {
|
||||
j = g_random->randomInt(0,15);
|
||||
j = g_random->randomInt(0,16);
|
||||
if( j < 3 ) {
|
||||
myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
|
@ -237,30 +237,30 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
//else if( j < 8 ) {
|
||||
// myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
// myRandomIDKey = format( "%010d", g_random->randomInt(0, 1000000000) );
|
||||
// myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
// //TraceEvent("RYOWappendIfFits").detail("Key",myKeyA).detail("Value", myValue);
|
||||
// trRYOW.atomicOp(StringRef(clientID + "b/" + myKeyA), myValue, MutationRef::AppendIfFits);
|
||||
//
|
||||
// loop {
|
||||
// try {
|
||||
// tr.set(StringRef(clientID + "z/" + myRandomIDKey), StringRef());
|
||||
// tr.atomicOp(StringRef(clientID + "d/" + myKeyA), myValue, MutationRef::AppendIfFits);
|
||||
// Void _ = wait( tr.commit() );
|
||||
// break;
|
||||
// } catch (Error& e) {
|
||||
// error = e;
|
||||
// Void _ = wait( tr.onError(e) );
|
||||
// if(error.code() == error_code_commit_unknown_result) {
|
||||
// Optional<Value> thing = wait(tr.get(StringRef(clientID+"z/"+myRandomIDKey)));
|
||||
// if (thing.present()) break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
else if( j < 8 ) {
|
||||
myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
myRandomIDKey = format( "%010d", g_random->randomInt(0, 1000000000) );
|
||||
myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
//TraceEvent("RYOWappendIfFits").detail("Key",myKeyA).detail("Value", myValue);
|
||||
trRYOW.atomicOp(StringRef(clientID + "b/" + myKeyA), myValue, MutationRef::AppendIfFits);
|
||||
|
||||
loop {
|
||||
try {
|
||||
tr.set(StringRef(clientID + "z/" + myRandomIDKey), StringRef());
|
||||
tr.atomicOp(StringRef(clientID + "d/" + myKeyA), myValue, MutationRef::AppendIfFits);
|
||||
Void _ = wait( tr.commit() );
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
error = e;
|
||||
Void _ = wait( tr.onError(e) );
|
||||
if(error.code() == error_code_commit_unknown_result) {
|
||||
Optional<Value> thing = wait(tr.get(StringRef(clientID+"z/"+myRandomIDKey)));
|
||||
if (thing.present()) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( j < 9 ) {
|
||||
myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
myRandomIDKey = format( "%010d", g_random->randomInt(0, 1000000000) );
|
||||
myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
|
@ -283,7 +283,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( j < 9 ) {
|
||||
else if( j < 10 ) {
|
||||
myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
myRandomIDKey = format( "%010d", g_random->randomInt(0, 1000000000) );
|
||||
myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
|
@ -306,7 +306,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( j < 10 ) {
|
||||
else if( j < 11 ) {
|
||||
myKeyA = format( "%010d", g_random->randomInt( 0, self->maxKeySpace+1 ) );
|
||||
myRandomIDKey = format( "%010d", g_random->randomInt(0, 1000000000) );
|
||||
myValue = format("%d", g_random->randomInt( 0, 10000000 ) );
|
||||
|
@ -329,7 +329,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (j < 11) {
|
||||
else if (j < 12) {
|
||||
myKeyA = format("%010d", g_random->randomInt(0, self->maxKeySpace + 1));
|
||||
myRandomIDKey = format("%010d", g_random->randomInt(0, 1000000000));
|
||||
myValue = format("%d", g_random->randomInt(0, 10000000));
|
||||
|
@ -353,7 +353,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (j < 12) {
|
||||
else if (j < 13) {
|
||||
myKeyA = format("%010d", g_random->randomInt(0, self->maxKeySpace + 1));
|
||||
myRandomIDKey = format("%010d", g_random->randomInt(0, 1000000000));
|
||||
myValue = format("%d", g_random->randomInt(0, 10000000));
|
||||
|
@ -377,7 +377,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (j < 13) {
|
||||
else if (j < 14) {
|
||||
myKeyA = format("%010d", g_random->randomInt(0, self->maxKeySpace + 1));
|
||||
myRandomIDKey = format("%010d", g_random->randomInt(0, 1000000000));
|
||||
myValue = format("%d", g_random->randomInt(0, 10000000));
|
||||
|
@ -401,7 +401,7 @@ struct RandomSelectorWorkload : TestWorkload {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (j < 14) {
|
||||
else if (j < 15) {
|
||||
myKeyA = format("%010d", g_random->randomInt(0, self->maxKeySpace + 1));
|
||||
myRandomIDKey = format("%010d", g_random->randomInt(0, 1000000000));
|
||||
myValue = format("%d", g_random->randomInt(0, 10000000));
|
||||
|
|
Loading…
Reference in New Issue