Commit Graph

146 Commits

Author SHA1 Message Date
Justin Lowery bee8d12b24 remove multiple binary.Read calls and use a single type conversion instead 2018-10-30 14:06:03 -07:00
Justin Lowery f112ba4f07 restore NewBuffer calls, as buffer was emptied on Read calls when the value was a uint64 2018-10-30 14:06:03 -07:00
Justin Lowery 36b3818aef remove redundant calls to NewBuffer that use the bp slice. remove redundant declaration of retInt 2018-10-30 14:06:03 -07:00
Justin Lowery 0b00b4d99b keep original behavior related to decoding integers to int64, only using uint64 when needed 2018-10-30 14:06:03 -07:00
Justin Lowery 9909c1c959 add uint64 and uint types to the package documentation comments 2018-10-30 14:06:03 -07:00
Justin Lowery c6e9d2ff12 add uint64 encoding and decoding 2018-10-30 14:06:03 -07:00
A.J. Beamon b96d462ad3
Merge pull request #878 from cespare/range-error
Fix small error-handling bug in Go bindings
2018-10-29 18:12:40 -04:00
Caleb Spare edc87a9138 Fix small error-handling bug in Go bindings 2018-10-29 14:48:30 -07:00
A.J. Beamon 45e1e563ba Reword documentation for Strinc 2018-10-29 14:24:06 -07:00
A.J. Beamon 0ec1790d76 Document the Strinc function in the go bindings 2018-10-29 14:06:59 -07:00
A.J. Beamon 2be1cabc72 Support for big integers in go and ruby tuple layers 2018-10-24 15:50:07 -07:00
Evan Tschannen 2f4e7fad48 Merge branch 'master' of github.com:apple/foundationdb 2018-10-15 18:39:46 -07:00
Evan Tschannen 0217aed74c Merge branch 'release-6.0'
# Conflicts:
#	bindings/go/README.md
#	documentation/sphinx/source/release-notes.rst
#	fdbserver/MasterProxyServer.actor.cpp
#	versions.target
2018-10-15 18:38:51 -07:00
A.J. Beamon 9983c534e6 Release 6.0.13 preparation 2018-10-10 13:44:16 -07:00
A.J. Beamon b3e271bc2a Document the mutex shenanigans used to implement block until ready 2018-10-08 15:17:37 -07:00
A.J. Beamon d5357d2439 Update all of the bindings to use the new C API and deprecate or remove unneeded parts of their APIs. 2018-10-02 15:28:46 -07:00
A.J. Beamon 983a5bd390 Bump API version to 610 2018-09-26 10:58:07 -07:00
A.J. Beamon 92990d6aef Merge release-6.0 into master 2018-09-21 16:14:39 -07:00
A.J. Beamon 90c9822174 Merge branch 'release-5.2' into release-6.0, changing the API version in the go documentation in the process. 2018-09-19 11:31:11 -07:00
A.J. Beamon fdba3c0f05 Update go bindings README. 2018-09-06 13:19:13 -07:00
Evan Tschannen 90301f497f Merge branch 'release-6.0'
# Conflicts:
#	fdbclient/ManagementAPI.actor.cpp
#	fdbrpc/FlowTransport.actor.cpp
#	fdbrpc/TLSConnection.actor.cpp
#	fdbserver/DataDistribution.actor.cpp
#	fdbserver/Status.actor.cpp
#	fdbserver/storageserver.actor.cpp
#	fdbserver/workloads/StatusWorkload.actor.cpp
#	versions.target
2018-09-05 16:06:33 -07:00
Alec Grieser 2274bc0671
clarify some verbiage 2018-09-05 14:46:31 -07:00
Alec Grieser 7c9e4d7d9f
remove default version from fdb-go-install script
Resolves: #732
2018-08-30 16:15:39 -07:00
Alec Grieser 11ab3bdb99
some go bindings README tweaks 2018-08-20 18:04:35 -07:00
Alec Grieser 74771c5b1d
switch to using new release branch convention for install script 2018-08-20 18:04:20 -07:00
A.J. Beamon bc0832bb55 Deprecate TLS_plugin option. Don't remove deprecated methods from Go bindings, since that breaks compatibility with old API versions. 2018-08-15 10:11:08 -07:00
A.J. Beamon 16ba2732b8 fix: cache databases by cluster file and DB name in golang bindings. 2018-07-18 13:00:35 -07:00
Alec Grieser 46b8612566
bump API version from 520 to 600 2018-07-09 11:00:57 -07:00
Drew Richardson efdca64f15 Avoid calls that can panic when handling errors 2018-06-26 08:23:48 -07:00
Alec Grieser 1a0175bb01
Merge pull request #395 from dkoston/go-client-readme-add-mono
bindings/go: README.md: Add mono as dependency, add note about fdbver
2018-05-29 10:22:25 -07:00
Dave Koston 1a415a30b6 bindings/go: README.md: Add mono as dependency
Mono is required to install the go bindings on macOS and Windows (build-time only)
2018-05-29 10:31:37 -05:00
A.J. Beamon 026458baf3 Merge release-5.2 into master 2018-05-23 15:32:56 -07:00
Evan Tschannen 8f984cb2c9 Merge branch 'release-5.2'
# Conflicts:
#	fdbrpc/TLSConnection.h
2018-05-10 09:13:22 -07:00
Justin Lowery 10410ca8cc
Remove empty line 2018-05-09 12:54:25 -04:00
Justin Lowery fa29a1b30c
Improve comment consistency in Go tuple package
Updates the first list of supported types, that can be encoded using a Tuple, to match the types that can be found in later comments within the tuple package.
2018-05-09 09:52:25 -04:00
A.J. Beamon ca720e1540
Merge pull request #297 from apple/release-5.2
Merge 5.2 to Master
2018-05-08 12:04:20 -07:00
Alec Grieser 47c9e4f923
update bindings and bindingtester that uses versionstamps to use new protocol
issue #148
2018-05-08 08:57:09 -07:00
Julien Blache 83f86aa26f Switch repository clone URL from SSH to HTTPS 2018-05-07 15:20:48 -07:00
Julien Blache 899a173526 Check for FDB C library early on, add /usr/lib64 to Linux search path
Getting a warning at the end of the script is confusing as to the status
of the operation. Did it complete? Partially complete? What was done? It
also wastes time as the repo download comes first.

