diff --git a/bindings/flow/tester/Tester.actor.cpp b/bindings/flow/tester/Tester.actor.cpp index 29b2d419e4..622800f1aa 100644 --- a/bindings/flow/tester/Tester.actor.cpp +++ b/bindings/flow/tester/Tester.actor.cpp @@ -1542,6 +1542,26 @@ struct UnitTestsFunc : InstructionFunc { } API::selectAPIVersion(fdb->getAPIVersion()); + const uint64_t locationCacheSize = 100001; + const uint64_t maxWatches = 10001; + const uint64_t timeout = 60*1000; + const uint64_t noTimeout = 0; + const uint64_t retryLimit = 50; + const uint64_t noRetryLimit = -1; + const uint64_t maxRetryDelay = 100; + + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_LOCATION_CACHE_SIZE, Optional(StringRef((const uint8_t*)&locationCacheSize, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_MAX_WATCHES, Optional(StringRef((const uint8_t*)&maxWatches, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_DATACENTER_ID, Optional(LiteralStringRef("dc_id"))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_MACHINE_ID, Optional(LiteralStringRef("machine_id"))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_TIMEOUT, Optional(StringRef((const uint8_t*)&timeout, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_TIMEOUT, Optional(StringRef((const uint8_t*)&noTimeout, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_MAX_RETRY_DELAY, Optional(StringRef((const uint8_t*)&maxRetryDelay, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_RETRY_LIMIT, Optional(StringRef((const uint8_t*)&retryLimit, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_RETRY_LIMIT, Optional(StringRef((const uint8_t*)&noRetryLimit, 8))); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_ENABLE); + data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_DISABLE); + state Reference tr = data->db->createTransaction(); tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE); tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE); @@ -1551,11 +1571,8 @@ struct UnitTestsFunc : InstructionFunc { tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE); tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_SYSTEM_KEYS); tr->setOption(FDBTransactionOption::FDB_TR_OPTION_ACCESS_SYSTEM_KEYS); - const uint64_t timeout = 60*1000; tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TIMEOUT, Optional(StringRef((const uint8_t*)&timeout, 8))); - const uint64_t retryLimit = 50; tr->setOption(FDBTransactionOption::FDB_TR_OPTION_RETRY_LIMIT, Optional(StringRef((const uint8_t*)&retryLimit, 8))); - const uint64_t maxRetryDelay = 100; tr->setOption(FDBTransactionOption::FDB_TR_OPTION_MAX_RETRY_DELAY, Optional(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(LiteralStringRef("my_transaction"))); diff --git a/bindings/go/src/_stacktester/stacktester.go b/bindings/go/src/_stacktester/stacktester.go index 5d1f63f1d8..5b5d988e6b 100644 --- a/bindings/go/src/_stacktester/stacktester.go +++ b/bindings/go/src/_stacktester/stacktester.go @@ -791,6 +791,15 @@ func (sm *StackMachine) processInst(idx int, inst tuple.Tuple) { case op == "UNIT_TESTS": db.Options().SetLocationCacheSize(100001) db.Options().SetMaxWatches(10001) + db.Options().SetDatacenterId("dc_id") + db.Options().SetMachineId("machine_id") + db.Options().SetTransactionTimeout(100000) + db.Options().SetTransactionTimeout(0) + db.Options().SetTransactionMaxRetryDelay(100) + db.Options().SetTransactionRetryLimit(10) + db.Options().SetTransactionRetryLimit(-1) + db.Options().SetSnapshotRywEnable() + db.Options().SetSnapshotRywDisable() if !fdb.IsAPIVersionSelected() { log.Fatal("API version should be selected") diff --git a/bindings/java/src/test/com/apple/foundationdb/test/AsyncStackTester.java b/bindings/java/src/test/com/apple/foundationdb/test/AsyncStackTester.java index c968e856bc..6e2b6e9318 100644 --- a/bindings/java/src/test/com/apple/foundationdb/test/AsyncStackTester.java +++ b/bindings/java/src/test/com/apple/foundationdb/test/AsyncStackTester.java @@ -475,6 +475,20 @@ public class AsyncStackTester { throw e; } } + + Database db = tr.getDatabase(); + db.options().setLocationCacheSize(100001); + db.options().setMaxWatches(10001); + db.options().setDatacenterId("dc_id"); + db.options().setMachineId("machine_id"); + db.options().setTransactionTimeout(100000); + db.options().setTransactionTimeout(0); + db.options().setTransactionMaxRetryDelay(100); + db.options().setTransactionRetryLimit(10); + db.options().setTransactionRetryLimit(-1); + db.options().setSnapshotRywEnable(); + db.options().setSnapshotRywDisable(); + tr.options().setPrioritySystemImmediate(); tr.options().setPriorityBatch(); tr.options().setCausalReadRisky(); diff --git a/bindings/java/src/test/com/apple/foundationdb/test/StackTester.java b/bindings/java/src/test/com/apple/foundationdb/test/StackTester.java index 15678dd5ed..20c9770bc2 100644 --- a/bindings/java/src/test/com/apple/foundationdb/test/StackTester.java +++ b/bindings/java/src/test/com/apple/foundationdb/test/StackTester.java @@ -429,6 +429,19 @@ public class StackTester { } } + Database db = tr.getDatabase(); + db.options().setLocationCacheSize(100001); + db.options().setMaxWatches(10001); + db.options().setDatacenterId("dc_id"); + db.options().setMachineId("machine_id"); + db.options().setTransactionTimeout(100000); + db.options().setTransactionTimeout(0); + db.options().setTransactionMaxRetryDelay(100); + db.options().setTransactionRetryLimit(10); + db.options().setTransactionRetryLimit(-1); + db.options().setSnapshotRywEnable(); + db.options().setSnapshotRywDisable(); + tr.options().setPrioritySystemImmediate(); tr.options().setPriorityBatch(); tr.options().setCausalReadRisky(); diff --git a/bindings/python/tests/tester.py b/bindings/python/tests/tester.py index 0f733b401b..840b074eb6 100644 --- a/bindings/python/tests/tester.py +++ b/bindings/python/tests/tester.py @@ -123,6 +123,20 @@ class Instruction: self.stack.push(self.index, val) +def test_db_options(db): + db.options.set_max_watches(100001) + db.options.set_datacenter_id("dc_id") + db.options.set_machine_id("machine_id") + db.options.set_transaction_timeout(100000) + db.options.set_transaction_timeout(0) + db.options.set_transaction_timeout(0) + db.options.set_transaction_max_retry_delay(100) + db.options.set_transaction_retry_limit(10) + db.options.set_transaction_retry_limit(-1) + db.options.set_snapshot_ryw_enable() + db.options.set_snapshot_ryw_disable() + + @fdb.transactional def test_options(tr): tr.options.set_priority_system_immediate() @@ -528,6 +542,7 @@ class Tester: try: db.options.set_location_cache_size(100001) + test_db_options(db) test_options(db) test_watches(db) test_cancellation(db) diff --git a/bindings/ruby/tests/tester.rb b/bindings/ruby/tests/tester.rb index dce92720ac..54303075db 100755 --- a/bindings/ruby/tests/tester.rb +++ b/bindings/ruby/tests/tester.rb @@ -453,6 +453,16 @@ class Tester FDB::api_version(api_version) begin @db.options.set_location_cache_size(100001) + @db.options.set_max_watches(10001) + @db.options.set_datacenter_id("dc_id") + @db.options.set_machine_id("machine_id") + @db.options.set_transaction_timeout(100000) + @db.options.set_transaction_timeout(0) + @db.options.set_transaction_max_retry_delay(100) + @db.options.set_transaction_retry_limit(10) + @db.options.set_transaction_retry_limit(-1) + @db.options.set_snapshot_ryw_enable() + @db.options.set_snapshot_ryw_disable() @db.transact do |tr| tr.options.set_priority_system_immediate