Commit Graph

51 Commits

Author SHA1 Message Date
tnt 4ac9938c8b Fixed some formatting functions that were called with invalid number/type of arguments.
Change-Id: I261c6fb732a6cf1e54e01fa3e5388c39c6deb720
2014-07-01 12:48:33 +02:00
mpl a001c61339 camtool sync, localdisk: cancel enumerate to avoid channel lock
http://camlistore.org/issue/433

Change-Id: Id20d759dc5192dd34e69a866d8dcd44ca106d63b
2014-05-09 01:36:38 +02:00
Brad Fitzpatrick bf94a73859 Get rid of SeekFetcher vs StreamingFetcher distinction and complexity.
StreamingFetcher is now just Fetcher, and its FetchStreaming is now
just Fetch.

SeekFetcher is gone. Blobs are max 16 MB anyway, so we can slurp to
memory when needed. The main thing that cared about SeekFetcher
was the GET handler, ServeBlobref, because http.ServeContent needed
one for range requests. That's rewritten in an earlier commit, using
the FakeSeeker from another earlier commit.

Lot of code got simpler as a result.

Change-Id: Ib819413e48a8f9b8d97f596d0fbf771dab211f11
2014-03-14 12:29:13 -07:00
Brad Fitzpatrick 260a33aa2a Make various popular storage targets be Stringers. Optional, for upcoming sync handler rewrite.
Change-Id: I8cc961ace8b6093b1dbd82bc39ba3fc334f1d5c7
2014-03-05 08:23:07 -08:00
Tamás Gulácsi 97520583b8 Use 'uint32' instead of 'int64' for blob sizes everywhere.
Not just in blob.SizedRef, but in blobserver.Fetch and
blobserver.FetchStreaming, too.
Blobs have a max size of 10-32 MB anyway, and the index.Corpus is now using
uint32 to save memory.

Change-Id: I1172445c2f9463fdaee55bfe0f1218d44be4aa53
2014-02-08 17:58:12 +01:00
Brad Fitzpatrick 9a9da7196b localdisk: add IsDir
Change-Id: I98748d6cb8ff650e0369ef0518eeeefce73f0354
2014-02-07 10:45:43 -08:00
Brad Fitzpatrick b82b8efe4c Start of new context package and *context.Context type.
Will eventually be plumbed through lots of APIs, especially those requiring or benefiting from
cancelation notification and/or those needing access to the HTTP context (e.g. App Engine).

Change-Id: I591496725d620126e09d49eb07cade7707c7fc64
2013-12-02 13:20:51 -08:00
Tamás Gulácsi f69306cbee Finish implementing storagetest
Add use into localdisk (diskpacked already uses it).
Add ErrNotImplemented error for blobserver and mention the possibility
for RemoveBlobs (diskpacked deficit).

Change-Id: I6a50f263a58c8d3d1611ff9a060ea9fa4aee6163
2013-12-01 21:05:37 +01:00
Brad Fitzpatrick f07ec21f5d localdisk: faster enumerate.
still not as fast as possible, compared to native unix tools (find, ls, etc).
but closer.

Change-Id: I0add6bd07257f04f232332079214312297ec689b
2013-11-29 20:53:46 -08:00
Brad Fitzpatrick fceebe1d43 localdisk: cleanup temp files in migration, clean dirs better
Change-Id: I8999fafc3e87822ec87df227e7815e7cdaf397cb
2013-11-28 21:22:00 -08:00
Brad Fitzpatrick 64f47f3a24 localdisk: move migration stuff to its own file
Change-Id: I987e0133622658dcf3117d65119723f12a4fe74f
2013-11-28 20:20:56 -08:00
Brad Fitzpatrick 8297d9614c localdisk: change hashing structure
Before the files were stored in directories like
sha1/012/345/sha-012345xxxxx.dat, meaning there were 4096 (16^3)
top-level directories, each with up to 4096 child directories.  We
never really did the math, and the result millions (up to 16.7
million) directories with 1 file each.

Now the hashing structure is only 256 wide (two hex digits). If we
considered 4096 files in a directory acceptable before, that means the
new scheme can go up to 256*256*4096 files (268 million), which is
about 512 times bigger than my personal Camlistore instance
now. Larger users should probably be using the diskpacked storage
backend, anyway.

On start-up, the code now migrates the old format to the new format.

Change-Id: I17f7e830c50a5b770c57ee92d51f122340a0afbb
2013-11-28 16:33:01 -08:00
Brad Fitzpatrick 70475701d1 Get rid of QueueCreator and all its associated complexity.
Previous TODO entry was:

-- Get rid of QueueCreator entirely. Plan:
     -- sync handler still has a source and dest (one pair) but
        instead of calling CreateQueue on the source, it instead
        has an index.Storage (configured via a RequiredObject
        so it can be a kvfile, leveldb, mysql, postgres etc)
     -- make all the index.Storage types be instantiable
        from a jsonconfig Object, perhaps with constructors keyed
        on a "type" field.
     -- make sync handler support blobserver.Receiver (or StatReceiver)
        like indexes, so it can receive blobs.  but all it needs to
        do to acknowledge the ReceiveBlob is write and flush to its
        index.Storage. the syncing is async by default. (otherwise callers
        could just use "replica" if they wanted sync replication).
        But maybe for ease of configuration switching, we could also
        support a sync mode.  when it needs to replicate a blob,
        it uses the source.
     -- future option: sync mirror to an alternate path on ReceiveBlob
        that can delete. e.g. you're uploading to s3 and google,
        but don't want to upload to both at once, so you use the localdisk
        as a buffer to spread out your upstream bandwidth.
     -- end result: no more hardlinks or queue creator.

Change-Id: I6244fc4f3a655f08470ae3160502659399f468ed
2013-11-22 14:33:31 -08:00
jakubbrzeski 59ab94517d blobserver/localdisk: fixed build problems on non-Windows
Change-Id: I5ec0fa71449d8802c8005bf802b334a385f5d257
2013-11-06 11:43:44 +01:00
mpl 44683a6e09 blobserver/localdisk: handle renaming error on windows
http://camlistore.org/issue/241

Change-Id: Ib9c042d6074ff0dedc16f1519263c424898337a2
2013-11-05 17:27:07 +01:00
Brad Fitzpatrick df8813e311 localdisk: fix TestPaths on Windows 2013-10-21 13:18:27 -07:00
Brad Fitzpatrick 6e92302b1d Fix data races added in 161fc061d3
Change-Id: I7167472de3778fc76cc54dff6c864ed43b2052e9
2013-10-10 19:54:23 -10:00
Brad Fitzpatrick b169d80589 localdisk: update failing test's style.
doesn't fix test though.

Change-Id: I5fcca5abbc6b71cfde1a1816b8b8915ca122e644
2013-10-10 17:05:14 -10:00
Brad Fitzpatrick 736f5d0d21 Merge "Add generation support for diskpacked." 2013-10-10 20:14:17 +00:00
Tamás Gulácsi 161fc061d3 use syncutil.Group and syncutil.Gate for paralellizing blobserver stats/removes
- where TODO exist.

Change-Id: If7340cf3bfcd5f5211f646404312c2fd15947bd9
2013-10-10 21:52:12 +02:00
Tamás Gulácsi a624b6d3b2 Add generation support for diskpacked.
Refactor the localdisk, diskpacked common code to pkg/blobserver/local
(only StorageGeneration, ResetStorageGeneration in this CL)

Change-Id: Ib04125805d5a1960bd29a474d3fc7ca985708d8d
2013-10-10 21:35:44 +02:00
Brad Fitzpatrick 59534f0ad6 Move pkg/gate to pkg/syncutil, to house more stuff.
Change-Id: I737458641a9de03da55ed627bfac10f3377a13aa
2013-09-12 16:04:10 +01:00
Brad Fitzpatrick 6f75f451c8 localdisk: another attempt at fixing Mkdir/Rmdir locking for Issue 177
Change-Id: I0569727b3cc1c2cf4c1b48f9c4b70eb645434f5a
2013-09-10 13:57:36 -07:00
Brad Fitzpatrick a51edb5e77 localdisk: simplify directory locking.
Tries to fix https://code.google.com/p/camlistore/issues/detail?id=177

Change-Id: I2ea089437528d39ecdb8a3a3129e03ba11a76e67
2013-09-08 14:55:41 -07:00
Brad Fitzpatrick 7dd7f948cc localdisk: fix Stat deadlock regression, use pkg/gate.
The errc channel needs to be buffered. Broken by b24cad68dd which
radically simplified this method.

Change-Id: I7f4df7d47cca78d6098000b926d7b734dd712bfa
2013-08-23 09:20:21 -05:00
Brad Fitzpatrick b24cad68dd Cleanup: remove BlobHub and time.Duration waits from storage interface
Move up a layer to the HTTP.  Also, start to remove ContextWrapper
stuff.  We've done it differently for App Engine instead, and will do
it differently yet moving forward.

Also add blobserver.Receive and use it in most places, moving checksum
verification up a layer.

Bunch of other cleanup and TODO fixing too.

Much simpler and cleaner.