On Linux, the library may be in /usr/lib64 in many cases, so check for
the library in that path too.
2018-05-07 15:16:22 -07:00
Julien Blache 029373835c Cleanup CGO_*FLAGS
Use CGO_CPPFLAGS, remove non-ld options from CGO_LDFLAGS.
2018-05-04 19:15:48 -07:00
A.J. Beamon d5f69ff596
Merge pull request #296 from apple/release-5.1
Merge Release 5.1 Into Release 5.2
2018-05-03 12:05:35 -07:00
John Brownlee 1739c82c1b Fixes the links to download the client libraries in our documentation and packages. 2018-05-01 16:10:51 -07:00
Vicent Marti a19af9921e bindings/go: Reduce memory allocations when packing tuples
Memory profiling a FoundationDB layer implemented in Go shows high
memory pressure and increased GC times when performing highly-concurrent
multi-key transactions on the database. Further digging displays that
the source of the memory pressure happens when packing the keys for the
transaction into byte slices: the most salient issue is that memory
during the packing process is allocated based on the number of elements
to pack and not on the total size of the resulting byte slice.

This commit attempts to reduce the amount of memory allocated when
calling `Tuple.Pack` for most (all?) usage patterns, both in number of
allocations and in total allocated size.

The following optimizations have been implemented:

- Remove `bytes.Buffer` usage in `encodeTuple`: the `Buffer` struct is
quite expensive for the key sizes we're looking to generate, both
allocation and performance-wise. A `packer` struct has been implemented
that builds the keys "naively" by using `append` on a slice. Slice
growth in Go is also amortized just like in `bytes.Buffer`.

- Do not use `bytes.Replace` in `encodeBytes`: this function is
particularly expensive because it always allocates a copy of the byte
slice, even when it doesn't contain nil bytes. Instead, the replacement
step has been implemented manually in `packer.putbytesNil`, where it can
perform the replacement optimally into the output byte slice without
allocating memory. By having this local function we also allow the
compiler to not duplicate any input `string`s when casting them to
`[]byte`; previously, a copy of every string to pack was always being
allocated because the compiler couldn't prove that `bytes.Replace`
wouldn't modify the slice.

- Use stack space in `encode[Float|Double|Int]`: all the numerical
packing functions were allocating huge amounts of memory because of the
usage of temporary `bytes.Buffer` objects and `binary.Write` calls. The
sizes for all the packed data are always known (either 4 or 8 bytes
depending on type), so the big endian packing can be performed directly
on the stack with `binary.BigEndian.PutUint[32|64]`, which doesn't
require the `interface{}` conversion for the `binary.Write` API and in
x64 compiles to a `mov + bswap` instruction pair.

