Skip to content

Commit 5f1c923

Browse files
authored
Merge branch 'release-7.1' into cp-710
2 parents 346b2e4 + 288e922 commit 5f1c923

File tree

8 files changed

+51
-23
lines changed

8 files changed

+51
-23
lines changed

bindings/c/test/apitester/TesterOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class TesterOptions {
4242
int numClients;
4343
std::vector<std::pair<std::string, std::string>> knobs;
4444
TestSpec testSpec;
45+
bool retainClientLibCopies = false;
4546
};
4647

4748
} // namespace FdbApiTester

bindings/c/test/apitester/fdb_c_api_tester.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ enum TesterOptionId {
4545
OPT_TRACE_FORMAT,
4646
OPT_KNOB,
4747
OPT_EXTERNAL_CLIENT_LIBRARY,
48-
OPT_TEST_FILE
48+
OPT_TEST_FILE,
49+
OPT_RETAIN_CLIENT_LIB_COPIES
4950
};
5051

5152
CSimpleOpt::SOption TesterOptionDefs[] = //
@@ -61,6 +62,7 @@ CSimpleOpt::SOption TesterOptionDefs[] = //
6162
{ OPT_EXTERNAL_CLIENT_LIBRARY, "--external-client-library", SO_REQ_SEP },
6263
{ OPT_TEST_FILE, "-f", SO_REQ_SEP },
6364
{ OPT_TEST_FILE, "--test-file", SO_REQ_SEP },
65+
{ OPT_RETAIN_CLIENT_LIB_COPIES, "--retain-client-lib-copies", SO_NONE },
6466
SO_END_OF_OPTIONS };
6567

6668
void printProgramUsage(const char* execName) {
@@ -144,6 +146,10 @@ bool processArg(TesterOptions& options, const CSimpleOpt& args) {
144146
options.testFile = args.OptionArg();
145147
options.testSpec = readTomlTestSpec(options.testFile);
146148
break;
149+
150+
case OPT_RETAIN_CLIENT_LIB_COPIES:
151+
options.retainClientLibCopies = true;
152+
break;
147153
}
148154
return true;
149155
}
@@ -205,6 +211,10 @@ void applyNetworkOptions(TesterOptions& options) {
205211
fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_TRACE_LOG_GROUP, options.logGroup));
206212
}
207213

214+
if (options.retainClientLibCopies) {
215+
fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_RETAIN_CLIENT_LIBRARY_COPIES));
216+
}
217+
208218
for (auto knob : options.knobs) {
209219
fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_KNOB,
210220
fmt::format("{}={}", knob.first.c_str(), knob.second.c_str())));

bindings/c/test/apitester/run_c_api_tests.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def run_tester(args, test_file):
5454
if args.external_client_library is not None:
5555
cmd += ["--external-client-library", args.external_client_library]
5656

57+
if args.retain_client_lib_copies:
58+
cmd += ["--retain-client-lib-copies"]
59+
5760
get_logger().info('\nRunning tester \'%s\'...' % ' '.join(cmd))
5861
proc = Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
5962
timed_out = False
@@ -111,7 +114,12 @@ def parse_args(argv):
111114
help='The timeout in seconds for running each individual test. (default 300)')
112115
parser.add_argument('--logging-level', type=str, default='INFO',
113116
choices=['ERROR', 'WARNING', 'INFO', 'DEBUG'], help='Specifies the level of detail in the tester output (default=\'INFO\').')
114-
117+
parser.add_argument(
118+
"--retain-client-lib-copies",
119+
action="store_true",
120+
default=False,
121+
help="Retain temporary external client library copies.",
122+
)
115123
return parser.parse_args(argv)
116124

117125

bindings/go/src/fdb/generated.go

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ func int64ToBytes(i int64) []byte {
3939
return buf
4040
}
4141

