Commit Graph

104 Commits

Author SHA1 Message Date
Dan Willhite 74c4453b63 Fix to remove -test flags from all executables. 2016-04-27 10:39:08 -07:00
Chris Masone 6ff58aa38b Report backpressure over the wire
Using ChunkStore.PutMany() means that the DataStore server code
can detect when the ChunkStore it's writing to can't handle
the amount of data being pushed. This patch reports that
status back across the wire to the client that's attempting
to write a Value graph. Due to Issue #1259, the only thing the
client can currently do is retry the entire batch, but we hope
to do better in the future.
2016-04-19 11:27:45 -07:00
Chris Masone 11382ad716 Code review fixes 2016-04-13 14:01:40 -07:00
Chris Masone 7db243745b httpHintedChunkStore uses one big batch
A novel chunk may contain references to any other novel chunk, as long
as there are no cycles. This means that breaking up the stream of
novel chunks being written to the server into batches risks creating
races -- chunks in one batch might reference chunks in another,
meaning that the server would somehow need to be able to
cross-reference batches. This seems super hard, so we've just forced
the code to write in one massive batch upon Commit(). We'll evaluate
the performance of this solution and see what we need to change.

Also, there's a terrible hack in HandleWriteValue to make it so that
pulls can work by back-channeling all their chunks via postRefs/ and
then writing the final Commit object via writeValue/
This can be fixed once we fix issue 822
2016-04-12 18:50:35 -07:00
Chris Masone d8a2d285e9 Pull DataStore API over the wire and kill chunks.HTTPStore
This patch is unfortunately large, but it seemed necessary to make all
these changes at once to transition away from having an HTTP
ChunkStore that could allow for invalid state in the DB. Now, we have
a RemoteDataStoreClient that allows for reading and writing of Values,
and performs validation on the server side before persisting chunks.
The semantics of DataStore are that written values can be read back
out immediately, but are not guaranteed to be persistent until after
Commit() The semantics are now that Put() blocks until the Chunk is
persisted, and the new PutMany() can be used to write a number of
Chunks all at once.

From a command-line tool point of view, -h and -h-auth still work as
expected.
2016-04-12 14:08:58 -07:00
Chris Masone 119a56c3a9 Move ReadValue and WriteValue to DataStore
This patch is the first step in moving all reading and writing to the
DataStore API, so that we can validate data commited to Noms.

The big change here is that types.ReadValue() no longer exists and is
replaced with a ReadValue() method on DataStore. A similar
WriteValue() method deprecates types.WriteValue(), but fully removing
that is left for a later patch. Since a lot of code in the types
package needs to read and write values, but cannot import the datas
package without creating an import cycle, the types package exports
ValueReader and ValueWriter interfaces, which DataStore implements.
Thus, a DataStore can be passed to anything in the types package which
needs to read or write values (e.g. a collection constructor or
typed-ref)

Relatedly, this patch also introduces the DataSink interface, so that
some public-facing apis no longer need to provide a ChunkSink.

Towards #654
2016-03-17 12:57:44 -07:00
Chris Masone ec3163c7f8 Some small fixes in chunks/
Mostly 'go vet' complaints.
2016-03-10 15:42:37 -08:00
Chris Masone 3587622f6a Tag root item in DynamoStore as uncompressed
These items are never compressed, but all other items have a tag
on them, so it makes sense that these should as well. Remain
tolerant of old roots, though, that are not tagged.
2016-03-09 12:22:56 -08:00
Chris Masone 4f82f47b05 Add -dynamo-stats flag to control printing of DynamoStore stats
Most people don't want to see these most of the time, so
now there's a flag I can set when I want to see the
read/write stats that DynamoStore keeps.

