Skip to content

Commit

Permalink
Merge branch 'main' into nim/change-logging-level
Browse files Browse the repository at this point in the history
* main: (26 commits)
  Stop consistency scanner while restore is in progress
  Improve logging (apple#10387)
  Split GLOBAL_TAG_THROTTLING_FOLDING_TIME into several knobs
  Added HoltLinearSmootherImpl::eTrendFoldingTime field
  Use HoltLinearSmoother in GlobalTagThrottler
  Add HoltLinearSmoother
  EaR: Optimize logging from GetEncryptCipherKey (apple#10326)
  Fix tracing in GlobalTagThrottler::getClientRates
  Fix tracing typo in GlobalTagThrottler
  fixup! joshua_logtool error should be reported as a XML element by test_harness
  Change compiler options order to avoid -gdwarf overriding -g1 (apple#10377)
  Fix test by disable tenant
  Should repeat when speedUpSimulation is false
  Fix a simulation DR stuck issue
  update links to foundationdb.org to reference GitHub
  add cmake option to include RocksDB Tools with the Rocks DB compile
  SS Audit Storage Throttling (apple#10322)
  Fix restore range loss
  Fix type of TagCost field in BusiestReadTag traces
  Fix failing /fdbserver/TransactionTagCounter/IgnoreBelowMinRate unit test
  ...
  • Loading branch information
sfc-gh-nwijetunga committed Jun 1, 2023
2 parents 27dbf2f + e6fb1e6 commit e10bf49
Show file tree
Hide file tree
Showing 40 changed files with 712 additions and 403 deletions.
2 changes: 1 addition & 1 deletion bindings/go/src/fdb/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Package fdb provides an interface to FoundationDB databases (version 2.0 or high
To build and run programs using this package, you must have an installed copy of
the FoundationDB client libraries (version 2.0.0 or later), available for Linux,
Windows and OS X at https://www.foundationdb.org/download/.
Windows and OS X at https://github.com/apple/foundationdb/releases
This documentation specifically applies to the FoundationDB Go binding. For more
extensive guidance to programming with FoundationDB, as well as API
Expand Down
4 changes: 2 additions & 2 deletions bindings/java/pom.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<packaging>jar</packaging>

<name>foundationdb-java</name>
<description>Java bindings for the FoundationDB database. These bindings require the FoundationDB client, which is under a different license. The client can be obtained from https://www.foundationdb.org/download/.</description>
<description>Java bindings for the FoundationDB database. These bindings require the FoundationDB client, which is under a different license. The client can be obtained from https://github.com/apple/foundationdb/releases</description>
<inceptionYear>2010</inceptionYear>
<url>https://www.foundationdb.org</url>

Expand All @@ -26,7 +26,7 @@
</developers>

<scm>
<url>http://0.0.0.0</url>
<url>https://github.com/apple/foundationdb</url>
</scm>

<licenses>
Expand Down
2 changes: 1 addition & 1 deletion bindings/java/src/main/overview.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FoundationDB's Java bindings rely on native libraries that are installed as part
FoundationDB client binaries installation (see
<a href="/foundationdb/api-general.html#installing-client-binaries" target="_blank">
Installing FoundationDB client binaries</a>). The JAR can be downloaded from
<a href="https://www.foundationdb.org/download/">our website</a>
<a href="https://central.sonatype.com/artifact/org.foundationdb/fdb-java">maven central</a>
and then added to your classpath.<br>
<br>
<h1>Getting started</h1>
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Complete documentation of the FoundationDB Python API can be found at https://apple.github.io/foundationdb/api-python.html.

These bindings require the FoundationDB client. The client can be obtained from https://www.foundationdb.org/download/.
These bindings require the FoundationDB client. The client can be obtained from https://github.com/apple/foundationdb/releases
2 changes: 1 addition & 1 deletion bindings/ruby/fdb.gemspec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ EOF
s.license = 'Apache-2.0'
s.add_dependency('ffi', '~> 1.1', '>= 1.1.5')
s.required_ruby_version = '>= 1.9.3'
s.requirements << 'These bindings require the FoundationDB client. The client can be obtained from https://www.foundationdb.org/download/.'
s.requirements << 'These bindings require the FoundationDB client. The client can be obtained from https://github.com/apple/foundationdb/releases'
end
2 changes: 1 addition & 1 deletion bindings/ruby/fdb.gemspec.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ EOF
s.license = 'Apache-2.0'
s.add_dependency('ffi', '~> 1.1', '>= 1.1.5')
s.required_ruby_version = '>= 1.9.3'
s.requirements << 'These bindings require the FoundationDB client. The client can be obtained from https://www.foundationdb.org/download/.'
s.requirements << 'These bindings require the FoundationDB client. The client can be obtained from https://github.com/apple/foundationdb/releases'
end
4 changes: 2 additions & 2 deletions cmake/CompileRocksDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ set(RocksDB_CMAKE_ARGS
-DFAIL_ON_WARNINGS=OFF
-DWITH_GFLAGS=OFF
-DWITH_TESTS=OFF
-DWITH_TOOLS=OFF
-DWITH_CORE_TOOLS=OFF
-DWITH_TOOLS=${ROCKSDB_TOOLS}
-DWITH_CORE_TOOLS=${ROCKSDB_TOOLS}
-DWITH_BENCHMARK_TOOLS=OFF
-DWITH_BZ2=OFF
-DWITH_LZ4=ON
Expand Down
14 changes: 7 additions & 7 deletions cmake/ConfigureCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ else()

add_compile_options(-fno-omit-frame-pointer)

if(CLANG)
# The default DWARF 5 format does not play nicely with GNU Binutils 2.39 and earlier, resulting
# in tools like addr2line omitting line numbers. We can consider removing this once we are able
# to use a version that has a fix.
add_compile_options(-gdwarf-4)
endif()

if(FDB_RELEASE OR FULL_DEBUG_SYMBOLS OR CMAKE_BUILD_TYPE STREQUAL "Debug")
# Configure with FULL_DEBUG_SYMBOLS=ON to generate all symbols for debugging with gdb
# Also generating full debug symbols in release builds. CPack will strip them out
Expand All @@ -174,13 +181,6 @@ else()
add_compile_options(-ggdb1)
endif()

if(CLANG)
# The default DWARF 5 format does not play nicely with GNU Binutils 2.39 and earlier, resulting
# in tools like addr2line omitting line numbers. We can consider removing this once we are able
# to use a version that has a fix.
add_compile_options(-gdwarf-4)
endif()

if(NOT FDB_RELEASE)
# Enable compression of the debug sections. This reduces the size of the binaries several times.
# We do not enable it release builds, because CPack fails to generate debuginfo packages when
Expand Down
1 change: 1 addition & 0 deletions cmake/FDBComponents.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ set(PORTABLE_ROCKSDB ON CACHE BOOL "Compile RocksDB in portable mode") # Set thi
set(ROCKSDB_SSE42 OFF CACHE BOOL "Compile RocksDB with SSE42 enabled")
set(ROCKSDB_AVX ${USE_AVX} CACHE BOOL "Compile RocksDB with AVX enabled")
set(ROCKSDB_AVX2 OFF CACHE BOOL "Compile RocksDB with AVX2 enabled")
set(ROCKSDB_TOOLS OFF CACHE BOOL "Compile RocksDB tools")
set(WITH_LIBURING OFF CACHE BOOL "Build with liburing enabled") # Set this to ON to include liburing
# RocksDB is currently enabled by default for GCC but does not build with the latest
# Clang.
Expand Down
19 changes: 15 additions & 4 deletions contrib/TestHarness2/test_harness/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def log_test_plan(self, out: SummaryTree):
def delete_simdir(self):
shutil.rmtree(self.temp_path / Path("simfdb"))

def _run_rocksdb_logtool(self):
def _run_joshua_logtool(self):
"""Calls Joshua LogTool to upload the test logs if 1) test failed 2) test is RocksDB related"""
if not os.path.exists("joshua_logtool.py"):
raise RuntimeError("joshua_logtool.py missing")
Expand All @@ -407,7 +407,12 @@ def _run_rocksdb_logtool(self):
str(self.temp_path),
"--check-rocksdb",
]
subprocess.run(command, check=True)
result = subprocess.run(command, capture_output=True, text=True)
return {
"stdout": result.stdout,
"stderr": result.stderr,
"exit_code": result.returncode,
}

def run(self):
command: List[str] = []
Expand Down Expand Up @@ -498,10 +503,16 @@ def run(self):
self.summary.was_killed = did_kill
self.summary.valgrind_out_file = valgrind_file
self.summary.error_out = err_out
if not self.summary.is_negative_test and not self.summary.ok():
logtool_result = self._run_joshua_logtool()
if logtool_result["exit_code"] != 0:
child = SummaryTree("JoshuaLogTool")
child.attributes["ExitCode"] = str(logtool_result["exit_code"])
child.attributes["StdOut"] = logtool_result["stdout"]
child.attributes["StdErr"] = logtool_result["stderr"]
self.summary.out.append(child)
self.summary.summarize(self.temp_path, " ".join(command))

if not self.summary.is_negative_test and not self.summary.ok():
self._run_rocksdb_logtool()
return self.summary.ok()


Expand Down
4 changes: 2 additions & 2 deletions contrib/joshua_logtool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python3

"""rocksdb_logtool.py
"""joshua_logtool.py
Provides uploading/downloading FoundationDB log files to Joshua cluster.
"""
Expand Down Expand Up @@ -129,7 +129,7 @@ def list_commands(ensemble_id: str):


def _setup_args():
parser = argparse.ArgumentParser(prog="rocksdb_logtool.py")
parser = argparse.ArgumentParser(prog="joshua_logtool.py")

parser.add_argument(
"--cluster-file", type=str, default=None, help="Joshua FDB cluster file"
Expand Down
2 changes: 1 addition & 1 deletion design/global-tag-throttling.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The ratekeeper must also track the rate of transactions performed with each tag.
### Average Cost Calculation
Quotas are expressed in terms of cost, but because throttling is enforced at the beginning of transactions, budgets need to be calculated in terms of transactions per second. To make this conversion, it is necessary to track the average cost of transactions (per-tag, and per-tag on a particular storage server).

Both cost and transaction counters are smoothed using the `Smoother` class to provide stability over time. The "smoothing interval" can be modified through `SERVER_KNOBS->GLOBAL_TAG_THROTTLING_FOLDING_TIME`.
Both cost and transaction counters are exponentially smoothed over time, with knob-configurable smoothing intervals.

### Reserved Rate Calculation
The global tag throttler periodically reads reserved quotas from the system keyspace. Using these reserved quotas and the average cost of transactions with the given tag, a reserved TPS rate is computed. Read and write rates are aggregated as follows:
Expand Down
2 changes: 1 addition & 1 deletion fdbcli/GetAuditStatusCommand.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ACTOR Future<bool> getAuditStatusCommandActor(Database cx, std::vector<StringRef
}
const UID id = UID::fromString(tokens[3].toString());
AuditStorageState res = wait(getAuditState(cx, type, id));
printf("Audit result is:\n%s", res.toStringForCLI().c_str());
printf("Audit result is:\n%s", res.toString().c_str());
} else if (tokencmp(tokens[2], "recent")) {
int count = CLIENT_KNOBS->TOO_MANY;
if (tokens.size() == 4) {
Expand Down
18 changes: 10 additions & 8 deletions fdbclient/AuditUtils.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,28 @@ ACTOR Future<std::vector<AuditStorageState>> getAuditStates(Database cx,
state std::vector<AuditStorageState> auditStates;
state Key readBegin;
state Key readEnd;
state RangeResult res;
state Reverse reverse = newFirst ? Reverse::True : Reverse::False;

if (num.present() && num.get() == 0) {
return auditStates;
}
loop {
try {
readBegin = auditKeyRange(auditType).begin;
readEnd = auditKeyRange(auditType).end;
auditStates.clear();
while (true) {
res.clear();
tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
tr.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
KeyRangeRef rangeToRead(readBegin, readEnd);
if (num.present()) {
wait(store(res, tr.getRange(rangeToRead, num.get(), Snapshot::False, reverse)));
} else {
wait(store(res, tr.getRange(rangeToRead, GetRangeLimits(), Snapshot::False, reverse)));
}
state RangeResult res = wait(tr.getRange(rangeToRead,
num.present() ? GetRangeLimits(num.get()) : GetRangeLimits(),
Snapshot::False,
reverse));
for (int i = 0; i < res.size(); ++i) {
auditStates.push_back(decodeAuditStorageState(res[i].value));
if (num.present() && auditStates.size() == num.get()) {
return auditStates; // since res.more is not reliable when GetRangeLimits is set to 1
}
}
if (!res.more) {
break;
Expand Down
8 changes: 6 additions & 2 deletions fdbclient/DatabaseBackupAgent.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include "fdbclient/NativeAPI.actor.h"
#include <ctime>
#include <climits>
#include "fdbrpc/simulator.h"
#include "flow/IAsyncFile.h"
#include "flow/flow.h"
#include "flow/genericactors.actor.h"
#include "flow/Hash3.h"
#include <numeric>
Expand Down Expand Up @@ -361,8 +363,10 @@ struct BackupRangeTaskFunc : TaskFuncBase {

if ((!prevAdjacent || !nextAdjacent) &&
rangeCount > ((prevAdjacent || nextAdjacent) ? CLIENT_KNOBS->BACKUP_MAP_KEY_UPPER_LIMIT
: CLIENT_KNOBS->BACKUP_MAP_KEY_LOWER_LIMIT)) {
CODE_PROBE(true, "range insert delayed because too versionMap is too large");
: CLIENT_KNOBS->BACKUP_MAP_KEY_LOWER_LIMIT) &&
(!g_network->isSimulated() ||
(isBuggifyEnabled(BuggifyType::General) && !g_simulator->speedUpSimulation))) {
CODE_PROBE(true, "range insert delayed because versionMap is too large");

if (rangeCount > CLIENT_KNOBS->BACKUP_MAP_KEY_UPPER_LIMIT)
TraceEvent(SevWarnAlways, "DBA_KeyRangeMapTooLarge").log();
Expand Down
3 changes: 2 additions & 1 deletion fdbclient/FileBackupAgent.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3800,12 +3800,13 @@ struct RestoreRangeTaskFunc : RestoreFileTaskFuncBase {
}

// First and last key are the range for this file
state KeyRange fileRange = KeyRangeRef(blockData.front().key, blockData.back().key);
state KeyRange fileRange;
state std::vector<KeyRange> originalFileRanges;
// If fileRange doesn't intersect restore range then we're done.
state int index;
for (index = 0; index < restoreRanges.get().size(); index++) {
auto& restoreRange = restoreRanges.get()[index];
fileRange = KeyRangeRef(blockData.front().key, blockData.back().key);
if (!fileRange.intersects(restoreRange))
continue;

Expand Down
19 changes: 8 additions & 11 deletions fdbclient/ServerKnobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi

init( SHARD_ENCODE_LOCATION_METADATA, false ); if( randomize && BUGGIFY ) SHARD_ENCODE_LOCATION_METADATA = true;
init( ENABLE_DD_PHYSICAL_SHARD, false ); // EXPERIMENTAL; If true, SHARD_ENCODE_LOCATION_METADATA must be true; When true, optimization of data move between DCs is disabled
init( ENABLE_DD_PHYSICAL_SHARD_MOVE, false ); if( isSimulated ) ENABLE_DD_PHYSICAL_SHARD_MOVE = deterministicRandom()->coinflip();
init( DD_PHYSICAL_SHARD_MOVE_PROBABILITY, 0.5 );
init( DD_PHYSICAL_SHARD_MOVE_PROBABILITY, 0.0 ); if( isSimulated ) DD_PHYSICAL_SHARD_MOVE_PROBABILITY = 0.5;
init( MAX_PHYSICAL_SHARD_BYTES, 10000000 ); // 10 MB; for ENABLE_DD_PHYSICAL_SHARD; smaller leads to larger number of physicalShard per storage server
init( PHYSICAL_SHARD_METRICS_DELAY, 300.0 ); // 300 seconds; for ENABLE_DD_PHYSICAL_SHARD
init( ANONYMOUS_PHYSICAL_SHARD_TRANSITION_TIME, 600.0 ); if( randomize && BUGGIFY ) ANONYMOUS_PHYSICAL_SHARD_TRANSITION_TIME = 0.0; // 600 seconds; for ENABLE_DD_PHYSICAL_SHARD
Expand Down Expand Up @@ -830,23 +829,21 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( AUTO_TAG_THROTTLE_UPDATE_FREQUENCY, 10.0 ); if(randomize && BUGGIFY) AUTO_TAG_THROTTLE_UPDATE_FREQUENCY = 0.5;
init( TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL, 30.0 ); if(randomize && BUGGIFY) TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL = 1.0;
init( AUTO_TAG_THROTTLING_ENABLED, true ); if(randomize && BUGGIFY) AUTO_TAG_THROTTLING_ENABLED = false;
init( SS_THROTTLE_TAGS_TRACKED, 1 ); if(randomize && BUGGIFY) SS_THROTTLE_TAGS_TRACKED = deterministicRandom()->randomInt(1, 10);
init( SS_THROTTLE_TAGS_TRACKED, 5 ); if(randomize && BUGGIFY) SS_THROTTLE_TAGS_TRACKED = deterministicRandom()->randomInt(1, 10);
init( GLOBAL_TAG_THROTTLING, true ); if(isSimulated) GLOBAL_TAG_THROTTLING = deterministicRandom()->coinflip();
init( ENFORCE_TAG_THROTTLING_ON_PROXIES, GLOBAL_TAG_THROTTLING );
init( GLOBAL_TAG_THROTTLING_MIN_RATE, 1.0 );
// 10 seconds was chosen as a default value to ensure that
// the global tag throttler does not react too drastically to
// changes in workload. To make the global tag throttler more reactive,
// lower this knob. To make global tag throttler more smooth, raise this knob.
// Setting this knob lower than TAG_MEASUREMENT_INTERVAL can cause erratic
// behaviour and is not recommended.
init( GLOBAL_TAG_THROTTLING_FOLDING_TIME, 10.0 );
init( GLOBAL_TAG_THROTTLING_MAX_TAGS_TRACKED, 10 );
init( GLOBAL_TAG_THROTTLING_TAG_EXPIRE_AFTER, 240.0 );
init( GLOBAL_TAG_THROTTLING_PROXY_LOGGING_INTERVAL, 60.0 );
init( GLOBAL_TAG_THROTTLING_TRACE_INTERVAL, 5.0 );
init( GLOBAL_TAG_THROTTLING_REPORT_ONLY, false );

init( GLOBAL_TAG_THROTTLING_TARGET_RATE_FOLDING_TIME, 10.0 );
init( GLOBAL_TAG_THROTTLING_TRANSACTION_COUNT_FOLDING_TIME, 2.0 );
init( GLOBAL_TAG_THROTTLING_TRANSACTION_RATE_FOLDING_TIME, 10.0 );
init( GLOBAL_TAG_THROTTLING_COST_FOLDING_TIME, 10.0 );

//Storage Metrics
init( STORAGE_METRICS_AVERAGE_INTERVAL, 120.0 );
init( STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS, 1000.0 / STORAGE_METRICS_AVERAGE_INTERVAL ); // milliHz!
Expand Down Expand Up @@ -879,7 +876,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( SERVE_AUDIT_STORAGE_PARALLELISM, 1 );
init( PERSIST_FINISH_AUDIT_COUNT, 10 ); if ( isSimulated ) PERSIST_FINISH_AUDIT_COUNT = 1;
init( AUDIT_RETRY_COUNT_MAX, 100 ); if ( isSimulated ) AUDIT_RETRY_COUNT_MAX = 10;
init( CONCURRENT_AUDIT_TASK_COUNT_MAX, 50 ); if ( isSimulated ) CONCURRENT_AUDIT_TASK_COUNT_MAX = deterministicRandom()->randomInt(1, CONCURRENT_AUDIT_TASK_COUNT_MAX+1);
init( CONCURRENT_AUDIT_TASK_COUNT_MAX, 10 ); if ( isSimulated ) CONCURRENT_AUDIT_TASK_COUNT_MAX = deterministicRandom()->randomInt(1, CONCURRENT_AUDIT_TASK_COUNT_MAX+1);
init( BUGGIFY_BLOCK_BYTES, 10000 );
init( STORAGE_RECOVERY_VERSION_LAG_LIMIT, 2 * MAX_READ_TRANSACTION_LIFE_VERSIONS );
init( STORAGE_COMMIT_BYTES, 10000000 ); if( randomize && BUGGIFY ) STORAGE_COMMIT_BYTES = 2000000;
Expand Down
16 changes: 1 addition & 15 deletions fdbclient/include/fdbclient/Audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,10 @@ struct AuditStorageState {
inline void setPhase(AuditPhase phase) { this->phase = static_cast<uint8_t>(phase); }
inline AuditPhase getPhase() const { return static_cast<AuditPhase>(this->phase); }

// for fdbcli get_audit_status
std::string toStringForCLI() const {
std::string res = "AuditStorageState: [ID]: " + id.toString() +
", [Range]: " + Traceable<KeyRangeRef>::toString(range) +
", [Type]: " + std::to_string(type) + ", [Phase]: " + std::to_string(phase);
if (!error.empty()) {
res += "[Error]: " + error;
}

return res;
}

// for traceevent
std::string toString() const {
std::string res = "AuditStorageState: [ID]: " + id.toString() +
", [Range]: " + Traceable<KeyRangeRef>::toString(range) +
", [Type]: " + std::to_string(type) + ", [Phase]: " + std::to_string(phase) +
", [AuditServerID]: " + auditServerId.toString();
", [Type]: " + std::to_string(type) + ", [Phase]: " + std::to_string(phase);
if (!error.empty()) {
res += "[Error]: " + error;
}
Expand Down
2 changes: 1 addition & 1 deletion fdbclient/include/fdbclient/FDBTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ struct RangeResultRef : VectorRef<KeyValueRef> {
serializer(ar, ((VectorRef<KeyValueRef>&)*this), more, readThrough, readToBegin, readThroughEnd);
}

int logicalSize() const {
int64_t logicalSize() const {
return VectorRef<KeyValueRef>::expectedSize() - VectorRef<KeyValueRef>::size() * sizeof(KeyValueRef);
}

Expand Down
Loading

0 comments on commit e10bf49

Please sign in to comment.