From 02de53160dc13125fa6be607143e4e5ae6cdda2b Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Fri, 12 Jul 2019 17:58:16 -0700 Subject: [PATCH] only skip confirm epoch live if CAUSAL_READ_RISKY is enabled time checked on the proxy should be less than the time waited by the master to account for clock speed differences setting REQUIRED_MIN_RECOVERY_DURATION and ENFORCED_MIN_RECOVERY_DURATION to 0 will go back to the old behavior --- bindings/flow/tester/Tester.actor.cpp | 1 + bindings/python/tests/tester.py | 1 + bindings/ruby/tests/tester.rb | 1 + documentation/sphinx/source/api-c.rst | 2 ++ documentation/sphinx/source/api-common.rst.inc | 6 +++++- documentation/sphinx/source/api-python.rst | 6 ++++++ documentation/sphinx/source/api-ruby.rst | 6 ++++++ documentation/sphinx/source/data-modeling.rst | 2 ++ documentation/sphinx/source/developer-guide.rst | 2 ++ fdbclient/NativeAPI.actor.cpp | 2 +- fdbclient/vexillographer/fdb.options | 5 ++++- fdbserver/Knobs.cpp | 5 +++-- fdbserver/Knobs.h | 5 +++-- fdbserver/MasterProxyServer.actor.cpp | 14 +++++++++----- fdbserver/masterserver.actor.cpp | 2 +- 15 files changed, 47 insertions(+), 13 deletions(-) diff --git a/bindings/flow/tester/Tester.actor.cpp b/bindings/flow/tester/Tester.actor.cpp index fa309a59e8..2cb69c4c79 100644 --- a/bindings/flow/tester/Tester.actor.cpp +++ b/bindings/flow/tester/Tester.actor.cpp @@ -1562,6 +1562,7 @@ struct UnitTestsFunc : InstructionFunc { data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_TRANSACTION_SIZE_LIMIT, Optional(StringRef((const uint8_t*)&sizeLimit, 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_CAUSAL_READ_RISKY); data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_ENABLE); data->db->setDatabaseOption(FDBDatabaseOption::FDB_DB_OPTION_SNAPSHOT_RYW_DISABLE); diff --git a/bindings/python/tests/tester.py b/bindings/python/tests/tester.py index 95aa36ea3e..4cb9d1dbd3 100644 --- a/bindings/python/tests/tester.py +++ b/bindings/python/tests/tester.py @@ -138,6 +138,7 @@ def test_db_options(db): db.options.set_transaction_size_limit(100000) db.options.set_transaction_retry_limit(10) db.options.set_transaction_retry_limit(-1) + db.options.set_causal_read_risky() db.options.set_snapshot_ryw_enable() db.options.set_snapshot_ryw_disable() diff --git a/bindings/ruby/tests/tester.rb b/bindings/ruby/tests/tester.rb index 829ecf8a5f..45e82df861 100755 --- a/bindings/ruby/tests/tester.rb +++ b/bindings/ruby/tests/tester.rb @@ -462,6 +462,7 @@ class Tester @db.options.set_transaction_size_limit(100000) @db.options.set_transaction_retry_limit(10) @db.options.set_transaction_retry_limit(-1) + @db.options.set_causal_read_risky() @db.options.set_snapshot_ryw_enable() @db.options.set_snapshot_ryw_disable() diff --git a/documentation/sphinx/source/api-c.rst b/documentation/sphinx/source/api-c.rst index 1e5d0243dc..4ff3d84a7f 100644 --- a/documentation/sphinx/source/api-c.rst +++ b/documentation/sphinx/source/api-c.rst @@ -49,6 +49,8 @@ .. |max-retry-delay-database-option| replace:: FIXME .. |transaction-size-limit-database-option| replace:: FIXME .. |timeout-database-option| replace:: FIXME +.. |causal-read-risky-transaction-option| replace:: FIXME +.. |causal-read-risky-database-option| replace:: FIXME .. include:: api-common.rst.inc diff --git a/documentation/sphinx/source/api-common.rst.inc b/documentation/sphinx/source/api-common.rst.inc index 3c99c45382..c5ec4e941a 100644 --- a/documentation/sphinx/source/api-common.rst.inc +++ b/documentation/sphinx/source/api-common.rst.inc @@ -318,6 +318,10 @@ Set the default maximum backoff delay incurred by each transaction in the call to |on-error-func| if the error is retryable. This is equivalent to calling |max-retry-delay-transaction-option| on each transaction created by this database. +.. |option-db-causal-read-risky-blurb| replace:: + + Transactions do not require the strict causal consistency guarantee that FoundationDB provides by default. The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a simultaneous fault and misbehaving clock. Enabling this option is equivalent to calling |causal-read-risky-transaction-option| on each transaction created by this database. + .. |option-db-snapshot-ryw-enable-blurb| replace:: If this option has been set an equal or more times with this database than the disable option, snapshot reads *will* see the effects of prior writes in the same transaction. Enabling this option is equivalent to calling |snapshot-ryw-enable-transaction-option| on each transaction created by this database. @@ -351,7 +355,7 @@ .. |option-causal-read-risky-blurb| replace:: - This transaction does not require the strict causal consistency guarantee that FoundationDB provides by default. The read version of the transaction will be a committed version, and usually will be the latest committed, but it might be an older version in the event of a fault or network partition. + This transaction does not require the strict causal consistency guarantee that FoundationDB provides by default. The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a simultaneous fault and misbehaving clock. One can set this for all transactions by calling |causal-read-risky-database-option|. .. |option-causal-write-risky-blurb| replace:: diff --git a/documentation/sphinx/source/api-python.rst b/documentation/sphinx/source/api-python.rst index 68ae70b1fa..5d7b7077b0 100644 --- a/documentation/sphinx/source/api-python.rst +++ b/documentation/sphinx/source/api-python.rst @@ -25,6 +25,7 @@ .. |timeout-database-option| replace:: :func:`Database.options.set_transaction_timeout` .. |max-retry-delay-database-option| replace:: :func:`Database.options.set_transaction_max_retry_delay` .. |transaction-size-limit-database-option| replace:: :func:`Database.options.set_transaction_size_limit` +.. |causal-read-risky-database-option| replace:: :func:`Database.options.set_causal_read_risky` .. |snapshot-ryw-enable-database-option| replace:: :func:`Database.options.set_snapshot_ryw_enable` .. |snapshot-ryw-disable-database-option| replace:: :func:`Database.options.set_snapshot_ryw_disable` .. |future-type-string| replace:: a :ref:`future ` @@ -35,6 +36,7 @@ .. |size-limit-transaction-option| replace:: :func:`Transaction.options.set_size_limit` .. |snapshot-ryw-enable-transaction-option| replace:: :func:`Transaction.options.set_snapshot_ryw_enable` .. |snapshot-ryw-disable-transaction-option| replace:: :func:`Transaction.options.set_snapshot_ryw_disable` +.. |causal-read-risky-transaction-option| replace:: :func:`Transaction.options.set_causal_read_risky` .. |lazy-iterator-object| replace:: generator .. |key-meth| replace:: :meth:`Subspace.key` .. |directory-subspace| replace:: :ref:`DirectorySubspace ` @@ -384,6 +386,10 @@ Database options |option-db-tr-size-limit-blurb| +.. method:: Database.options.set_causal_read_risky() + + |option-db-causal-read-risky-blurb| + .. method:: Database.options.set_snapshot_ryw_enable() |option-db-snapshot-ryw-enable-blurb| diff --git a/documentation/sphinx/source/api-ruby.rst b/documentation/sphinx/source/api-ruby.rst index cc35ad68b8..7ab18b250b 100644 --- a/documentation/sphinx/source/api-ruby.rst +++ b/documentation/sphinx/source/api-ruby.rst @@ -23,6 +23,7 @@ .. |timeout-database-option| replace:: :meth:`Database.options.set_transaction_timeout` .. |max-retry-delay-database-option| replace:: :meth:`Database.options.set_transaction_max_retry_delay` .. |transaction-size-limit-database-option| replace:: :func:`Database.options.set_transaction_size_limit` +.. |causal-read-risky-database-option| replace:: :meth:`Database.options.set_causal_read_risky` .. |snapshot-ryw-enable-database-option| replace:: :meth:`Database.options.set_snapshot_ryw_enable` .. |snapshot-ryw-disable-database-option| replace:: :meth:`Database.options.set_snapshot_ryw_disable` .. |future-type-string| replace:: a :class:`Future` @@ -33,6 +34,7 @@ .. |size-limit-transaction-option| replace:: :meth:`Transaction.options.set_size_limit` .. |snapshot-ryw-enable-transaction-option| replace:: :meth:`Transaction.options.set_snapshot_ryw_enable` .. |snapshot-ryw-disable-transaction-option| replace:: :meth:`Transaction.options.set_snapshot_ryw_disable` +.. |causal-read-risky-transaction-option| replace:: :meth:`Transaction.options.set_causal_read_risky` .. |lazy-iterator-object| replace:: :class:`Enumerator` .. |key-meth| replace:: :meth:`Subspace.key` .. |directory-subspace| replace:: :class:`DirectorySubspace` @@ -380,6 +382,10 @@ Database options |option-db-tr-size-limit-blurb| +.. method:: Database.options.set_causal_read_risky() -> nil + + |option-db-causal-read-risky-blurb| + .. method:: Database.options.set_snapshot_ryw_enable() -> nil |option-db-snapshot-ryw-enable-blurb| diff --git a/documentation/sphinx/source/data-modeling.rst b/documentation/sphinx/source/data-modeling.rst index 51867006af..e369824e32 100644 --- a/documentation/sphinx/source/data-modeling.rst +++ b/documentation/sphinx/source/data-modeling.rst @@ -51,6 +51,8 @@ .. |max-retry-delay-database-option| replace:: FIXME .. |transaction-size-limit-database-option| replace:: FIXME .. |timeout-database-option| replace:: FIXME +.. |casual-read-risky-database-option| replace:: FIXME +.. |causal-read-risky-transaction-option| replace:: FIXME .. include:: api-common.rst.inc diff --git a/documentation/sphinx/source/developer-guide.rst b/documentation/sphinx/source/developer-guide.rst index e8d6335b6f..3b025b89cf 100644 --- a/documentation/sphinx/source/developer-guide.rst +++ b/documentation/sphinx/source/developer-guide.rst @@ -51,6 +51,8 @@ .. |max-retry-delay-database-option| replace:: FIXME .. |transaction-size-limit-database-option| replace:: FIXME .. |timeout-database-option| replace:: FIXME +.. |casual-read-risky-database-option| replace:: FIXME +.. |causal-read-risky-transaction-option| replace:: FIXME .. include:: api-common.rst.inc diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index c00fffafa9..fda6d932d1 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -760,7 +760,7 @@ void DatabaseContext::setOption( FDBDatabaseOptions::Option option, Optional= 0) { ASSERT(FDBTransactionOptions::optionInfo.find((FDBTransactionOptions::Option)defaultFor) != FDBTransactionOptions::optionInfo.end()); - transactionDefaults.addOption((FDBTransactionOptions::Option)option, value.castTo>()); + transactionDefaults.addOption((FDBTransactionOptions::Option)defaultFor, value.castTo>()); } else { switch(option) { diff --git a/fdbclient/vexillographer/fdb.options b/fdbclient/vexillographer/fdb.options index 775e443137..a3d522741a 100644 --- a/fdbclient/vexillographer/fdb.options +++ b/fdbclient/vexillographer/fdb.options @@ -162,6 +162,9 @@ description is not currently required but encouraged. paramType="Int" paramDescription="value in bytes" description="Set the maximum transaction size in bytes. This sets the ``size_limit`` option on each transaction created by this database. See the transaction option description for more information." defaultFor="503"/> +