Commit Graph

60 Commits

Author SHA1 Message Date
A.J. Beamon 4fd64630e8 Convert literal string ref instances to use _sr suffix 2022-09-19 11:35:58 -07:00
Lukas Joswiak 703aa1d279 Mess with timeout values 2022-07-22 10:37:29 -07:00
Lukas Joswiak 40d403ed5f Reduce global configuration system key reads from proxy
Clients now poll the proxy for the latest global config for a specific
version. The proxy now periodically requests the latest global
configuration data and stores it in memory, enabling it to respond
immediately to clients with the appropriate version.
2022-07-22 10:37:29 -07:00
Lukas Joswiak 7a48a53778 Perform migration automatically on proxy boot 2022-07-22 10:37:29 -07:00
Lukas Joswiak c33e44b0f4 Proxy GlobalConfig reads through GRV proxies
Clients should avoid reading system keys unless authorized. Under global
config, each client reads from the system keyspace to check for new
global config keys. This commit moves these reads to a server role (the
GRV proxies) and sends the results back to GlobalConfig for an in-memory
update.
2022-07-22 10:37:29 -07:00
A.J. Beamon 190ad8c7e9 Convert existing tuple usages to use Tuple::makeTuple() 2022-07-19 13:45:59 -07:00
A.J. Beamon 1b81e72604 Add a Tuple::makeTuple function to easily construct a tuple. Update Tuple to allow all types to be passed via .append() so they can be used with makeTuple. 2022-07-19 11:50:58 -07:00
Andrew Noyes 207e0bc105
Fix a few places we weren't doing exponential backoff (#7349)
* Fix a few places we weren't doing exponential backoff

We re-create the transaction every iteration of each of these retry
loops, so we need to manage exponential backoff here ourselves.

Closes #7301