Change-Id: I12e56c5d4e53bfcf82bdd8fb0b6d57c248ff605c
2013-08-21 13:57:28 -07:00
Brad Fitzpatrick 6dac08f539 localdisk: don't allocate 512 KB on each readdir
Change-Id: I3e71605f0ef53351f0ee50bb78bdfbf6b5d7dca1
2013-08-20 16:29:24 -07:00
Brad Fitzpatrick 0bdf20884b all: delete pkg/blobref; convert all from *blobref.BlobRef to new blob.Ref
Change-Id: Id2dfb7f19452bedf4f3c9310b36227fd8117b225
2013-08-03 19:54:30 -07:00
Brad Fitzpatrick b0bff61d30 types: move ReadSeekCloser types from pkg/blobref to pkg/types
Change-Id: I24e2b2a068d9b09479b145409a3b7e5693dd8ac5
2013-07-28 20:08:55 -07:00
Brad Fitzpatrick cf0d9aca6e More docs
Change-Id: I5c21f240c85bcf91fb67487cc172bf3faeb49fff
2013-07-07 18:52:14 -07:00
Brad Fitzpatrick bf54afe1fc localdisk: clean up tests, use test.Blob instead
Change-Id: I1463c35f3af6695e0c73afc03f616af2a238e6a0
2013-07-07 12:15:19 -07:00
Brad Fitzpatrick 36c1ecebd9 Let camtool sync's --dest and --thirdleg flags take local disk paths, instead of servers.
Change-Id: I8daddf06a7201384edff2cb22ecfd5872fc84928
2013-06-09 11:36:26 +02:00
Brad Fitzpatrick 83002f748c localdisk: work on Linux w/ non-Unixy filesystem
Change-Id: I97f062a44d536866c6c5cd690f2c2409a08cbdf1
2013-02-13 16:48:28 -08:00
Brad Fitzpatrick 6d562c65d5 localdisk: minor cleanups, copy one paranoia check earlier
Change-Id: I81cc2bf054dae6fdc5428d8e44cb710b2aae6d88
2013-02-07 10:04:03 -08:00
Brad Fitzpatrick 7ceaaa0012 blobref: simplify the FromHash func. Make type implicit.
Change-Id: I2e01c3663bdb1151c11dfc9a1d59c7081940ffac
2013-01-20 13:36:27 -08:00
Pawel Szczur f1798f2c75 Removed redundant code.
Change-Id: I172091bd84fcc88561969882ff19396c963a582f
2013-01-12 01:48:54 +01:00
Brad Fitzpatrick 1a8eee298a Misc cleanups and TODOs
Change-Id: I9903366427e41ebadba289bf66b294690675f78f
2012-12-31 17:36:28 -08:00
Brad Fitzpatrick d2b20395e9 localdisk: Ignore 'cache' directory when enumeration.
Change-Id: Iebc3d71b13f21e6f9a80c8bbfccced5fe6bcfb1d
2012-12-21 17:48:07 -08:00
Brad Fitzpatrick a41269e78e Reindex all dev-server blobs into memindex on restart.
Required some sync work (full syncs on start, blocking full syncs on
start, and also adding a dev-only hack to force a depedency from
search -> sync, to control the handler initialization order, otherwise
publish handlers would race with the sync handler and they'd create
new "blog" and "pics" permanodes and we'd end up with duplicates).
2012-11-07 22:40:17 +01:00
Brad Fitzpatrick 71d7cf9e88 Implement storage generations, init and discovery 2012-11-07 21:14:56 +01:00
Brad Fitzpatrick b887087606 Do a TODO: s/errorIsNoEnt/os.IsNotExist/g 2012-11-07 20:02:34 +01:00
Maxime Lavigne 5a7510c384 Modification to allow windows build and deployement
Webserver were initialized with "tcp" and ":3179" by default and
listenURL assumed that it would be treated as IPv6 and replaced [::]
by localhost. Host that were listening on IPv4 0.0.0.0 didn't get
the modification.

Receive in localdisk were using link that failed on windows plateforms.

Camlistored didn't use Json Marshaling which caused problem with the
way Windows stores its paths.

Change-Id: I9f62f7d46399c3514707383efcb2752dbaf1f420
2012-10-30 23:17:58 -04:00
Brad Fitzpatrick 7b6a26ffeb localdisk: fix TODO which resulted in a race/crash.
Change-Id: I7ff0be046c07e5fd33c861afd10b5e725066a033
2012-04-22 18:51:41 -07:00
Brad Fitzpatrick 1d3703f7ef Clean up some logging.
Change-Id: I92ff6e68e9866784e643682c5e6db5d03f877c5b
2012-04-22 17:56:52 -07:00
Brad Fitzpatrick 9d57c52c34 localdisk: attempt #3 at fixing queue directory delete/create race.
this version seems to work for quite awhile now, at least.

Change-Id: I1484838a9b1b2b12a8af72e57e6c7ba6bd06e07d
2012-04-22 17:17:51 -07:00
Brad Fitzpatrick b5bccf2261 localdisk: fix double slash in full path, preventing race lock from working
Change-Id: I171099214b06ec99d0ad766d1604442879fb3183
2012-04-21 08:29:32 -07:00
Brad Fitzpatrick 0e5d27a05c localdisk: fix race deleting empty directories w/ uploading new blobs
Change-Id: Icae0b7dd3de051bba23d1a583b47f5421adedb47
2012-04-20 13:04:42 -07:00
Brad Fitzpatrick 67e32df2bd Fix a bunch of broken tests, lost in the Go 1 conversion.
Change-Id: I7c16563bc25f52868984c63e42125cd9bd9d5812
2012-03-19 18:44:50 -07:00
ranveer d1e1f2bcb1 Add path/filepath
Fixes broken build.

Change-Id: Ia691b76b9a4d3c92f310223166f53d65f1286ec1
2012-02-22 10:52:21 -02:00
mpl 28caffab1f remove empty blob dirs in queue. fixes issue 47.
Change-Id: If07576825123be910f040f0c5a0dc6988d55de08
2012-02-20 15:07:14 +01:00