Skip to content

Commit 28cd389

Browse files
author
Markus Pilman
committed
Merge branch 'master' of github.com:apple/foundationdb into features/boost70
2 parents c2ccbba + 137ea71 commit 28cd389

File tree

264 files changed

+15073
-5413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+15073
-5413
lines changed

CMakeLists.txt

+3-6
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ set(SEED "0x${SEED_}" CACHE STRING "Random seed for testing")
179179
################################################################################
180180

181181
include(CompileBoost)
182-
if(WITH_TLS)
183-
add_subdirectory(FDBLibTLS)
184-
endif()
185182
add_subdirectory(flow)
186183
add_subdirectory(fdbrpc)
187184
add_subdirectory(fdbclient)
@@ -192,15 +189,15 @@ if(NOT WIN32)
192189
else()
193190
add_subdirectory(fdbservice)
194191
endif()
192+
add_subdirectory(fdbbackup)
193+
add_subdirectory(contrib)
194+
add_subdirectory(tests)
195195
if(WITH_PYTHON)
196196
add_subdirectory(bindings)
197197
endif()
198-
add_subdirectory(fdbbackup)
199-
add_subdirectory(tests)
200198
if(WITH_DOCUMENTATION)
201199
add_subdirectory(documentation)
202200
endif()
203-
add_subdirectory(contrib/monitoring)
204201

205202
if(WIN32)
206203
add_subdirectory(packaging/msi)

Makefile

+4-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ifeq ($(PLATFORM),Linux)
5151
CXXFLAGS += -std=c++17
5252

5353
BOOST_BASEDIR ?= /opt
54-
TLS_LIBDIR ?= /usr/local/lib
54+
TLS_LIBDIR ?= /usr/local/lib64
5555
DLEXT := so
5656
java_DLEXT := so
5757
TARGET_LIBC_VERSION ?= 2.11
@@ -67,7 +67,7 @@ else ifeq ($(PLATFORM),Darwin)
6767
.LIBPATTERNS := lib%.dylib lib%.a
6868

6969
BOOST_BASEDIR ?= ${HOME}
70-
TLS_LIBDIR ?= /usr/local/lib
70+
TLS_LIBDIR ?= /usr/local/lib64
7171
DLEXT := dylib
7272
java_DLEXT := jnilib
7373
else
@@ -112,8 +112,8 @@ CFLAGS += -DTLS_DISABLED
112112
FDB_TLS_LIB :=
113113
TLS_LIBS :=
114114
else
115-
FDB_TLS_LIB := lib/libFDBLibTLS.a
116-
TLS_LIBS += $(addprefix $(TLS_LIBDIR)/,libtls.a libssl.a libcrypto.a)
115+
FDB_TLS_LIB :=
116+
TLS_LIBS += $(addprefix $(TLS_LIBDIR)/,libssl.a libcrypto.a)
117117
endif
118118