* Remove former Backoff definition
2022-06-13 13:18:58 -07:00
Hao Fu e7fa8e9f6f
Add versionstamp support in tuple (#7293)
Tuple in C++ needs to support Versionstamp.
2022-06-02 17:44:10 -07:00
Andrew Noyes 2e087a6ec6
Fix some spammy trace events (#7296)
* Exponential backoff for some GlobalConfig retry loops

* Fix incorrect usage of random01() <= p idiom
2022-06-01 16:49:25 -07:00
Lukas Joswiak 43ab5e06a3 Always restart updater 2022-05-27 10:25:29 -07:00
Lukas Joswiak 4c07064632 Fix reference cycle in GlobalConfig 2022-05-27 10:25:29 -07:00
Lukas Joswiak 746261f091 Add retry loop 2022-05-27 10:25:29 -07:00
Lukas Joswiak 7972ef48d6 Refactor profiling special keys to use GlobalConfig
The special keys `\xff\xff/management/profiling/client_txn_sample_rate`
and `\xff\xff/management/profiling/client_txn_size_limit` are deprecated
in FDB 7.2. However, GlobalConfig was introduced in 7.0, and reading and
writing these keys through the special key space was broken in 7.0+.
This change modifies the profiling special keys to use GlobalConfig
behind the scenes, fixing the broken special keys.

The following Python script was used to make sure both GlobalConfig and
the profiling special key can be used to read/write/clear profiling
data:

```
import fdb
import time

fdb.api_version(710)

@fdb.transactional
def set_sample_rate(tr):
    tr.options.set_special_key_space_enable_writes()
    # Alternative way to write the key
    #tr[b'\xff\xff/global_config/config/fdb_client_info/client_txn_sample_rate'] = fdb.tuple.pack((5.0,))
    tr[b'\xff\xff/management/profiling/client_txn_sample_rate'] = '5.0'

@fdb.transactional
def clear_sample_rate(tr):
    tr.options.set_special_key_space_enable_writes()
    # Alternative way to clear the key
    #tr.clear(b'\xff\xff/global_config/config/fdb_client_info/client_txn_sample_rate')
    tr[b'\xff\xff/management/profiling/client_txn_sample_rate'] = 'default'

@fdb.transactional
def get_sample_rate(tr):
    print(tr.get(b'\xff\xff/global_config/config/fdb_client_info/client_txn_sample_rate'))
    # Alternative way to read the key
    #print(tr.get(b'\xff\xff/management/profiling/client_txn_sample_rate'))

fdb.options.set_trace_enable()
fdb.options.set_trace_format('json')
db = fdb.open()

get_sample_rate(db) # None (or 'default')
set_sample_rate(db)
time.sleep(1)       # Allow time for global config changes to propagate
get_sample_rate(db) # 5.0
clear_sample_rate(db)
time.sleep(1)
get_sample_rate(db) # None (or 'default')
```

It can be run with `PYTHONPATH=./bindings/python/ python profiling.py`,
and reads the `fdb.cluster` file in the current directory.

```
$ PYTHONPATH=./bindings/python/ python sps.py
None
5.000000
None
```
2022-05-10 10:51:08 -07:00
Vishesh Yadav 9173e2e19b Move GlobalConfig to DatabaseContext 2022-05-09 14:54:51 -07:00
Vishesh Yadav 7578d5ebc7 Create GlobalConfig object for each database instance
Currently, GlobalConfig is a singleton that means for each process there is only
one GlobalConfig object. This is bug from clients perspective as a client can
keep connections to several databases. This patch tracks GlobalConfig for each
database using an unordered_map in flowGlobals.

We discovered this bug while testing multi-version client, where the client got
stuck. This was lucky, as normally it'd just write down config to the wrong
database.
2022-05-09 14:54:51 -07:00
sfc-gh-tclinkenbeard a71099471b Update copyright header dates 2022-03-21 13:36:23 -07:00
A.J. Beamon 8418cb2839 Mark various externally exposed system transactions as read/access system keys. Also adjust a few lock aware declarations to read lock aware. 2022-01-27 13:58:33 -08:00
Lukas Joswiak a605fb3852
Merge pull request #5026 from sfc-gh-ljoswiak/fixes/alp6
Actor sampling
2021-08-11 13:44:17 -07:00
Lukas Joswiak 9e5da0452f Remove hot TraceEvents 2021-08-03 20:34:44 -07:00
Lukas Joswiak 5dc9a97230 Merge branch 'master' into fixes/alp6 2021-08-01 20:42:52 -07:00
Lukas Joswiak d7a03cc703 Add GlobalConfig TraceEvents for easier debugging 2021-07-27 14:12:17 -07:00
Lukas Joswiak c966094fdb Remove outdated global config fix 2021-06-04 15:01:03 -07:00
Lukas Joswiak 153de33f57 Revert "Merge pull request #4802 from sfc-gh-ljoswiak/revert/actor-lineage"
This reverts commit 6499fa178e, reversing
changes made to 1512631957.
2021-06-04 13:31:55 -07:00
Lukas Joswiak 68344cc5e6 clang-format 2021-06-03 14:27:24 -07:00
Lukas Joswiak ba25b95c6a Fix global config not updating on server processes 2021-06-03 14:27:24 -07:00
Lukas Joswiak 4ea760b2a9 Revert "Merge pull request #4136 from sfc-gh-mpilman/features/actor-lineage"
This reverts commit da41534618, reversing
changes made to e6300905d6.
2021-05-10 20:26:12 -07:00
Lukas Joswiak cdf98f987d
Revert "Fix global config not triggering changes on server processes" 2021-05-10 12:18:28 -07:00
Lukas Joswiak 3f6ef14384 Fix OOM 2021-05-07 16:28:39 -07:00
Lukas Joswiak 71ba6f4501 Switch std::function to AsyncTrigger 2021-05-07 16:05:03 -07:00
Lukas Joswiak 0fc1552683 Fix global config updates not triggering on fdbserver processes 2021-05-06 15:46:34 -07:00
sfc-gh-tclinkenbeard 5c2d7b6080 Create RangeResult type alias 2021-05-03 13:14:16 -07:00
Lukas Joswiak c016e154a7 Remove global config fdbserver fix
This is causing problems with the 5.2.0 restarting test. Removing this
line disables fdbserver processes from receiving global config updates,
instead requiring a restart to see them.
2021-05-02 11:03:07 -07:00
Lukas Joswiak 637699be32 Fix issue with fdbserver not receiving global config change
notifications
2021-05-01 21:41:10 -07:00
Lukas Joswiak cf4218dfd1 Fixes simulation failures
Fixes the following issues:

1. Use the right index when initializing the WriteOnlySet's vector of
   atomics. Also switch to std::atomic_init to initialize each atomic in
   the vector (cannot default construct the atomics in the vector
   because std::atomic does not have a copy constructor).
2. Add failure check for when items cannot be inserted into the
   WriteOnlySet due to capacity constraints. This situation occurs when
   `copy` is not called on the WriteOnlySet, such as when sampling is
   disabled. The `copy` function is what clears the WriteOnlySet.
3. Remove a global config feature I added to update the ClientDBInfo
   object used by the global config listener function. This needs more
   investigation, but the effect of this change could be that global
   config changes are not correctly recognized on fdbserver processes.
4. Add various ASSERTs to verify data in WriteOnlySet.
2021-05-01 15:26:28 -07:00
Lukas Joswiak e45faa3534 Fix a bug where deleting a key invalidated its memory which was later
read
2021-04-23 16:38:01 -07:00
Lukas Joswiak 52bba82e8e Add window size configuration key 2021-04-23 14:05:05 -07:00
Lukas Joswiak 15336ca274 Add callback for specific global configuration key changes 2021-04-20 17:51:38 -07:00
Lukas Joswiak 2357177722 Add bool support to global configuration 2021-04-20 15:05:51 -07:00
Lukas Joswiak c81e1e9519 Add sampling profiler frequency to global config 2021-04-19 22:46:57 -07:00
Lukas Joswiak 51e4c19675 Add migration for client profiling keys 2021-04-14 10:56:33 -07:00
Lukas Joswiak 2594d91f11 Update casing 2021-04-14 10:56:33 -07:00
Lukas Joswiak 7de23918c0 Add comments, fix erase bug, make optimizations 2021-04-14 10:56:33 -07:00
Lukas Joswiak 7ba7257cd2 Store global config data on heap 2021-04-14 10:56:33 -07:00
Lukas Joswiak 1c60653c2a Add fix to conditionally set global config history 2021-04-14 10:56:33 -07:00
Lukas Joswiak 6de28dd916 clang-format 2021-04-14 10:56:33 -07:00
Lukas Joswiak 1260385965 Use object to wrap global configuration history 2021-04-14 10:56:32 -07:00
Lukas Joswiak 1c84c04ffc Add global configuration prefix function 2021-04-14 10:56:32 -07:00
Lukas Joswiak 388344c31e Better estimation for arena size 2021-04-14 10:56:32 -07:00
Lukas Joswiak b7cd8175be Add arena per object in global config 2021-04-14 10:56:32 -07:00