42+
// Retain temporary external client library copies that are created for enabling multi-threading.
43+
func (o NetworkOptions) SetRetainClientLibraryCopies() error {
44+
return o.setOpt(67, nil)
45+
}
46+
4247
// Deprecated
4348
//
4449
// Parameter: IP:PORT
@@ -617,12 +622,12 @@ const (
617622
StreamingModeWantAll StreamingMode = -1
618623

619624
// The default. The client doesn't know how much of the range it is likely
620-
// to used and wants different performance concerns to be balanced. Only a
621-
// small portion of data is transferred to the client initially (in order to
622-
// minimize costs if the client doesn't read the entire range), and as the
623-
// caller iterates over more items in the range larger batches will be
624-
// transferred in order to minimize latency. After enough iterations, the
625-
// iterator mode will eventually reach the same byte limit as “WANT_ALL“
625+
// to used and wants different performance concerns to be balanced.
626+
// Only a small portion of data is transferred to the client initially (in
627+
// order to minimize costs if the client doesn't read the entire range), and
628+
// as the caller iterates over more items in the range larger batches will
629+
// be transferred in order to minimize latency. After enough iterations,
630+
// the iterator mode will eventually reach the same byte limit as “WANT_ALL“
626631
StreamingModeIterator StreamingMode = 0
627632

628633
// Infrequently used. The client has passed a specific row limit and wants
@@ -632,25 +637,25 @@ const (
632637
// mode is used.
633638
StreamingModeExact StreamingMode = 1
634639

635-
// Infrequently used. Transfer data in batches small enough to not be much
636-
// more expensive than reading individual rows, to minimize cost if
640+
// Infrequently used. Transfer data in batches small enough to not be
641+
// much more expensive than reading individual rows, to minimize cost if
637642
// iteration stops early.
638643
StreamingModeSmall StreamingMode = 2
639644

640645
// Infrequently used. Transfer data in batches sized in between small and
641646
// large.
642647
StreamingModeMedium StreamingMode = 3
643648

644-
// Infrequently used. Transfer data in batches large enough to be, in a
645-
// high-concurrency environment, nearly as efficient as possible. If the
646-
// client stops iteration early, some disk and network bandwidth may be
647-
// wasted. The batch size may still be too small to allow a single client to
648-
// get high throughput from the database, so if that is what you need
649+
// Infrequently used. Transfer data in batches large enough to be,
650+
// in a high-concurrency environment, nearly as efficient as possible.
651+
// If the client stops iteration early, some disk and network bandwidth may
652+
// be wasted. The batch size may still be too small to allow a single client
653+
// to get high throughput from the database, so if that is what you need
649654
// consider the SERIAL StreamingMode.
650655
StreamingModeLarge StreamingMode = 4
651656

652-
// Transfer data in batches large enough that an individual client can get
653-
// reasonable read bandwidth from the database. If the client stops
657+
// Transfer data in batches large enough that an individual client can
658+
// get reasonable read bandwidth from the database. If the client stops
654659
// iteration early, considerable disk and network bandwidth may be wasted.
655660
StreamingModeSerial StreamingMode = 5
656661
)

fdbclient/ClientKnobs.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ void ClientKnobs::initialize(Randomize randomize) {
203203
init( DEFAULT_AUTO_LOGS, 3 );
204204
init( DEFAULT_COMMIT_GRV_PROXIES_RATIO, 3 );
205205
init( DEFAULT_MAX_GRV_PROXIES, 4 );
206-
init( UNLINKONLOAD_FDBCLIB, true ); // if false, don't delete libfdb_c in tmp directory on client connect.
207206

208207
init( IS_ACCEPTABLE_DELAY, 1.5 );
209208

fdbclient/MultiVersionTransaction.actor.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,9 @@ void MultiVersionApi::setNetworkOptionInternal(FDBNetworkOptions::Option option,
21342134
// multiple client threads are not supported on windows.
21352135
threadCount = extractIntOption(value, 1, 1);
21362136
#endif
2137+
} else if (option == FDBNetworkOptions::RETAIN_CLIENT_LIBRARY_COPIES) {
2138+
validateOption(value, false, true);
2139+
retainClientLibCopies = true;
21372140
} else {
21382141
forwardOption = true;
21392142
}
@@ -2177,10 +2180,7 @@ void MultiVersionApi::setupNetwork() {
21772180
if (externalClients.count(filename) == 0) {
21782181
externalClients[filename] = {};
21792182
for (const auto& tmp : copyExternalLibraryPerThread(path)) {
2180-
bool unlinkOnLoad = tmp.second;
2181-
if (!CLIENT_KNOBS->UNLINKONLOAD_FDBCLIB) {
2182-
unlinkOnLoad = false;
2183-
}
2183+
bool unlinkOnLoad = tmp.second && !retainClientLibCopies;
21842184
externalClients[filename].push_back(Reference<ClientInfo>(
21852185
new ClientInfo(new DLApi(tmp.first, unlinkOnLoad /*unlink on load*/), path)));
21862186
}
@@ -2513,7 +2513,8 @@ void MultiVersionApi::loadEnvironmentVariableNetworkOptions() {
25132513

25142514
MultiVersionApi::MultiVersionApi()
25152515
: callbackOnMainThread(true), localClientDisabled(false), networkStartSetup(false), networkSetup(false),
2516-
bypassMultiClientApi(false), externalClient(false), apiVersion(0), threadCount(0), envOptionsLoaded(false) {}
2516+
bypassMultiClientApi(false), externalClient(false), retainClientLibCopies(false), apiVersion(0), threadCount(0),
2517+
envOptionsLoaded(false) {}
25172518

25182519
MultiVersionApi* MultiVersionApi::api = new MultiVersionApi();
25192520

fdbclient/MultiVersionTransaction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,8 @@ class MultiVersionApi : public IClientApi {
894894
volatile bool networkSetup;
895895
volatile bool bypassMultiClientApi;
896896
volatile bool externalClient;
897+
bool retainClientLibCopies;
898+
897899
int apiVersion;
898900

899901
int nextThread = 0;

fdbclient/vexillographer/fdb.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ description is not currently required but encouraged.
3030

3131
<Options>
3232
<Scope name="NetworkOption">
33+
<Option name="retain_client_library_copies" code="67"
34+
description="Retain temporary external client library copies that are created for enabling multi-threading." />
3335
<Option name="local_address" code="10"
3436
paramType="String" paramDescription="IP:PORT"
3537
description="Deprecated"/>

0 commit comments

Comments
 (0)