Fixes #1037
2016-03-02 17:29:57 -08:00
Chris Masone 40efa266bd Factor Put-cache out of HTTPStore and DynamoStore
There was some copypasta. Now it's extracted into its own struct
that provides the same API and semantics.
2016-02-24 13:51:53 -08:00
Rafael Weinstein 31522bea6e Revert "DynamoStore: write full batches (until UpdateRoot), do so concurrently"
This reverts commit 10c8f8a447.
2016-02-23 17:15:58 -08:00
Chris Masone 10c8f8a447 DynamoStore: write full batches (until UpdateRoot), do so concurrently
With this patch, DynamoStore will now hold off writing anything to
the backend until it's got a full batch or someone calls UpdateRoot().
When it's time to write, DynamoStore will now fire off a new goroutine
to build the request (including compressing chunks), send it, and wait
for a response. It will keep up to dynamoWriteConcurrency concurrent
batch writes in flight.

Includes statKeeper, which provides a way for concurrent goroutines to
keep stats like write count, bytes written, etc. Also includes a refactor
to make unwrittenPutCache a separate type that both HTTPStore and
DynamoStore use instead of using copypasted code.
2016-02-23 14:23:39 -08:00
Chris Masone 3d9ebdf61e Compress big chunks in DynamoStore
It turns out that many large chunks are quite compressible, and
writing smaller chunks to DynamoDB saves time, and allows more
headroom before hitting the provisioned capacity on the backing
table. Compressed chunks are tagged with the algorithm used to
compress them, though we treat untagged chunks as uncompressed for
backward compatibility.
2016-02-18 17:46:05 -08:00
Aaron Boodman befeac553d Merge pull request #981 from aboodman/vendor-aws
Vendor using 'vendor' directory instead of Godeps
2016-02-09 09:46:38 -08:00
Aaron Boodman cff0de3696 non-vendor changes 2016-02-08 23:15:09 -08:00
Benjamin Kalman 25b0516651 Support setting the "Authorization" header on http store requests. 2016-02-08 16:41:37 -08:00
Chris Masone 507b881c21 Make named DataStores first-class citizens
In order to allow tools like shove to correctly address named
DataStores, we need to have the notion of a name be settable at the
DataStoreFlags level. Once we've done that, it doesn't really make
sense to have API surface for creating DataStores without a name --
though for compatibility, the code will continue to accept an empty
string for a DataStore's name
2016-02-01 10:50:54 -08:00
Chris Masone 7fc728f769 Fix LevelDB support for named datastores
We use a conceptually similar approach to the one we use with DynamoDB
to allow a single database to provide multiple named datastores: keys
are all namespaced using the name of the datastore. The implementation
is a bit different, as we need to run the backing database ourselves.

Fixes #917
2016-01-29 12:10:26 -08:00
Chris Masone 1316d19462 Enable clients/server to address multiple DataStores
Add DataStore.Factory and ChunkStore.Factory so that client programs
that need to create multiple namespaced {Chunk,Data}Stores of the kind
indicated by command line flags have a convenient way to do so. The
details of how this is implemented are mostly contained in the various
ChunkStore.Factory implementations:

1) MemoryStore, TestStore - no change
2) LevelDBStore - the namespace is used as a subdirectory of the path
                  provided by the user
3) HTTPStore - the namespace is used as a path prefix for the endpoints
               supported by DataStoreServer
4) DynamoStore - the namespace is used as a prefix on all keys

This change also required that DataStoreServer be able to handle URLs
of the form "http://server:port/namespace/endpoint", e.g.
"http://localhost:8000/mydatastore/getRefs". It currently still handles
the non-namespaced endpoints as well.

In order to make code from DataStoreServer more re-usable in other
contexts, the functions that handle calls to the server's various
endpoints are now standalone and live in datas/handlers.go.
DataStoreServer just contains logic for dispatch and server lifetime
management.
2016-01-26 13:58:57 -08:00
Rafael Weinstein 09cd821073 Fix race in RemoteServers on Put chunks 2016-01-25 10:55:01 -08:00
Rafael Weinstein e9d7898f35 Revert "Horrible Hack for Bug 884"
This reverts commit 4b5f44406e.
2016-01-25 10:21:57 -08:00
Rafael Weinstein 4b5f44406e Horrible Hack for Bug 884 2016-01-25 09:47:51 -08:00
Erik Arvidsson 5282014bb2 Add a Dynamo DB Store
This DynamoDB store borrows some logic from HttpStore, in that Get,
Has and Put requests are dumped into channels that are watched by
code in goroutines and batched up to be sent to the backend.
A few structs have been factored out of http_store.go and moved to
remote_requests.go, where they are enhanced so that DynamoStore can use
them as well.
2016-01-14 12:19:14 -08:00
Rafael Weinstein e7c4b3f8a7 Add an average put size to DumpStats 2015-12-29 09:44:17 -08:00
Dan Willhite 2018863432 Add hasCache to datastore.
Fixes #693.
2015-12-08 11:22:50 -08:00
Dan Willhite bdb3fdf95d Revisions to http store. 2015-12-03 17:45:55 -08:00
Dan Willhite 008047fb3d Limit concurrent requests to 'requestLimit'. 2015-12-03 14:10:29 -08:00
Dan Willhite ede5f1704b Increase max number of keep-alive connections in http_store. 2015-12-03 14:10:29 -08:00
Dan Willhite afc3944341 Add top-down sync strategy. 2015-12-01 12:39:42 -08:00
Aaron Boodman c813010e6d fix build 2015-10-23 13:28:29 -07:00
Aaron Boodman ebcd68cedf Break the build more to test travis integration 2015-10-23 13:25:11 -07:00
Aaron Boodman f40a5a5403 Break the build to test travis integration 2015-10-23 13:21:34 -07:00
Dan Willhite bb2f983446 Add IsEmpty() function on ref.Ref.
Fixes #337.
2015-10-21 12:07:34 -07:00
Rafael Weinstein 6c5b2eb6f4 Avoid Excess Ref Computation 2015-09-26 11:33:04 -07:00
Rafael Weinstein 4ba824739a Protect readBatch map with a rateLimiter 2015-09-25 14:35:37 -07:00
Rafael Weinstein ec8461e8fd RemoteDataStore / CopyReachableChunksP 2015-09-24 11:06:50 -07:00
Rafael Weinstein 691f71ec08 Add LevelDBStore.dumpStats 2015-09-23 14:10:27 -07:00
Rafael Weinstein ee47fb0bf2 Reland: limit write concurrency of leveldb to max open file handles limit 2015-09-23 11:54:21 -07:00
Rafael Weinstein b661beceae Revert "limit write concurrency of leveldb to max open file handles limit"
This reverts commit 8d2d380676.
2015-09-23 11:49:00 -07:00
Rafael Weinstein 8d2d380676 limit write concurrency of leveldb to max open file handles limit 2015-09-23 11:32:02 -07:00
Rafael Weinstein adabda61a4 Make DataStore an interface 2015-09-22 17:30:14 -07:00
Rafael Weinstein 591026bcfa Chunk 2015-09-21 13:24:41 -07:00
Rafael Weinstein 8d56b8c968 Reland: ChunkSource.Get() now returns a []byte. chunks.Serialize takes a stream of Chunks 2015-09-17 12:31:25 -07:00
Rafael Weinstein a62cf1bbb8 Revert "ChunkSouce.Get() now returns []byte"
This reverts commit 2be269acf4.
2015-09-16 20:47:36 -07:00
Rafael Weinstein 2be269acf4 ChunkSouce.Get() now returns []byte 2015-09-16 16:42:36 -07:00
Rafael Weinstein 0df9f46a2e Remove http_store (someone got lost in recent patch) 2015-09-16 12:55:55 -07:00
Rafael Weinstein 9c6effe19f split chunks/http_store into http/http_client & http/http_server 2015-09-16 10:56:43 -07:00
Rafael Weinstein 10350dbd7e switch js to use buffer reads 2015-09-11 14:41:51 -07:00
Rafael Weinstein ae4e35d9d1 possible fix for continuous build 2015-09-11 12:18:58 -07:00
Rafael Weinstein a877c6fac9 use MemoryStore rather than ChunkBuffer 2015-09-10 12:48:27 -07:00