do not unlink fdb_c in tmp dir if knob set

This commit is contained in:
Dan Lambright 2022-10-07 16:32:28 -04:00
parent e8e1de16b6
commit 2402b813e9
4 changed files with 10 additions and 8 deletions

View File

@ -182,19 +182,15 @@ public class JNIUtil {
private static OS getRunningOS() {
String osname = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.arch");
Boolean eagerDelete = true;
if (System.getProperty("fdb.bindings.java.eager_delete") != null) {
eagerDelete = false;
}
if (!arch.equals("amd64") && !arch.equals("x86_64") && !arch.equals("aarch64") && !arch.equals("ppc64le")) {
throw new IllegalStateException("Unknown or unsupported arch: " + arch);
}
if (osname.startsWith("windows")) {
return new OS("windows", arch, /* canDeleteEager */ false);
} else if (osname.startsWith("linux")) {
return new OS("linux", arch, /* canDeleteEager */ eagerDelete);
return new OS("linux", arch, /* canDeleteEager */ true);
} else if (osname.startsWith("mac") || osname.startsWith("darwin")) {
return new OS("osx", arch, /* canDeleteEager */ eagerDelete);
return new OS("osx", arch, /* canDeleteEager */ true);
} else {
throw new IllegalStateException("Unknown or unsupported OS: " + osname);
}

View File

@ -198,6 +198,7 @@ void ClientKnobs::initialize(Randomize randomize) {
init( DEFAULT_AUTO_LOGS, 3 );
init( DEFAULT_COMMIT_GRV_PROXIES_RATIO, 3 );
init( DEFAULT_MAX_GRV_PROXIES, 4 );
init( UNLINKONLOAD_FDBCLIB, true ); // if false, don't delete libfdb_c in tmp directory on client connect.
init( GLOBAL_CONFIG_REFRESH_BACKOFF, 0.5 );
init( GLOBAL_CONFIG_REFRESH_MAX_BACKOFF, 60.0 );

View File

@ -2537,8 +2537,12 @@ void MultiVersionApi::setupNetwork() {
externalClients[filename] = {};
auto libCopies = copyExternalLibraryPerThread(path);
for (int idx = 0; idx < libCopies.size(); ++idx) {
bool unlinkOnLoad = libCopies[idx].second;
if (!CLIENT_KNOBS->UNLINKONLOAD_FDBCLIB) {
unlinkOnLoad = false;
}
externalClients[filename].push_back(Reference<ClientInfo>(
new ClientInfo(new DLApi(libCopies[idx].first, libCopies[idx].second /*unlink on load*/),
new ClientInfo(new DLApi(libCopies[idx].first, unlinkOnLoad /*unlink on load*/),
path,
useFutureVersion,
idx)));
@ -2552,7 +2556,7 @@ void MultiVersionApi::setupNetwork() {
//
// Typically we would create a more specific error for this case, but since we expect
// this case to go away soon, we can use a trace event and a generic error.
TraceEvent(SevWarn, "CannotSetupNetwork")
TraceEvent("CannotSetupNetwork")
.detail("Reason", "Local client is disabled and no external clients configured");
throw client_invalid_operation();

View File

@ -199,6 +199,7 @@ public:
int32_t DEFAULT_MAX_GRV_PROXIES;
int32_t DEFAULT_AUTO_RESOLVERS;
int32_t DEFAULT_AUTO_LOGS;
bool UNLINKONLOAD_FDBCLIB;
double GLOBAL_CONFIG_REFRESH_BACKOFF;
double GLOBAL_CONFIG_REFRESH_MAX_BACKOFF;