Merge branch 'master' of github.com:apple/foundationdb
This commit is contained in:
commit
2605257737
|
@ -63,7 +63,6 @@ endif()
|
|||
#generate_export_header(fdb_c EXPORT_MACRO_NAME "DLLEXPORT"
|
||||
# EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_export.h)
|
||||
fdb_install(TARGETS fdb_c
|
||||
EXPORT fdbc
|
||||
DESTINATION lib
|
||||
COMPONENT clients)
|
||||
fdb_install(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y systemd
|
||||
RUN apt-get update && apt-get install -y systemd python
|
||||
|
|
|
@ -117,7 +117,7 @@ then
|
|||
fi
|
||||
docker_buid_logs="${log_dir}/docker_build_${curr_name}"
|
||||
docker build . -t ${curr_name} 1> "${docker_buid_logs}.log" 2> "${docker_buid_logs}.err"
|
||||
successOr "Building Docker image ${name} failed - see ${docker_buid_logs}.log and ${docker_buid_logs}.err"
|
||||
successOr "Building Docker image ${curr_name} failed - see ${docker_buid_logs}.log and ${docker_buid_logs}.err"
|
||||
done
|
||||
if [ ! -z "${tests_to_run+x}"]
|
||||
then
|
||||
|
@ -135,12 +135,12 @@ then
|
|||
then
|
||||
docker_wait_any
|
||||
fi
|
||||
echo "Starting Test ${curr_name}/${curr_test}"
|
||||
log_file="${log_dir}/${curr_name}_${curr_test}.log"
|
||||
err_file="${log_dir}/${curr_name}_${curr_test}.err"
|
||||
docker_id=$( docker run -d -v "${fdb_source}:/foundationdb"\
|
||||
-v "${fdb_build}:/build"\
|
||||
${curr_name} /sbin/init )
|
||||
echo "Starting Test ${curr_name}/${curr_test} Docker-ID: ${docker_id}"
|
||||
{
|
||||
docker exec "${docker_id}" bash \
|
||||
/foundationdb/build/cmake/package_tester/${curr_format}_tests.sh -n ${curr_test} ${curr_packages[@]}\
|
||||
|
@ -177,6 +177,7 @@ then
|
|||
echo " - ${t}"
|
||||
done
|
||||
echo -e "${NC}"
|
||||
__res=1
|
||||
fi
|
||||
done
|
||||
exitfun
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "${testing_sh_included}" ]
|
||||
if [ -z "${testing_sh_included+x}" ]
|
||||
then
|
||||
testing_sh_included=1
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# build directory can be found in `/build`, the
|
||||
# source code will be located in `/foundationdb`
|
||||
|
||||
if [ -z "${tests_sh_included}" ]
|
||||
if [ -z "${tests_sh_included+x}" ]
|
||||
then
|
||||
tests_sh_included=1
|
||||
|
||||
|
@ -43,22 +43,30 @@ then
|
|||
successOr "Fresh installation is not clean"
|
||||
# test that we can read from and write to fdb
|
||||
cd /
|
||||
fdbcli --exec 'writemode on ; set foo bar'
|
||||
timeout 2 fdbcli --exec 'writemode on ; set foo bar'
|
||||
successOr "Cannot write to database"
|
||||
getresult="$(fdbcli --exec 'get foo')"
|
||||
getresult="$(timeout 2 fdbcli --exec 'get foo')"
|
||||
successOr "Get on database failed"
|
||||
if [ "${getresult}" != "\`foo' is \`bar'" ]
|
||||
then
|
||||
fail "value was not set correctly"
|
||||
fi
|
||||
fdbcli --exec 'writemode on ; clear foo'
|
||||
timeout 2 fdbcli --exec 'writemode on ; clear foo'
|
||||
successOr "Deleting value failed"
|
||||
getresult="$(fdbcli --exec 'get foo')"
|
||||
getresult="$(timeout 2 fdbcli --exec 'get foo')"
|
||||
successOr "Get on database failed"
|
||||
if [ "${getresult}" != "\`foo': not found" ]
|
||||
then
|
||||
fail "value was not cleared correctly"
|
||||
fi
|
||||
PYTHON_TARGZ_NAME="$(ls /build/packages | grep 'foundationdb-[0-9.]*\.tar\.gz' | sed 's/\.tar\.gz$//')"
|
||||
tar -C /tmp -xvf /build/packages/${PYTHON_TARGZ_NAME}.tar.gz
|
||||
pushd /tmp/${PYTHON_TARGZ_NAME}
|
||||
python setup.py install
|
||||
successOr "Installing python bindings failed"
|
||||
popd
|
||||
python -c 'import fdb; fdb.api_version(600)'
|
||||
successOr "Loading python bindings failed"
|
||||
}
|
||||
|
||||
keep_config() {
|
||||
|
@ -80,10 +88,10 @@ then
|
|||
echo "Configure new database - Install isn't supposed to do this for us"
|
||||
echo "as there was an existing configuration"
|
||||
cd /
|
||||
fdbcli --exec 'configure new single ssd'
|
||||
timeout 2 fdbcli --exec 'configure new single ssd'
|
||||
successOr "Couldn't configure new database"
|
||||
tests_healthy
|
||||
num_processes="$(fdbcli --exec 'status' | grep "FoundationDB processes" | sed -e 's/.*- //')"
|
||||
num_processes="$(timeout 2 fdbcli --exec 'status' | grep "FoundationDB processes" | sed -e 's/.*- //')"
|
||||
if [ "${num_processes}" -ne 2 ]
|
||||
then
|
||||
fail Number of processes incorrect after config change
|
||||
|
|
|
@ -81,7 +81,6 @@ endfunction()
|
|||
|
||||
function(fdb_install)
|
||||
if(NOT WIN32 AND NOT OPEN_FOR_IDE)
|
||||
set(options EXPORT)
|
||||
set(one_value_options COMPONENT DESTINATION)
|
||||
set(multi_value_options TARGETS FILES DIRECTORY)
|
||||
cmake_parse_arguments(IN "${options}" "${one_value_options}" "${multi_value_options}" "${ARGN}")
|
||||
|
@ -95,9 +94,6 @@ function(fdb_install)
|
|||
else()
|
||||
message(FATAL_ERROR "Expected FILES or TARGETS")
|
||||
endif()
|
||||
if(IN_EXPORT)
|
||||
set(args EXPORT)
|
||||
endif()
|
||||
if("${IN_DESTINATION}" STREQUAL "bin")
|
||||
install(${args} DESTINATION "bin" COMPONENT "${IN_COMPONENT}-tgz")
|
||||
install(${args} DESTINATION "usr/bin" COMPONENT "${IN_COMPONENT}-deb")
|
||||
|
@ -110,6 +106,12 @@ function(fdb_install)
|
|||
install(${args} DESTINATION "usr/sbin" COMPONENT "${IN_COMPONENT}-el6")
|
||||
install(${args} DESTINATION "usr/sbin" COMPONENT "${IN_COMPONENT}-el7")
|
||||
install(${args} DESTINATION "usr/local/libexec" COMPONENT "${IN_COMPONENT}-pm")
|
||||
elseif("${IN_DESTINATION}" STREQUAL "lib")
|
||||
install(${args} DESTINATION "lib" COMPONENT "${IN_COMPONENT}-tgz")
|
||||
install(${args} DESTINATION "usr/lib" COMPONENT "${IN_COMPONENT}-deb")
|
||||
install(${args} DESTINATION "usr/lib64" COMPONENT "${IN_COMPONENT}-el6")
|
||||
install(${args} DESTINATION "usr/lib64" COMPONENT "${IN_COMPONENT}-el7")
|
||||
install(${args} DESTINATION "lib" COMPONENT "${IN_COMPONENT}-pm")
|
||||
elseif("${IN_DESTINATION}" STREQUAL "fdbmonitor")
|
||||
install(${args} DESTINATION "libexec" COMPONENT "${IN_COMPONENT}-tgz")
|
||||
install(${args} DESTINATION "usr/lib/foundationdb" COMPONENT "${IN_COMPONENT}-deb")
|
||||
|
@ -138,6 +140,8 @@ function(fdb_install)
|
|||
install(${args} DESTINATION "var/lib/foundationdb/data" COMPONENT "${IN_COMPONENT}-deb")
|
||||
install(${args} DESTINATION "var/lib/foundationdb/data" COMPONENT "${IN_COMPONENT}-el6")
|
||||
install(${args} DESTINATION "var/lib/foundationdb/data" COMPONENT "${IN_COMPONENT}-el7")
|
||||
else()
|
||||
message(FATAL_ERROR "unrecognized destination ${IN_DESTINATION}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -236,6 +240,7 @@ set(CPACK_RPM_SERVER-EL7_DEBUGINFO_FILE_NAME "${server-filename}.el7-debuginfo.x
|
|||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/emptydir")
|
||||
fdb_install(DIRECTORY "${CMAKE_BINARY_DIR}/packaging/emptydir/" DESTINATION data COMPONENT server)
|
||||
fdb_install(DIRECTORY "${CMAKE_BINARY_DIR}/packaging/emptydir/" DESTINATION log COMPONENT server)
|
||||
fdb_install(DIRECTORY "${CMAKE_BINARY_DIR}/packaging/emptydir/" DESTINATION etc COMPONENT clients)
|
||||
|
||||
set(CPACK_RPM_SERVER-EL6_USER_FILELIST
|
||||
"%config(noreplace) /etc/foundationdb/foundationdb.conf"
|
||||
|
@ -309,7 +314,8 @@ set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
|
|||
set(CPACK_DEBIAN_SERVER-DEB_PACKAGE_NAME "foundationdb-server")
|
||||
set(CPACK_DEBIAN_CLIENTS-DEB_PACKAGE_NAME "foundationdb-clients")
|
||||
|
||||
set(CPACK_DEBIAN_SERVER-DEB_PACKAGE_DEPENDS "adduser, libc6 (>= 2.12), python (>= 2.6), foundationdb-clients (= ${FDB_VERSION})")
|
||||
set(CPACK_DEBIAN_SERVER-DEB_PACKAGE_DEPENDS "adduser, libc6 (>= 2.12), foundationdb-clients (= ${FDB_VERSION})")
|
||||
set(CPACK_DEBIAN_SERVER-DEB_PACKAGE_RECOMMENDS "python (>= 2.6)")
|
||||
set(CPACK_DEBIAN_CLIENTS-DEB_PACKAGE_DEPENDS "adduser, libc6 (>= 2.12)")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.foundationdb.org")
|
||||
set(CPACK_DEBIAN_CLIENTS-DEB_PACKAGE_CONTROL_EXTRA
|
||||
|
|
|
@ -24,6 +24,9 @@ Features
|
|||
* Added support for IPv6. `(PR #1176) https://github.com/apple/foundationdb/pull/1178`_
|
||||
* FDB can now simultaneously listen to TLS and unencrypted ports to facilitate smoother migration to TLS. `(PR #1157) https://github.com/apple/foundationdb/pull/1157`_
|
||||
* Added `DISABLE_POSIX_KERNEL_AIO` knob to fallback to libeio instead of kernel async I/O (KAIO) for systems that do not support KAIO or O_DIRECT flag. `(PR #1283) https://github.com/apple/foundationdb/pull/1283`_
|
||||
* Added support for a config where the primary and remote DC's can be used as satellites. `(PR #1320) https://github.com/apple/foundationdb/pull/1320`_
|
||||
* Added support for restoring multiple key ranges in a single restore job. `(PR #1190) https://github.com/apple/foundationdb/pull/1190`_
|
||||
* Depracated transaction option TRANSACTION_LOGGING_ENABLE. Added two new transaction options DEBUG_TRANSACTION_IDENTIFIER and LOG_TRANSACTION that sets an identifier for the transaction and logs the transaction to the trace file respectively. `(PR #1200) https://github.com/apple/foundationdb/pull/1200`_
|
||||
|
||||
Performance
|
||||
-----------
|
||||
|
|
|
@ -205,11 +205,14 @@ bool DatabaseConfiguration::isValid() const {
|
|||
return false;
|
||||
}
|
||||
dcIds.insert(r.dcId);
|
||||
std::set<Key> satelliteDcIds;
|
||||
satelliteDcIds.insert(Key());
|
||||
satelliteDcIds.insert(r.dcId);
|
||||
for(auto& s : r.satellites) {
|
||||
if(dcIds.count(s.dcId)) {
|
||||
if (satelliteDcIds.count(s.dcId)) {
|
||||
return false;
|
||||
}
|
||||
dcIds.insert(s.dcId);
|
||||
satelliteDcIds.insert(s.dcId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ public:
|
|||
return results;
|
||||
}
|
||||
|
||||
std::vector<WorkerDetails> getWorkersForTlogs( DatabaseConfiguration const& conf, int32_t required, int32_t desired, Reference<IReplicationPolicy> const& policy, std::map< Optional<Standalone<StringRef>>, int>& id_used, bool checkStable = false, std::set<Optional<Key>> dcIds = std::set<Optional<Key>>() ) {
|
||||
std::vector<WorkerDetails> getWorkersForTlogs( DatabaseConfiguration const& conf, int32_t required, int32_t desired, Reference<IReplicationPolicy> const& policy, std::map< Optional<Standalone<StringRef>>, int>& id_used, bool checkStable = false, std::set<Optional<Key>> dcIds = std::set<Optional<Key>>(), std::vector<UID> exclusionWorkerIds = {}) {
|
||||
std::map<std::pair<ProcessClass::Fitness,bool>, vector<WorkerDetails>> fitness_workers;
|
||||
std::vector<WorkerDetails> results;
|
||||
std::vector<LocalityData> unavailableLocals;
|
||||
|
@ -285,14 +285,15 @@ public:
|
|||
|
||||
logServerSet = Reference<LocalitySet>(new LocalityMap<WorkerDetails>());
|
||||
logServerMap = (LocalityMap<WorkerDetails>*) logServerSet.getPtr();
|
||||
|
||||
for( auto& it : id_worker ) {
|
||||
auto fitness = it.second.details.processClass.machineClassFitness( ProcessClass::TLog );
|
||||
if( workerAvailable(it.second, checkStable) && !conf.isExcludedServer(it.second.details.interf.address()) && fitness != ProcessClass::NeverAssign && (!dcIds.size() || dcIds.count(it.second.details.interf.locality.dcId())) ) {
|
||||
fitness_workers[ std::make_pair(fitness,it.second.details.degraded) ].push_back(it.second.details);
|
||||
}
|
||||
else {
|
||||
unavailableLocals.push_back(it.second.details.interf.locality);
|
||||
if (std::find(exclusionWorkerIds.begin(), exclusionWorkerIds.end(), it.second.details.interf.id()) == exclusionWorkerIds.end()) {
|
||||
auto fitness = it.second.details.processClass.machineClassFitness(ProcessClass::TLog);
|
||||
if (workerAvailable(it.second, checkStable) && !conf.isExcludedServer(it.second.details.interf.address()) && fitness != ProcessClass::NeverAssign && (!dcIds.size() || dcIds.count(it.second.details.interf.locality.dcId()))) {
|
||||
fitness_workers[std::make_pair(fitness, it.second.details.degraded)].push_back(it.second.details);
|
||||
}
|
||||
else {
|
||||
unavailableLocals.push_back(it.second.details.interf.locality);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +356,7 @@ public:
|
|||
TraceEvent(SevWarn, "GetTLogTeamFailed").detail("Policy", policy->info()).detail("Processes", logServerSet->size()).detail("Workers", id_worker.size()).detail("FitnessGroups", fitness_workers.size())
|
||||
.detail("TLogZones", ::describeZones(tLocalities)).detail("TLogDataHalls", ::describeDataHalls(tLocalities)).detail("MissingZones", ::describeZones(unavailableLocals))
|
||||
.detail("MissingDataHalls", ::describeDataHalls(unavailableLocals)).detail("Required", required).detail("DesiredLogs", desired).detail("RatingTests",SERVER_KNOBS->POLICY_RATING_TESTS)
|
||||
.detail("CheckStable", checkStable).detail("PolicyGenerations",SERVER_KNOBS->POLICY_GENERATIONS).backtrace();
|
||||
.detail("CheckStable", checkStable).detail("NumExclusionWorkers", exclusionWorkerIds.size()).detail("PolicyGenerations",SERVER_KNOBS->POLICY_GENERATIONS).backtrace();
|
||||
|
||||
logServerSet->clear();
|
||||
logServerSet.clear();
|
||||
|
@ -376,7 +377,7 @@ public:
|
|||
}
|
||||
|
||||
//FIXME: This logic will fallback unnecessarily when usable dcs > 1 because it does not check all combinations of potential satellite locations
|
||||
std::vector<WorkerDetails> getWorkersForSatelliteLogs( const DatabaseConfiguration& conf, const RegionInfo& region, std::map< Optional<Standalone<StringRef>>, int>& id_used, bool& satelliteFallback, bool checkStable = false ) {
|
||||
std::vector<WorkerDetails> getWorkersForSatelliteLogs( const DatabaseConfiguration& conf, const RegionInfo& region, const RegionInfo& remoteRegion, std::map< Optional<Standalone<StringRef>>, int>& id_used, bool& satelliteFallback, bool checkStable = false ) {
|
||||
int startDC = 0;
|
||||
loop {
|
||||
if(startDC > 0 && startDC >= region.satellites.size() + 1 - (satelliteFallback ? region.satelliteTLogUsableDcsFallback : region.satelliteTLogUsableDcs)) {
|
||||
|
@ -392,15 +393,26 @@ public:
|
|||
}
|
||||
|
||||
try {
|
||||
bool remoteDCUsedAsSatellite = false;
|
||||
std::set<Optional<Key>> satelliteDCs;
|
||||
for(int s = startDC; s < std::min<int>(startDC + (satelliteFallback ? region.satelliteTLogUsableDcsFallback : region.satelliteTLogUsableDcs), region.satellites.size()); s++) {
|
||||
satelliteDCs.insert(region.satellites[s].dcId);
|
||||
if (region.satellites[s].dcId == remoteRegion.dcId) {
|
||||
remoteDCUsedAsSatellite = true;
|
||||
}
|
||||
}
|
||||
std::vector<UID> exclusionWorkerIds;
|
||||
// FIXME: If remote DC is used as satellite then this logic only ensures that required number of remote TLogs can be recruited. It does not balance the number of desired TLogs
|
||||
// across the satellite and remote sides.
|
||||
if (remoteDCUsedAsSatellite) {
|
||||
std::map< Optional<Standalone<StringRef>>, int> tmpIdUsed;
|
||||
auto remoteLogs = getWorkersForTlogs(conf, conf.getRemoteTLogReplicationFactor(), conf.getRemoteTLogReplicationFactor(), conf.getRemoteTLogPolicy(), tmpIdUsed, false, { remoteRegion.dcId }, {});
|
||||
std::transform(remoteLogs.begin(), remoteLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerDetails &in) { return in.interf.id(); });
|
||||
}
|
||||
|
||||
if(satelliteFallback) {
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactorFallback, conf.getDesiredSatelliteLogs(region.dcId)*region.satelliteTLogUsableDcsFallback/region.satelliteTLogUsableDcs, region.satelliteTLogPolicyFallback, id_used, checkStable, satelliteDCs );
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactorFallback, conf.getDesiredSatelliteLogs(region.dcId)*region.satelliteTLogUsableDcsFallback/region.satelliteTLogUsableDcs, region.satelliteTLogPolicyFallback, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
} else {
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactor, conf.getDesiredSatelliteLogs(region.dcId), region.satelliteTLogPolicy, id_used, checkStable, satelliteDCs );
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactor, conf.getDesiredSatelliteLogs(region.dcId), region.satelliteTLogPolicy, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
}
|
||||
} catch (Error &e) {
|
||||
if(e.code() != error_code_no_more_servers) {
|
||||
|
@ -560,7 +572,7 @@ public:
|
|||
std::set<Optional<Key>> remoteDC;
|
||||
remoteDC.insert(req.dcId);
|
||||
|
||||
auto remoteLogs = getWorkersForTlogs( req.configuration, req.configuration.getRemoteTLogReplicationFactor(), req.configuration.getDesiredRemoteLogs(), req.configuration.getRemoteTLogPolicy(), id_used, false, remoteDC );
|
||||
auto remoteLogs = getWorkersForTlogs( req.configuration, req.configuration.getRemoteTLogReplicationFactor(), req.configuration.getDesiredRemoteLogs(), req.configuration.getRemoteTLogPolicy(), id_used, false, remoteDC, req.exclusionWorkerIds );
|
||||
for(int i = 0; i < remoteLogs.size(); i++) {
|
||||
result.remoteTLogs.push_back(remoteLogs[i].interf);
|
||||
}
|
||||
|
@ -602,10 +614,13 @@ public:
|
|||
result.dcId = dcId;
|
||||
|
||||
RegionInfo region;
|
||||
RegionInfo remoteRegion;
|
||||
for(auto& r : req.configuration.regions) {
|
||||
if(r.dcId == dcId.get()) {
|
||||
region = r;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
remoteRegion = r;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,7 +638,7 @@ public:
|
|||
|
||||
std::vector<WorkerDetails> satelliteLogs;
|
||||
if(region.satelliteTLogReplicationFactor > 0) {
|
||||
satelliteLogs = getWorkersForSatelliteLogs( req.configuration, region, id_used, result.satelliteFallback );
|
||||
satelliteLogs = getWorkersForSatelliteLogs( req.configuration, region, remoteRegion, id_used, result.satelliteFallback );
|
||||
for(int i = 0; i < satelliteLogs.size(); i++) {
|
||||
result.satelliteTLogs.push_back(satelliteLogs[i].interf);
|
||||
}
|
||||
|
@ -821,7 +836,7 @@ public:
|
|||
getWorkersForTlogs(db.config, db.config.tLogReplicationFactor, db.config.getDesiredLogs(), db.config.tLogPolicy, id_used, true, primaryDC);
|
||||
if(regions[0].satelliteTLogReplicationFactor > 0) {
|
||||
bool satelliteFallback = false;
|
||||
getWorkersForSatelliteLogs(db.config, regions[0], id_used, satelliteFallback, true);
|
||||
getWorkersForSatelliteLogs(db.config, regions[0], regions[1], id_used, satelliteFallback, true);
|
||||
}
|
||||
|
||||
getWorkerForRoleInDatacenter( regions[0].dcId, ProcessClass::Resolver, ProcessClass::ExcludeFit, db.config, id_used, true );
|
||||
|
@ -960,12 +975,14 @@ public:
|
|||
std::set<Optional<Key>> remoteDC;
|
||||
|
||||
RegionInfo region;
|
||||
RegionInfo remoteRegion;
|
||||
if(db.config.regions.size() && clusterControllerDcId.present()) {
|
||||
primaryDC.insert(clusterControllerDcId);
|
||||
for(auto& r : db.config.regions) {
|
||||
if(r.dcId != clusterControllerDcId.get()) {
|
||||
ASSERT(remoteDC.empty());
|
||||
remoteDC.insert(r.dcId);
|
||||
remoteRegion = r;
|
||||
} else {
|
||||
ASSERT(region.dcId == StringRef());
|
||||
region = r;
|
||||
|
@ -975,7 +992,8 @@ public:
|
|||
|
||||
// Check tLog fitness
|
||||
RoleFitness oldTLogFit(tlogs, ProcessClass::TLog);
|
||||
RoleFitness newTLogFit(getWorkersForTlogs(db.config, db.config.tLogReplicationFactor, db.config.getDesiredLogs(), db.config.tLogPolicy, id_used, true, primaryDC), ProcessClass::TLog);
|
||||
auto newTLogs = getWorkersForTlogs(db.config, db.config.tLogReplicationFactor, db.config.getDesiredLogs(), db.config.tLogPolicy, id_used, true, primaryDC);
|
||||
RoleFitness newTLogFit(newTLogs, ProcessClass::TLog);
|
||||
|
||||
if(oldTLogFit < newTLogFit) return false;
|
||||
|
||||
|
@ -990,7 +1008,8 @@ public:
|
|||
|
||||
RoleFitness oldSatelliteTLogFit(satellite_tlogs, ProcessClass::TLog);
|
||||
bool newSatelliteFallback = false;
|
||||
RoleFitness newSatelliteTLogFit(region.satelliteTLogReplicationFactor > 0 ? getWorkersForSatelliteLogs(db.config, region, id_used, newSatelliteFallback, true) : satellite_tlogs, ProcessClass::TLog);
|
||||
auto newSatelliteTLogs = region.satelliteTLogReplicationFactor > 0 ? getWorkersForSatelliteLogs(db.config, region, remoteRegion, id_used, newSatelliteFallback, true) : satellite_tlogs;
|
||||
RoleFitness newSatelliteTLogFit(newSatelliteTLogs, ProcessClass::TLog);
|
||||
|
||||
if(oldSatelliteTLogFit < newSatelliteTLogFit)
|
||||
return false;
|
||||
|
@ -998,9 +1017,13 @@ public:
|
|||
return false;
|
||||
|
||||
RoleFitness oldRemoteTLogFit(remote_tlogs, ProcessClass::TLog);
|
||||
std::vector<UID> exclusionWorkerIds;
|
||||
auto fn = [](const WorkerDetails &in) { return in.interf.id(); };
|
||||
std::transform(newTLogs.begin(), newTLogs.end(), std::back_inserter(exclusionWorkerIds), fn);
|
||||
std::transform(newSatelliteTLogs.begin(), newSatelliteTLogs.end(), std::back_inserter(exclusionWorkerIds), fn);
|
||||
RoleFitness newRemoteTLogFit(
|
||||
(db.config.usableRegions > 1 && dbi.recoveryState == RecoveryState::FULLY_RECOVERED) ?
|
||||
getWorkersForTlogs(db.config, db.config.getRemoteTLogReplicationFactor(), db.config.getDesiredRemoteLogs(), db.config.getRemoteTLogPolicy(), id_used, true, remoteDC)
|
||||
getWorkersForTlogs(db.config, db.config.getRemoteTLogReplicationFactor(), db.config.getDesiredRemoteLogs(), db.config.getRemoteTLogPolicy(), id_used, true, remoteDC, exclusionWorkerIds)
|
||||
: remote_tlogs, ProcessClass::TLog);
|
||||
if(oldRemoteTLogFit < newRemoteTLogFit) return false;
|
||||
int oldRouterCount = oldTLogFit.count * std::max<int>(1, db.config.desiredLogRouterCount / std::max(1,oldTLogFit.count));
|
||||
|
|
|
@ -104,14 +104,15 @@ struct RecruitRemoteFromConfigurationRequest {
|
|||
DatabaseConfiguration configuration;
|
||||
Optional<Key> dcId;
|
||||
int logRouterCount;
|
||||
std::vector<UID> exclusionWorkerIds;
|
||||
ReplyPromise< struct RecruitRemoteFromConfigurationReply > reply;
|
||||
|
||||
RecruitRemoteFromConfigurationRequest() {}
|
||||
RecruitRemoteFromConfigurationRequest(DatabaseConfiguration const& configuration, Optional<Key> const& dcId, int logRouterCount) : configuration(configuration), dcId(dcId), logRouterCount(logRouterCount) {}
|
||||
RecruitRemoteFromConfigurationRequest(DatabaseConfiguration const& configuration, Optional<Key> const& dcId, int logRouterCount, const std::vector<UID> &exclusionWorkerIds) : configuration(configuration), dcId(dcId), logRouterCount(logRouterCount), exclusionWorkerIds(exclusionWorkerIds){}
|
||||
|
||||
template <class Ar>
|
||||
void serialize( Ar& ar ) {
|
||||
serializer(ar, configuration, dcId, logRouterCount, reply);
|
||||
serializer(ar, configuration, dcId, logRouterCount, exclusionWorkerIds, reply);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -165,15 +165,18 @@ public:
|
|||
|
||||
bool foundDuplicate = false;
|
||||
std::set<Optional<Key>> zones;
|
||||
std::set<Optional<Key>> dcs;
|
||||
for(auto& loc : tLogLocalities) {
|
||||
if(zones.count(loc.zoneId())) {
|
||||
foundDuplicate = true;
|
||||
break;
|
||||
}
|
||||
zones.insert(loc.zoneId());
|
||||
zones.insert(loc.dcId());
|
||||
}
|
||||
bool moreThanOneDC = dcs.size() > 1 ? true : false;
|
||||
|
||||
TraceEvent(((maxUsed - minUsed > 1) || (maxUsedBest - minUsedBest > 1)) ? (g_network->isSimulated() && !foundDuplicate ? SevError : SevWarnAlways) : SevInfo, "CheckSatelliteTagLocations").detail("MinUsed", minUsed).detail("MaxUsed", maxUsed).detail("MinUsedBest", minUsedBest).detail("MaxUsedBest", maxUsedBest).detail("DuplicateZones", foundDuplicate);
|
||||
TraceEvent(((maxUsed - minUsed > 1) || (maxUsedBest - minUsedBest > 1)) ? (g_network->isSimulated() && !foundDuplicate && !moreThanOneDC ? SevError : SevWarnAlways) : SevInfo, "CheckSatelliteTagLocations").detail("MinUsed", minUsed).detail("MaxUsed", maxUsed).detail("MinUsedBest", minUsedBest).detail("MaxUsedBest", maxUsedBest).detail("DuplicateZones", foundDuplicate).detail("NumOfDCs", dcs.size());
|
||||
}
|
||||
|
||||
int bestLocationFor( Tag tag ) {
|
||||
|
|
|
@ -882,32 +882,6 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
|
||||
bool needsRemote = generateFearless;
|
||||
if(generateFearless) {
|
||||
StatusObject primarySatelliteObj;
|
||||
primarySatelliteObj["id"] = "2";
|
||||
primarySatelliteObj["priority"] = 1;
|
||||
primarySatelliteObj["satellite"] = 1;
|
||||
primaryDcArr.push_back(primarySatelliteObj);
|
||||
|
||||
StatusObject remoteSatelliteObj;
|
||||
remoteSatelliteObj["id"] = "3";
|
||||
remoteSatelliteObj["priority"] = 1;
|
||||
remoteSatelliteObj["satellite"] = 1;
|
||||
remoteDcArr.push_back(remoteSatelliteObj);
|
||||
|
||||
if(datacenters > 4) {
|
||||
StatusObject primarySatelliteObjB;
|
||||
primarySatelliteObjB["id"] = "4";
|
||||
primarySatelliteObjB["priority"] = 1;
|
||||
primarySatelliteObjB["satellite"] = 1;
|
||||
primaryDcArr.push_back(primarySatelliteObjB);
|
||||
|
||||
StatusObject remoteSatelliteObjB;
|
||||
remoteSatelliteObjB["id"] = "5";
|
||||
remoteSatelliteObjB["priority"] = 1;
|
||||
remoteSatelliteObjB["satellite"] = 1;
|
||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||
}
|
||||
|
||||
if(datacenters > 4) {
|
||||
//FIXME: we cannot use one satellite replication with more than one satellite per region because canKillProcesses does not respect usable_dcs
|
||||
int satellite_replication_type = g_random->randomInt(0,3);
|
||||
|
@ -1013,6 +987,36 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
|
||||
if (g_random->random01() < 0.25) db.desiredLogRouterCount = g_random->randomInt(1,7);
|
||||
if (g_random->random01() < 0.25) db.remoteDesiredTLogCount = g_random->randomInt(1,7);
|
||||
|
||||
bool useNormalDCsAsSatellites = datacenters > 4 && minimumRegions < 2 && g_random->random01() < 0.3;
|
||||
StatusObject primarySatelliteObj;
|
||||
primarySatelliteObj["id"] = useNormalDCsAsSatellites ? "1" : "2";
|
||||
primarySatelliteObj["priority"] = 1;
|
||||
primarySatelliteObj["satellite"] = 1;
|
||||
primaryDcArr.push_back(primarySatelliteObj);
|
||||
|
||||
StatusObject remoteSatelliteObj;
|
||||
remoteSatelliteObj["id"] = useNormalDCsAsSatellites ? "0" : "3";
|
||||
remoteSatelliteObj["priority"] = 1;
|
||||
remoteSatelliteObj["satellite"] = 1;
|
||||
remoteDcArr.push_back(remoteSatelliteObj);
|
||||
|
||||
if (datacenters > 4) {
|
||||
StatusObject primarySatelliteObjB;
|
||||
primarySatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "4";
|
||||
primarySatelliteObjB["priority"] = 1;
|
||||
primarySatelliteObjB["satellite"] = 1;
|
||||
primaryDcArr.push_back(primarySatelliteObjB);
|
||||
|
||||
StatusObject remoteSatelliteObjB;
|
||||
remoteSatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "5";
|
||||
remoteSatelliteObjB["priority"] = 1;
|
||||
remoteSatelliteObjB["satellite"] = 1;
|
||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||
}
|
||||
if (useNormalDCsAsSatellites) {
|
||||
datacenters = 3;
|
||||
}
|
||||
}
|
||||
|
||||
primaryObj["datacenters"] = primaryDcArr;
|
||||
|
|
|
@ -320,7 +320,10 @@ ACTOR Future<Void> newTLogServers( Reference<MasterData> self, RecruitFromConfig
|
|||
TraceEvent(SevWarn, "UnknownRemoteDCID", self->dbgid).detail("RemoteId", printable(remoteDcId)).detail("Loc", loc);
|
||||
}
|
||||
|
||||
Future<RecruitRemoteFromConfigurationReply> fRemoteWorkers = brokenPromiseToNever( self->clusterController.recruitRemoteFromConfiguration.getReply( RecruitRemoteFromConfigurationRequest( self->configuration, remoteDcId, recr.tLogs.size() * std::max<int>(1, self->configuration.desiredLogRouterCount / std::max<int>(1, recr.tLogs.size())) ) ) );
|
||||
std::vector<UID> exclusionWorkerIds;
|
||||
std::transform(recr.tLogs.begin(), recr.tLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerInterface &in) { return in.id(); });
|
||||
std::transform(recr.satelliteTLogs.begin(), recr.satelliteTLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerInterface &in) { return in.id(); });
|
||||
Future<RecruitRemoteFromConfigurationReply> fRemoteWorkers = brokenPromiseToNever( self->clusterController.recruitRemoteFromConfiguration.getReply( RecruitRemoteFromConfigurationRequest( self->configuration, remoteDcId, recr.tLogs.size() * std::max<int>(1, self->configuration.desiredLogRouterCount / std::max<int>(1, recr.tLogs.size())), exclusionWorkerIds) ) );
|
||||
|
||||
self->primaryLocality = self->dcId_locality[recr.dcId];
|
||||
Reference<ILogSystem> newLogSystem = wait( oldLogSystem->newEpoch( recr, fRemoteWorkers, self->configuration, self->cstate.myDBState.recoveryCount + 1, self->primaryLocality, self->dcId_locality[remoteDcId], self->allTags, self->recruitmentStalled ) );
|
||||
|
|
Loading…
Reference in New Issue