119119
CXXFLAGS += -Wno-deprecated -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED
@@ -126,9 +126,6 @@ VPATH += $(addprefix :,$(filter-out lib,$(patsubst -L%,%,$(filter -L%,$(LDFLAGS)
126126

127127
CS_PROJECTS := flow/actorcompiler flow/coveragetool fdbclient/vexillographer
128128
CPP_PROJECTS := flow fdbrpc fdbclient fdbbackup fdbserver fdbcli bindings/c bindings/java fdbmonitor bindings/flow/tester bindings/flow
129-
ifndef TLS_DISABLED
130-
CPP_PROJECTS += FDBLibTLS
131-
endif
132129
OTHER_PROJECTS := bindings/python bindings/ruby bindings/go
133130

134131
CS_MK_GENERATED := $(CS_PROJECTS:=/generated.mk)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ If you want to create a package you have to tell cmake what platform it is for.
133133
And then you can build by simply calling `cpack`. So for debian, call:
134134

135135
```
136-
cmake -DINSTALL_LAYOUT=DEB <FDB_SOURCE_DIR>
136+
cmake <FDB_SOURCE_DIR>
137137
make
138-
cpack
138+
cpack -G DEB
139139
```
140140

141141
For RPM simply replace `DEB` with `RPM`.
@@ -155,9 +155,9 @@ To generate a installable package, you have to call CMake with the corresponding
155155
arguments and then use cpack to generate the package:
156156

157157
```sh
158-
cmake -DINSTALL_LAYOUT=OSX <FDB_SOURCE_DIR>
158+
cmake <FDB_SOURCE_DIR>
159159
make
160-
cpack
160+
cpack -G productbuild
161161
```
162162

163163
### Windows

bindings/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ endif()
1313
if(WITH_RUBY)
1414
add_subdirectory(ruby)
1515
endif()
16+
if(NOT WIN32 AND NOT OPEN_FOR_IDE)
17+
package_bindingtester()
18+
endif()

bindings/bindingtester/run_binding_tester.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ BREAKONERROR="${BREAKONERROR:-0}"
2525
RUNSCRIPTS="${RUNSCRIPTS:-1}"
2626
RUNTESTS="${RUNTESTS:-1}"
2727
RANDOMTEST="${RANDOMTEST:-0}"
28-
BINDINGTESTS="${BINDINGTESTS:-python python3 java java_async ruby go flow}"
28+
# BINDINGTESTS="${BINDINGTESTS:-python python3 java java_async ruby go flow}"
29+
BINDINGTESTS="${BINDINGTESTS:-python python3 java java_async go flow}"
2930
LOGLEVEL="${LOGLEVEL:-INFO}"
3031
_BINDINGTESTS=(${BINDINGTESTS})
3132
DISABLEDTESTS=()

bindings/bindingtester/spec/bindingApiTester.md

+7
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ futures must apply the following rules to the result:
164164
database using the get() method. May optionally push a future onto the
165165
stack.
166166

167+
#### GET_ESTIMATED_RANGE_SIZE
168+
169+
Pops the top two items off of the stack as BEGIN_KEY and END_KEY to
170+
construct a key range. Then call the `getEstimatedRangeSize` API of
171+
the language binding. Make sure the API returns without error. Finally
172+
push the string "GOT_ESTIMATED_RANGE_SIZE" onto the stack.
173+
167174
#### GET_KEY (_SNAPSHOT, _DATABASE)
168175

169176
Pops the top four items off of the stack as KEY, OR_EQUAL, OFFSET, PREFIX

bindings/bindingtester/tests/api.py

+17
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def generate(self, args, thread_number):
157157
read_conflicts = ['READ_CONFLICT_RANGE', 'READ_CONFLICT_KEY']
158158
write_conflicts = ['WRITE_CONFLICT_RANGE', 'WRITE_CONFLICT_KEY', 'DISABLE_WRITE_CONFLICT']
159159
txn_sizes = ['GET_APPROXIMATE_SIZE']
160+
storage_metrics = ['GET_ESTIMATED_RANGE_SIZE']
160161

161162
op_choices += reads
162163
op_choices += mutations
@@ -170,6 +171,7 @@ def generate(self, args, thread_number):
170171
op_choices += write_conflicts
171172
op_choices += resets
172173
op_choices += txn_sizes
174+
op_choices += storage_metrics
173175

174176
idempotent_atomic_ops = ['BIT_AND', 'BIT_OR', 'MAX', 'MIN', 'BYTE_MIN', 'BYTE_MAX']
175177
atomic_ops = idempotent_atomic_ops + ['ADD', 'BIT_XOR', 'APPEND_IF_FITS']
@@ -536,6 +538,21 @@ def generate(self, args, thread_number):
536538
instructions.push_args(d)
537539
instructions.append(op)
538540
self.add_strings(1)
541+
elif op == 'GET_ESTIMATED_RANGE_SIZE':
542+
# Protect against inverted range and identical keys
543+
key1 = self.workspace.pack(self.random.random_tuple(1))
544+
key2 = self.workspace.pack(self.random.random_tuple(1))
545+
546+
while key1 == key2:
547+
key1 = self.workspace.pack(self.random.random_tuple(1))
548+
key2 = self.workspace.pack(self.random.random_tuple(1))
549+
550+
if key1 > key2:
551+
key1, key2 = key2, key1
552+
553+
instructions.push_args(key1, key2)
554+
instructions.append(op)
555+
self.add_strings(1)
539556

540557
else:
541558
assert False, 'Unknown operation: ' + op

bindings/c/CMakeLists.txt

+15
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ else()
3838
endif()
3939
add_dependencies(fdb_c fdb_c_generated fdb_c_options)
4040
target_link_libraries(fdb_c PUBLIC $<BUILD_INTERFACE:fdbclient>)
41+
if(APPLE)
42+
set(symbols ${CMAKE_CURRENT_BINARY_DIR}/fdb_c.symbols)
43+
add_custom_command(OUTPUT ${symbols}
44+
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py
45+
${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h
46+
${symbols}
47+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h
48+
COMMENT "Generate exported_symbols_list")
49+
add_custom_target(exported_symbols_list DEPENDS ${symbols})
50+
add_dependencies(fdb_c exported_symbols_list)
51+
target_link_options(fdb_c PRIVATE "LINKER:-no_weak_exports,-exported_symbols_list,${symbols}")
52+
elseif(WIN32)
53+
else()
54+
target_link_options(fdb_c PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/fdb_c.map,-z,nodelete")
55+
endif()
4156
target_include_directories(fdb_c PUBLIC
4257
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
4358
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

bindings/c/symbolify.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if __name__ == '__main__':
2+
import re
3+
import sys
4+
r = re.compile('DLLEXPORT[^(]*(fdb_[^(]*)[(]')
5+
(fdb_c_h, symbols_file) = sys.argv[1:]
6+
with open(fdb_c_h, 'r') as f:
7+
symbols = sorted(set('_' + m.group(1) for m in r.finditer(f.read())))
8+
with open(symbols_file, 'w') as f:
9+
f.write('\n'.join(symbols))
10+
f.write('\n')

bindings/flow/fdb_flow.actor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "flow/DeterministicRandom.h"
2727
#include "flow/SystemMonitor.h"
28+
#include "flow/TLSConfig.actor.h"
2829
#include "flow/actorcompiler.h" // This must be the last #include.
2930

3031
using namespace FDB;
@@ -82,7 +83,7 @@ void fdb_flow_test() {
8283
fdb->setupNetwork();
8384
startThread(networkThread, fdb);
8485

85-
g_network = newNet2( false );
86+
g_network = newNet2(TLSConfig());
8687

8788
openTraceFile(NetworkAddress(), 1000000, 1000000, ".");
8889
systemMonitor();

bindings/flow/tester/Tester.actor.cpp

+27-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "bindings/flow/FDBLoanerTypes.h"
2929
#include "fdbrpc/fdbrpc.h"
3030
#include "flow/DeterministicRandom.h"
31+
#include "flow/TLSConfig.actor.h"
3132
#include "flow/actorcompiler.h" // This must be the last #include.
3233

3334
// Otherwise we have to type setupNetwork(), FDB::open(), etc.
@@ -429,9 +430,8 @@ struct LogStackFunc : InstructionFunc {
429430
wait(logStack(data, entries, prefix));
430431
entries.clear();
431432
}
432-
433-
wait(logStack(data, entries, prefix));
434433
}
434+
wait(logStack(data, entries, prefix));
435435

436436
return Void();
437437
}
@@ -638,6 +638,29 @@ struct GetFunc : InstructionFunc {
638638
const char* GetFunc::name = "GET";
639639
REGISTER_INSTRUCTION_FUNC(GetFunc);
640640

641+
struct GetEstimatedRangeSize : InstructionFunc {
642+
static const char* name;
643+
644+
ACTOR static Future<Void> call(Reference<FlowTesterData> data, Reference<InstructionData> instruction) {
645+
state std::vector<StackItem> items = data->stack.pop(2);
646+
if (items.size() != 2)
647+
return Void();
648+
649+
Standalone<StringRef> s1 = wait(items[0].value);
650+
state Standalone<StringRef> beginKey = Tuple::unpack(s1).getString(0);
651+
652+
Standalone<StringRef> s2 = wait(items[1].value);
653+
state Standalone<StringRef> endKey = Tuple::unpack(s2).getString(0);
654+
Future<int64_t> fsize = instruction->tr->getEstimatedRangeSizeBytes(KeyRangeRef(beginKey, endKey));
655+
int64_t size = wait(fsize);
656+
data->stack.pushTuple(LiteralStringRef("GOT_ESTIMATED_RANGE_SIZE"));
657+
658+
return Void();
659+
}
660+
};
661+
const char* GetEstimatedRangeSize::name = "GET_ESTIMATED_RANGE_SIZE";
662+
REGISTER_INSTRUCTION_FUNC(GetEstimatedRangeSize);
663+
641664
struct GetKeyFunc : InstructionFunc {
642665
static const char* name;
643666

@@ -1748,7 +1771,7 @@ ACTOR void startTest(std::string clusterFilename, StringRef prefix, int apiVersi
17481771
populateOpsThatCreateDirectories(); // FIXME
17491772

17501773
// This is "our" network
1751-
g_network = newNet2(false);
1774+
g_network = newNet2(TLSConfig());
17521775

17531776
ASSERT(!API::isAPIVersionSelected());
17541777
try {
@@ -1791,7 +1814,7 @@ ACTOR void startTest(std::string clusterFilename, StringRef prefix, int apiVersi
17911814

17921815
ACTOR void _test_versionstamp() {
17931816
try {
1794-
g_network = newNet2(false);
1817+
g_network = newNet2(TLSConfig());
17951818

17961819
API *fdb = FDB::API::selectAPIVersion(700);
17971820

bindings/flow/tester/local.mk

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
fdb_flow_tester_CFLAGS := -Ibindings/c $(fdbrpc_CFLAGS)
2424
fdb_flow_tester_LDFLAGS := -Llib $(fdbrpc_LDFLAGS) -lfdb_c
2525
fdb_flow_tester_LIBS := lib/libfdb_flow.a lib/libflow.a lib/libfdb_c.$(DLEXT)
26+
fdb_flow_tester_STATIC_LIBS := $(TLS_LIBS)
2627

2728
fdb_flow_tester: lib/libfdb_c.$(DLEXT)
2829
@mkdir -p bindings/flow/bin

bindings/go/src/_stacktester/stacktester.go

+10
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,16 @@ func (sm *StackMachine) processInst(idx int, inst tuple.Tuple) {
569569
}
570570

571571
sm.store(idx, res.(fdb.FutureByteSlice))
572+
case op == "GET_ESTIMATED_RANGE_SIZE":
573+
r := sm.popKeyRange()
574+
_, e := rt.ReadTransact(func(rtr fdb.ReadTransaction) (interface{}, error) {
575+
_ = rtr.GetEstimatedRangeSizeBytes(r).MustGet()
576+
sm.store(idx, []byte("GOT_ESTIMATED_RANGE_SIZE"))
577+
return nil, nil
578+
})
579+
if e != nil {
580+
panic(e)
581+
}
572582
case op == "COMMIT":
573583
sm.store(idx, sm.currentTransaction().Commit())
574584
case op == "RESET":

bindings/go/src/fdb/generated.go

+18-10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ func (o NetworkOptions) SetTraceFormat(param string) error {
8888
return o.setOpt(34, []byte(param))
8989
}
9090

91+
// Select clock source for trace files. now (default) or realtime are supported.
92+
//
93+
// Parameter: Trace clock source
94+
func (o NetworkOptions) SetTraceClockSource(param string) error {
95+
return o.setOpt(35, []byte(param))
96+
}
97+
9198
// Set internal tuning or debugging knobs
9299
//
93100
// Parameter: knob_name=knob_value
@@ -323,7 +330,7 @@ func (o DatabaseOptions) SetTransactionCausalReadRisky() error {
323330
return o.setOpt(504, nil)
324331
}
325332

326-
// Addresses returned by get_addresses_for_key include the port when enabled. This will be enabled by default in api version 700, and this option will be deprecated.
333+
// Addresses returned by get_addresses_for_key include the port when enabled. As of api version 700, this option is enabled by default and setting this has no effect.
327334
func (o DatabaseOptions) SetTransactionIncludePortInAddress() error {
328335
return o.setOpt(505, nil)
329336
}
@@ -343,7 +350,7 @@ func (o TransactionOptions) SetCausalReadDisable() error {
343350
return o.setOpt(21, nil)
344351
}
345352

346-
// Addresses returned by get_addresses_for_key include the port when enabled. This will be enabled by default in api version 700, and this option will be deprecated.
353+
// Addresses returned by get_addresses_for_key include the port when enabled. As of api version 700, this option is enabled by default and setting this has no effect.
347354
func (o TransactionOptions) SetIncludePortInAddress() error {
348355
return o.setOpt(23, nil)
349356
}
@@ -505,13 +512,14 @@ const (
505512
// small portion of data is transferred to the client initially (in order to
506513
// minimize costs if the client doesn't read the entire range), and as the
507514
// caller iterates over more items in the range larger batches will be
508-
// transferred in order to minimize latency.
515+
// transferred in order to minimize latency. After enough iterations, the
516+
// iterator mode will eventually reach the same byte limit as ``WANT_ALL``
509517
StreamingModeIterator StreamingMode = 0
510518

511519
// Infrequently used. The client has passed a specific row limit and wants
512520
// that many rows delivered in a single batch. Because of iterator operation
513521
// in client drivers make request batches transparent to the user, consider
514-
// WANT_ALL StreamingMode instead. A row limit must be specified if this
522+
// ``WANT_ALL`` StreamingMode instead. A row limit must be specified if this
515523
// mode is used.
516524
StreamingModeExact StreamingMode = 1
517525

@@ -628,15 +636,15 @@ type ErrorPredicate int
628636

629637
const (
630638

631-
// Returns true if the error indicates the operations in the transactions
632-
// should be retried because of transient error.
639+
// Returns ``true`` if the error indicates the operations in the
640+
// transactions should be retried because of transient error.
633641
ErrorPredicateRetryable ErrorPredicate = 50000
634642

635-
// Returns true if the error indicates the transaction may have succeeded,
636-
// though not in a way the system can verify.
643+
// Returns ``true`` if the error indicates the transaction may have
644+
// succeeded, though not in a way the system can verify.
637645
ErrorPredicateMaybeCommitted ErrorPredicate = 50001
638646

639-
// Returns true if the error indicates the transaction has not committed,
640-
// though in a way that can be retried.
647+
// Returns ``true`` if the error indicates the transaction has not
648+
// committed, though in a way that can be retried.
641649
ErrorPredicateRetryableNotCommitted ErrorPredicate = 50002
642650
)

bindings/go/src/fdb/range.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ type RangeOptions struct {
5454
// Reverse indicates that the read should be performed in lexicographic
5555
// (false) or reverse lexicographic (true) order. When Reverse is true and
5656
// Limit is non-zero, the last Limit key-value pairs in the range are
57-
// returned.
57+
// returned. Reading ranges in reverse is supported natively by the
58+
// database and should have minimal extra cost.
5859
Reverse bool
5960
}
6061

bindings/go/src/fdb/transaction.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ func (t *transaction) getEstimatedRangeSizeBytes(beginKey Key, endKey Key) Futur
318318
}
319319
}
320320

321-
// GetEstimatedRangeSizeBytes will get the byte size of the key range based on the
322-
// byte sample collected by FDB
321+
// GetEstimatedRangeSizeBytes will get an estimate for the number of bytes
322+
// stored in the given range.
323323
func (t Transaction) GetEstimatedRangeSizeBytes(r ExactRange) FutureInt64 {
324324
beginKey, endKey := r.FDBRangeKeys()
325325
return t.getEstimatedRangeSizeBytes(

0 commit comments

Comments
 (0)