As a result of these optimizations, the "average" case of key packing
can now create a key with a single allocation.  More complex key packing
operations, even those that contain strings/byte slices with nil bytes,
now allocate memory in a constant way (i.e. amortized based on the
amount of growth of the output buffer and not the number of Tuple
elements to pack).

Additionally, the reduction of memory allocations and the better usage
of the `binary` APIs produce a very significant reduction in runtime for
key packing: between 2x and 6x faster for all packing operations.

Before/after benchmarks are as follows:

benchmark                                  old ns/op     new ns/op     delta
BenchmarkTuplePacking/Simple-4             310           76.4          -75.35%
BenchmarkTuplePacking/Namespaces-4         495           137           -72.32%
BenchmarkTuplePacking/ManyStrings-4        960           255           -73.44%
BenchmarkTuplePacking/ManyStringsNil-4     1090          392           -64.04%
BenchmarkTuplePacking/ManyBytes-4          1409          399           -71.68%
BenchmarkTuplePacking/ManyBytesNil-4       1364          533           -60.92%
BenchmarkTuplePacking/LargeBytes-4         319           107           -66.46%
BenchmarkTuplePacking/LargeBytesNil-4      638           306           -52.04%
BenchmarkTuplePacking/Integers-4           2764          455           -83.54%
BenchmarkTuplePacking/Floats-4             3478          482           -86.14%
BenchmarkTuplePacking/Doubles-4            3654          575           -84.26%
BenchmarkTuplePacking/UUIDs-4              366           211           -42.35%

benchmark                                  old allocs     new allocs     delta
BenchmarkTuplePacking/Simple-4             6              1              -83.33%
BenchmarkTuplePacking/Namespaces-4         11             1              -90.91%
BenchmarkTuplePacking/ManyStrings-4        18             2              -88.89%
BenchmarkTuplePacking/ManyStringsNil-4     18             2              -88.89%
BenchmarkTuplePacking/ManyBytes-4          23             3              -86.96%
BenchmarkTuplePacking/ManyBytesNil-4       22             2              -90.91%
BenchmarkTuplePacking/LargeBytes-4         3              2              -33.33%
BenchmarkTuplePacking/LargeBytesNil-4      3              2              -33.33%
BenchmarkTuplePacking/Integers-4           63             3              -95.24%
BenchmarkTuplePacking/Floats-4             62             2              -96.77%
BenchmarkTuplePacking/Doubles-4            63             3              -95.24%
BenchmarkTuplePacking/UUIDs-4              2              2              +0.00%

benchmark                                  old bytes     new bytes     delta
BenchmarkTuplePacking/Simple-4             272           64            -76.47%
BenchmarkTuplePacking/Namespaces-4         208           64            -69.23%
BenchmarkTuplePacking/ManyStrings-4        512           192           -62.50%
BenchmarkTuplePacking/ManyStringsNil-4     512           192           -62.50%
BenchmarkTuplePacking/ManyBytes-4          864           448           -48.15%
BenchmarkTuplePacking/ManyBytesNil-4       336           192           -42.86%
BenchmarkTuplePacking/LargeBytes-4         400           192           -52.00%
BenchmarkTuplePacking/LargeBytesNil-4      400           192           -52.00%
BenchmarkTuplePacking/Integers-4           3104          448           -85.57%
BenchmarkTuplePacking/Floats-4             2656          192           -92.77%
BenchmarkTuplePacking/Doubles-4            3104          448           -85.57%
BenchmarkTuplePacking/UUIDs-4              256           192           -25.00%
2018-05-01 10:52:08 +02:00
Vicent Marti 5bab1e8e4e bindings/go: Add tuple packing tests and benchmark
Although the Go bindings to FoundationDB are thoroughly tested as part
of the `bindingtester` operation, this commit implements a more-or-less
complete test case using golden files for the serialized output of
`Tuple.Pack` operations. This will make implementing optimizations and
refactoring the packing operation much simpler.

