Merge pull request #192 from cie/bindingtester-ro-lock-aware-option
<rdar://problem/34579176> Transaction option for read-only lock aware
This commit is contained in:
commit
93be673e20
|
@ -1506,10 +1506,37 @@ REGISTER_INSTRUCTION_FUNC(AtomicOPFunc);
|
|||
struct UnitTestsFunc : InstructionFunc {
|
||||
static const char* name;
|
||||
|
||||
static Future<Void> call(Reference<FlowTesterData> const& data, Reference<InstructionData> const& instruction) {
|
||||
ACTOR static Future<Void> call(Reference<FlowTesterData> data, Reference<InstructionData> instruction) {
|
||||
ASSERT(data->api->evaluatePredicate(FDBErrorPredicate::FDB_ERROR_PREDICATE_RETRYABLE, Error(1020)));
|
||||
ASSERT(!data->api->evaluatePredicate(FDBErrorPredicate::FDB_ERROR_PREDICATE_RETRYABLE, Error(10)));
|
||||
|
||||
state Reference<Transaction> tr(new Transaction(data->db));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_BATCH);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_CAUSAL_READ_RISKY);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_CAUSAL_WRITE_RISKY);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_AHEAD_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_ACCESS_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_DURABILITY_DEV_NULL_IS_WEB_SCALE);
|
||||
const uint64_t timeout = 60*1000;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TIMEOUT, Optional<StringRef>(StringRef((const uint8_t*)&timeout, 8)));
|
||||
const uint64_t retryLimit = 50;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_RETRY_LIMIT, Optional<StringRef>(StringRef((const uint8_t*)&retryLimit, 8)));
|
||||
const uint64_t maxRetryDelay = 100;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_MAX_RETRY_DELAY, Optional<StringRef>(StringRef((const uint8_t*)&maxRetryDelay, 8)));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_USED_DURING_COMMIT_PROTECTION_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TRANSACTION_LOGGING_ENABLE, Optional<StringRef>(LiteralStringRef("my_transaction")));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_LOCK_AWARE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_LOCK_AWARE);
|
||||
|
||||
Optional<FDBStandalone<ValueRef> > _ = wait(tr->get(LiteralStringRef("\xff")));
|
||||
tr->cancel();
|
||||
|
||||
return Void();
|
||||
|
||||
}
|
||||
};
|
||||
const char* UnitTestsFunc::name = "UNIT_TESTS";
|
||||
|
|
|
@ -745,6 +745,8 @@ func (sm *StackMachine) processInst(idx int, inst tuple.Tuple) {
|
|||
tr.Options().SetMaxRetryDelay(100)
|
||||
tr.Options().SetUsedDuringCommitProtectionDisable()
|
||||
tr.Options().SetTransactionLoggingEnable("my_transaction")
|
||||
tr.Options().SetReadLockAware()
|
||||
tr.Options().SetLockAware()
|
||||
|
||||
return tr.Get(fdb.Key("\xff")).MustGet(), nil
|
||||
})
|
||||
|
|
|
@ -593,6 +593,8 @@ public class AsyncStackTester {
|
|||
tr.options().setMaxRetryDelay(100);
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
tr.options().setTransactionLoggingEnable("my_transaction");
|
||||
tr.options().setReadLockAware();
|
||||
tr.options().setLockAware();
|
||||
|
||||
if(!(new FDBException("Fake", 1020)).isRetryable() ||
|
||||
(new FDBException("Fake", 10)).isRetryable())
|
||||
|
|
|
@ -408,6 +408,8 @@ public class StackTester {
|
|||
tr.options().setMaxRetryDelay(100);
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
tr.options().setTransactionLoggingEnable("my_transaction");
|
||||
tr.options().setReadLockAware();
|
||||
tr.options().setLockAware();
|
||||
|
||||
if(!(new FDBException("Fake", 1020)).isRetryable() ||
|
||||
(new FDBException("Fake", 10)).isRetryable())
|
||||
|
|
|
@ -632,6 +632,8 @@ public class AsyncStackTester {
|
|||
tr.options().setMaxRetryDelay(100);
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
tr.options().setTransactionLoggingEnable("my_transaction");
|
||||
tr.options().setReadLockAware();
|
||||
tr.options().setLockAware();
|
||||
|
||||
if(!(new FDBException("Fake", 1020)).isRetryable() ||
|
||||
(new FDBException("Fake", 10)).isRetryable())
|
||||
|
|
|
@ -439,6 +439,8 @@ public class StackTester {
|
|||
tr.options().setMaxRetryDelay(100);
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
tr.options().setTransactionLoggingEnable("my_transaction");
|
||||
tr.options().setReadLockAware();
|
||||
tr.options().setLockAware();
|
||||
|
||||
if(!(new FDBException("Fake", 1020)).isRetryable() ||
|
||||
(new FDBException("Fake", 10)).isRetryable())
|
||||
|
|
|
@ -719,6 +719,8 @@ function processOperation(context, inst, cb) {
|
|||
tr.options.setMaxRetryDelay(100);
|
||||
tr.options.setUsedDuringCommitProtectionDisable();
|
||||
tr.options.setTransactionLoggingEnable('my_transaction');
|
||||
tr.options.setReadLockAware()
|
||||
tr.options.setLockAware()
|
||||
|
||||
tr.get(fdb.buffer.fromByteLiteral('\xff'), innerCb);
|
||||
})
|
||||
|
|
|
@ -135,6 +135,8 @@ def test_options(tr):
|
|||
tr.options.set_max_retry_delay(100);
|
||||
tr.options.set_used_during_commit_protection_disable()
|
||||
tr.options.set_transaction_logging_enable('my_transaction')
|
||||
tr.options.set_read_lock_aware()
|
||||
tr.options.set_lock_aware()
|
||||
|
||||
tr.get(b'\xff').wait()
|
||||
|
||||
|
|
|
@ -445,6 +445,8 @@ class Tester
|
|||
tr.options.set_max_retry_delay(100)
|
||||
tr.options.set_used_during_commit_protection_disable
|
||||
tr.options.set_transaction_logging_enable('my_transaction')
|
||||
tr.options.set_read_lock_aware()
|
||||
tr.options.set_lock_aware()
|
||||
|
||||
tr.get("\xff").to_s
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue