Commit Graph

377 Commits

Author SHA1 Message Date
cmasone-attic
bac5f2ab5d Only request remaining hashes in httpBatchStore.GetMany() (#3062)
In httpBatchStore.GetMany(), we check our unwritten
puts to see if any of the requested chunks already
exist locally. If any do, we're _supposed_ to remove
their hashes from the set slated to be requested from
the server. That logic was borked.

Towards https://github.com/attic-labs/attic/issues/503

* Add zero check

Also Fixes #3063
2017-01-11 15:57:03 -08:00
Rafael Weinstein
89cd026c46 Fix bug in read ahead for sequence.iter (#3060)
fix bug in read ahead for sequence.iter
2017-01-11 14:28:28 -08:00
Rafael Weinstein
d0bf8ddc55 fix bug in ReadManyValues (#3059) 2017-01-11 11:54:01 -08:00
Rafael Weinstein
5fa5484f46 remove orederedparallel (#3050) 2017-01-10 15:45:05 -08:00
Rafael Weinstein
01303a828d go read ahead (#3046) 2017-01-10 15:28:26 -08:00
Rafael Weinstein
c3427a4364 Introduce go blob-put (#3053)
Introduce go blob-put
2017-01-10 15:02:02 -08:00
Aaron Boodman
c5805766f5 Enable v8 by default (#3045) 2017-01-10 14:43:55 -08:00
cmasone-attic
5757ae3bb0 compactingChunkStore.count() must block on compaction (#3048)
Compaction not only persists the contents of a memTable, it also
filters out duplicate chunks. This means that calling count() on a
compactingChunkStore before and after compaction completes could lead
to different results. In the case where the memTable contains only
duplicate chunks, this is Very Bad becuase it leads to an non-existent
table winding up in the NBS manifest.

Fixes #3044
2017-01-10 12:22:40 -08:00
Aaron Boodman
a09ef6fb44 Revert "Introduce noms version 8. Use it to guard type simplification." (#3043) 2017-01-09 16:30:25 -08:00
Ben Kalman
5abf5ccff4 Implement marshal.Unmarshaler interface (#3039) 2017-01-10 09:12:39 +11:00
cmasone-attic
ee2a5fa510 Make DeserializeToChan return an error, use it everywhere (#3042)
Chunk deserialization can run into errors sometimes if, e.g. the
client hangs up during a writeValue request. The old error strategy
worked by throwing a "catchable" error and recovering. That's OK if
you've only got one goroutine, but since the writeValue handler starts
so many goroutines, architecting the code to deal with error handling
by panic/recover is dicey.

Instead, make DeserializeToChan return an error in the more common
failure cases and handle it by passing it over a channel and raising
it from a central place.
2017-01-09 13:58:44 -08:00
Rafael Weinstein
1d49c08481 avoid concurrent access to hashmap (#3041) 2017-01-08 17:05:05 -08:00
cmasone-attic
e7a96c3748 Add ValueStore.ReadManyValues() (#3036)
The more code can use GetMany(), the better performance gets on top of
NBS. To this end, add a call to ValueStore that allows code to read
many values concurrently. This can be used e.g. by read-ahead code
that's navigating prolly trees to increase performance.

Fixes #3019
2017-01-08 14:37:37 -08:00
Aaron Boodman
a4ffa5ba9b Introduce noms version 8. Use it to guard type simplification. (#3035)
Introduce noms version 8. Use it to guard type simplification.
2017-01-06 17:32:32 -08:00
Erik Arvidsson
1e0a698781 Type accretion for struct fields should use equal (#3029)
We used to use isSubtype but we should just create a more specific type
when we can.

Fixes #2993
2017-01-05 13:57:42 -08:00
cmasone-attic
5447216480 Fix sync bug when all chunks are already present in the sink (#3032)
In the edge case where all source chunks are already present in the
sink AND the sink dataset does not yet exist, the httpBatchStore code
was sending chunks in reverse order.  This patch ensures that,
regardless of how few chunks are sent, any operation that sends chunks
to the server also resets chunk write order.

Fixes #3101
2017-01-05 13:33:08 -08:00
cmasone-attic
ce5c747a71 Set concurrency used by writeValue handler to num CPUs (#3030)
Fixes #3022
2017-01-05 11:56:54 -08:00
cmasone-attic
87b7bed513 NBS: Create directory for store if it doesn't exist (#3028)
Fixes #2909
2017-01-05 11:51:56 -08:00
cmasone-attic
14c20ebdd7 Make server use GetMany to load hinted chunks (#3026)
Now that we have GetMany, the server can use it directly to let the
chunk-fetching layer figure out the best way to batch up requests. A
small refactor allows ValidatingBatchingSink to directly update the
hint cache instead of relying on logic inside ReadValue to do it. I
made that change because ReadValue now also does a bunch of other
things around caching read values and checking a cache of 'pending
Puts' that will never have anything in it when used from the server.

Toward issue #3019
2017-01-05 10:59:26 -08:00
Aaron Boodman
acf66b0000 Make type simplification publicly settable (#3027) 2017-01-05 10:54:15 -08:00
Aaron Boodman
5617c15489 Add support for IsSubtype(T, A|B|...) (#3024) 2017-01-04 21:55:36 -08:00
Aaron Boodman
8777321dd2 Few cleanups to type simplification, plus enable it in various jobs (#3018) 2017-01-04 14:15:26 -08:00
Ben Kalman
b0689cb2a4 Add the marshal.Marshaler interface (#3012)
This lets types provide their own Noms value marshaling.

Towards #2970.
2017-01-05 09:09:22 +11:00
Rafael Weinstein
e025471eab Remember hints for written chunks (#3017)
Prior to this patch, ValueStore only kept a record of where referenced Refs originally reside in from chunks read from the server. This ignored the case of a client doing subsequent commits with the same ValueStore (for example, writing multiple states of a map). This was resulting in the server being forced to load a ton of chunks to validate.
2017-01-04 13:58:44 -08:00
Aaron Boodman
35f88f19a3 First cut at "type simplification" (#2996)
First cut at "type simplification".

This dramatically reduces the sizes of the types generated by type
accretion, in some cases by several orders of magnitude.

Implemented as a drop-in replacement for MakeUnionType(), initially
behind a flag.

Fixes #2995
2017-01-04 13:39:45 -08:00
cmasone-attic
ad3037f869 ValueStore writes chunks only when referenced (#3016)
The old strategy for writing values was to recursively encode them,
putting the resulting chunks into a BatchStore from the bottom up as
they were generated. The BatchStore implementation was responsible for
handling concurrency, so chunks from different Values would be
interleaved if the there were multiple calls to WriteValue happening
at the same time.

The new strategy tries to keep chunks from the same 'level' of a
graph together by caching chunks as they're encoded and only writing
them once they're referenced by some other value. When a collection
is written, the graph representing it is encoded recursively, and
chunks are generated bottom-up. The new strategy should, in practice,
mean that the children of a given parent node in this graph will be
cached until that parent gets written, and then they'll get written
all at once.
2017-01-04 12:19:10 -08:00
Rafael Weinstein
8144738a06 fix bug in http_batch_store storing of hints (#3013) 2017-01-04 07:09:45 -08:00
Ben Kalman
be2e714545 Implement @at in JS paths (#3010) 2017-01-04 11:58:08 +11:00
Ben Kalman
9b149516ef Implement JS Map and Set at() (#3009) 2017-01-04 11:31:09 +11:00
Ben Kalman
f83e5b5b9c Refactor JS path code and implement @type (#3003)
This brings it much closer to the Go implementation, and eventually
implementing the @at annotation.
2017-01-04 09:32:07 +11:00
Rafael Weinstein
4f72960e0e TestHandleGetRefs (#3007)
The order of returned chunks is no longer guaranteed.
2017-01-03 13:58:31 -08:00
Rafael Weinstein
35686e6eb9 Address write timeout (#3008)
Ups the response-header timeout to 4m, and adds some additional log output which hopefully will shed some light on why some writes are taking so long.
2017-01-03 13:54:31 -08:00
Rafael Weinstein
3242f18c20 [NBS] Implement Streaming GetMany (#3002)
Adds the ability to stream individual chunks requested via GetMany() back to caller.

Removes readAmpThresh and maxReadSize. Lowers the S3ReadBlockSize to 512k.
2017-01-03 12:25:01 -08:00
cmasone-attic
258b3e8f11 Enable noms serve to serve nbs-aws stores (#3001)
There's no reason that this shouldn't work, so make it do so
2017-01-02 17:17:42 -08:00
cmasone-attic
ca31583a08 Add new spec for nbs-aws (#2997)
The new spec is a URI, akin to what we use for HTTP It allows the
specification of a DynamoDB table, an S3 bucket, a database ID, and a
dataset ID: aws://table-name:bucket-name/database::dataset

The bucket name is optional and, if not provided, Noms will use a
ChunkStore implementation backed only by DynamoDB.
2017-01-02 08:24:45 -08:00
cmasone-attic
22d8e175f7 Modify httpBatchStore so that writing values maintains some locality (#2983)
NBS benefits from related chunks being near one another. Initially,
let's use write-order as a proxy for "related".

This patch contains a pretty heinous hack to allow sync to continue
putting chunks into httpBatchStore top-down without breaking
server-side validation. Work to fix this is tracked in #2982

This patch fixes #2968, at least for now

* Introduces PullWithFlush() to allow noms sync to explicitly
pull chunks over and flush directly after. This allows UpdateRoot
to behave as before.

Also clears out all the legacy batch-put machinery. Now, Flush()
just directly calls sendWriteRequests().
2016-12-23 11:48:42 -08:00
Aaron Boodman
fe53c15552 Marshal() should accept original field with empty value. (#2985) 2016-12-23 00:20:29 -08:00
Aaron Boodman
e451a01441 Add support for original in marshal.Marshal (#2978)
Add support for `original` in marshal.Marshal

Now it roundtrips
2016-12-22 13:12:51 -08:00
Rafael Weinstein
d8d8c6c7e1 Parallel s3 Slice reads (#2979)
GetMany() calls can now be serviced by <= N goroutines, where N is the number of physical reads the request in broken down into.

This patch also adds a maxReadSize param to the code which decides how to break chunk reads into physical reads, and sets the s3 blockSize to 5MB, which experimentally resulted to lower total latency.

Lastly, some small refactors.
2016-12-22 11:45:33 -08:00
Erik Arvidsson
6bc82b03dd Revert "Marshal: Be more lenient when unmarshal a struct (#2975)" (#2977)
This reverts commit b64f1d5dc9.

Reason: It is breaking samples/go/photo-index

Reopens: #2971
2016-12-21 19:14:59 -08:00
Erik Arvidsson
b64f1d5dc9 Marshal: Be more lenient when unmarshal a struct (#2975)
This is a potentially breaking change!

Before this change we required all the fields in a Go struct to be
present in the Noms struct when we unmarshal the Noms struct onto the
Go struct. This is no longer the case, which means that all fields in
the Go struct that are present in the Noms struct will be copied over.

This also means that `omitempty` is useless in Unmarshal and it has been
removed.

This might break your code if expected to get errors when the field
names did not match!

Fixes #2971
2016-12-21 16:29:05 -08:00
Erik Arvidsson
521e7b6bae Marshal: Use nil for empty Go collections (#2973)
This is a breaking change!

We used to create empty Go collections `[]int{}` when unmarshalling an
empty Noms collection onto a Go collection that was `nil`. Now we keep
the Go collection as `nil` which means that you will get `[]int(nil)`
for an empty Noms List.

Fixes #2969
2016-12-21 16:21:15 -08:00
cmasone-attic
d129580007 Add frag tool to measure nbs fragmentation (#2963)
Before we can defragment NBS stores, we need to understand how
fragmented they are. This tool provides a measure of fragmentation in
which optimal chunk-graph layout implies that ALL children of a given
parent can be read in one storage-layer operation (e.g. disk read, S3
transaction, etc).
2016-12-20 17:01:18 -08:00
Ben Kalman
4eca6085cb Allow skipping invalid fields when marshalling (#2967)
Currently unexported fields refuse to marshal or unmarshal, even if
they're told to skip. Now, they can be skipped. By default, they are
still errors.
2016-12-20 16:47:49 -08:00
Ben Kalman
fa1ab8a61c Make datas.localFactory public and add NewLocalFactory (#2961)
I want to adapt datas.NewLocalFactory(chunks.NewMemoryStoreFactory()).
2016-12-19 10:46:25 -08:00
Dan Willhite
d41a4bc6f7 Add set methods to verbose. (#2962) 2016-12-19 10:26:58 -08:00
cmasone-attic
9998ec0301 NBS: tableSet must exclude empty tables during ToSpecs() (#2959)
Fixes #2957
2016-12-15 11:45:39 -08:00
cmasone-attic
35385900d6 Close some NBS tableSets during testing (#2956)
Leaving these open can leak file handles
2016-12-14 17:17:58 -08:00
Rafael Weinstein
d2289219c3 dont flush for every batch during VBS.Enqueue (#2955) 2016-12-14 16:36:12 -08:00
Rafael Weinstein
f409db8c74 Add s3 tableIndex cache (#2953) 2016-12-14 15:06:31 -08:00