The same test cases used to verify correctness are also used as a
benchmark suite to measure the amount of memory allocated in the
different operations.
2018-05-01 10:51:57 +02:00
Alec Grieser ed807a4f78
update generated.go to include first_in_batch 2018-04-28 17:50:49 -07:00
Alec Grieser 69e831d522
Merge remote-tracking branch 'upstream/release-5.2' into merge-release-5.2 2018-04-28 17:44:52 -07:00
Alec Grieser a1faaafca3
Merge remote-tracking branch 'upstream/release-5.1' into merge-release-5.1 2018-04-27 16:38:18 -07:00
Evan Tschannen 9fb31b3e47 updated generated.go 2018-04-27 16:33:57 -07:00
Evan Tschannen 9060e6d82b merged in 5.1 2018-04-27 16:13:35 -07:00
Evan Tschannen d2a684363b remove more dev null is web scale options in the binding testers 2018-04-27 12:22:38 -07:00
Seshadri Mahalingam 2e971295fc
[go] Fix ${fdbdir} path definition in fdb-go-install.sh 2018-04-26 09:45:02 -07:00
Seshadri Mahalingam 6e035d2778 [go] Fix ${fdbdir} path definition in fdb-go-install.sh 2018-04-24 21:58:15 -07:00
Matias Insaurralde 731a8dcdd9
Simplify Go code following the linter recommendations 2018-04-24 10:02:19 -07:00
Matias Insaurralde d9c71ce5bc
Simplify Go code following the linter recommendations 2018-04-22 20:52:44 +02:00
Alec Grieser b49887f72b
regenerated generated.go with APPEND_IF_FITS (new in 5.2!) 2018-04-20 13:25:11 -07:00
Semih Tok 2124d42080
Link updated with c section 2018-04-20 09:27:08 -07:00
Semih Tok daba4bd915
Broken "C API" page link fixed
C API link doesn't work. Probably needs to redirect -> https://apple.github.io/foundationdb/api-c.html
2018-04-20 09:26:59 -07:00
Douglas Daniels bc5a69cd70
Fix go documentation URLs 2018-04-20 09:26:40 -07:00
Alec Grieser a03fd301db
Merge pull request #202 from semihtok/master
Broken link (C API documentation page) fixed
2018-04-20 09:24:34 -07:00
Semih Tok 04d38ee03e
Link updated with c section 2018-04-20 10:30:41 +03:00
Semih Tok 5583f5c48f
Broken "C API" page link fixed
C API link doesn't work. Probably needs to redirect -> https://apple.github.io/foundationdb/api-c.html
2018-04-20 10:15:24 +03:00
Douglas Daniels dc7d455391
Fix go documentation URLs 2018-04-19 22:43:11 -05:00
Vince Polsinelli a52e8b8f3c
Fixed broken links to documentation 2018-04-19 11:45:24 -07:00
Alec Grieser 90773ec03b
Merge pull request #190 from vince105/broken-readme-links
Fixed broken links to documentation
2018-04-19 11:44:57 -07:00
Bruce Mitchener 2f8a0240f1
Fix some typos. 2018-04-19 11:44:01 -07:00
Vince Polsinelli e2844b12a4 Fixed broken links to documentation 2018-04-19 14:34:03 -04:00
Bruce Mitchener 9cdf25eda3 Fix some typos. 2018-04-20 00:49:22 +07:00
Evan Tschannen db98c1b9b6 Merge branch 'release-5.1' into release-5.2
# Conflicts:
#	versions.target
2018-04-17 18:36:19 -07:00
Alec Grieser b18f6200db
remove references to read_ahead_disable transaction option in bindings tests 2018-04-11 11:43:01 -07:00
John Brownlee 89088ad469 Updates generated go file to recommend using the locally checked out fdb.options file. 2018-04-08 21:09:21 -07:00
John Brownlee e35ebc4ccb Updates the format of the generated go file so that it passes our format check.
Explicitly adds the generated go file into the GO_SRC in the Makefile to make the dependency relationships more clear.
Adds the standard Go header to our generated Go file.
2018-04-06 11:33:54 -07:00
John Brownlee 4605f381ac Adds the generated go file to source control. 2018-03-30 12:13:38 -07:00
John Brownlee ca34f924f3 Removes the step to build the go docs from the Makefile. 2018-03-30 11:16:19 -07:00
A.J. Beamon e2d3afb621 Merge branch 'release-5.1' into merge-release-5.1-into-release-5.2
# Conflicts:
#	Makefile
#	documentation/sphinx/Makefile
#	documentation/sphinx/source/administration.rst
#	documentation/sphinx/source/anti-features.rst
#	documentation/sphinx/source/api-general.rst
#	documentation/sphinx/source/building-cluster.rst
#	documentation/sphinx/source/class-scheduling-go.rst
#	documentation/sphinx/source/class-scheduling-java.rst
#	documentation/sphinx/source/class-scheduling-ruby.rst
#	documentation/sphinx/source/class-scheduling.rst
#	documentation/sphinx/source/command-line-interface.rst
#	documentation/sphinx/source/configuration.rst
#	documentation/sphinx/source/downloads.rst
#	documentation/sphinx/source/fault-tolerance.rst
#	documentation/sphinx/source/features.rst
#	documentation/sphinx/source/getting-started-linux.rst
#	documentation/sphinx/source/getting-started-mac.rst
#	documentation/sphinx/source/guide-common.rst.inc
#	documentation/sphinx/source/hierarchical-documents-java.rst
#	documentation/sphinx/source/index.rst
#	documentation/sphinx/source/known-limitations.rst
#	documentation/sphinx/source/multimaps-java.rst
#	documentation/sphinx/source/performance.rst
#	documentation/sphinx/source/segmented-range-reads-java.rst
#	documentation/sphinx/source/simple-indexes-java.rst
#	documentation/sphinx/source/spatial-indexing-java.rst
#	documentation/sphinx/source/subspace-indirection-java.rst
#	documentation/sphinx/source/tables-java.rst
#	documentation/sphinx/source/vector-java.rst
#	versions.target
2018-03-21 09:28:10 -07:00
Alec Grieser 9ed7861f8b
make the go build dependencies more sane 2018-03-20 11:31:49 -07:00
Alec Grieser f263b2c6bd
fix typo ; add javadoc return thing ; add some exceptions to trigger if thing succeeds 2018-03-20 09:39:19 -07:00
Alec Grieser f168e349d6
Merge pull request #99 from brownleej/godocs-dependency-fix
Add generated.go as a dependency for the godocs.
2018-03-20 09:30:42 -07:00
John Brownlee 828e08a345 Add generated.go as a dependency for the godocs. 2018-03-19 14:55:28 -07:00
John Brownlee 91fa01a5a6 Updates URLs and email addresses in documentation and package config. 2018-03-15 16:30:29 -07:00
John Brownlee 2b36dbc932 Adds sed commands to further mangle our paths in the godocs. 2018-03-15 15:52:22 -07:00
Alec Grieser 8dc05b3d81
added methods to (1) determine if an API version has been selected and (2) get it in flow, go, java, python, and ruby bindings
rdar://problem/33838833
2018-03-14 12:26:00 -07:00
Alec Grieser 285e1a1ccc bump API version to 520 2018-03-02 10:30:41 -08:00
Alec Grieser 0bae9880f1 remove trailing whitespace from our copyright headers ; fixed formatting of python setup.py 2018-02-21 10:25:11 -08:00
Alec Grieser fa5e7fca38 add go formatting check to go build 2018-01-24 11:30:08 -08:00
Alec Grieser f9051ac7ac format go code to be compliant with gofmt 2018-01-24 11:29:39 -08:00
Alec Grieser 252fb2b152 gotta bump up that version number!
those are rookie version numbers!
2018-01-16 09:39:58 -08:00
Evan Tschannen 93be673e20 Merge pull request #192 from cie/bindingtester-ro-lock-aware-option
<rdar://problem/34579176> Transaction option for read-only lock aware
2017-10-27 17:19:40 -07:00
Alec Grieser 8cad278da1 add set_read_lock_aware to atomic ops unit tests in binding tester 2017-10-25 15:14:18 -07:00
Balachandar Namasivayam 8e0bea2795 Update API_VERSION from 500 to 510 2017-10-11 13:49:38 -07:00
Alec Grieser a6ed7532c0 now build files into binaries for go when running fdb-go-install 2017-07-10 15:40:26 -07:00
Alec Grieser 3cb6a8faf1 added .PHONY for go targets 2017-07-10 13:45:18 -07:00
Alec Grieser 4a751ffa49 updated paths and formatting with go docs and examples 2017-07-05 17:25:32 -07:00
Alec Grieser 99ca7105a9 messed with the build stuff more to allow for local builds that do not pollute public go path 2017-07-05 14:59:00 -07:00
Alec Grieser 8d09b8554b fixed go imports to use github ; some spaces -> tabs "fixes" 2017-07-04 23:10:11 -07:00
A.J. Beamon fc468f682b Merge branch 'release-5.0' into bindings-tuple-improvements
# Conflicts:
#	bindings/java/src-completable/main/com/apple/apple/foundationdbdb/tuple/Tuple.java
2017-05-26 12:33:33 -07:00
FDB Dev Team a674cb4ef4 Initial repository commit 2017-05-25 13:48:44 -07:00