Commit Graph

80 Commits

Author SHA1 Message Date
mpl ab06dbd80d vendor: rename google.golang.org/cloud to cloud.google.com/go
rm google.golang.org/cloud
add cloud.google.com/go at a47b182e769f5e75f5fc927ff6ee2678f7f552cf
update google.golang.org/api to 63cb68f1e3834e44683ca062ddf06cb9a889380a
update google.golang.org/grpc to
0e6ec3a4501ee9ee2d023abe92e436fd04ed4081
update go4.org to f5283521d7365fb2875408726e9cbf349f173767

fix in cmd/ pkg/ server/

TODO(mpl): fix misc/docker tools as well. next CL.

Fixes #832

Change-Id: I842b968a0afea8a5822913bd614d67cdbe50ee63
2016-09-08 15:14:12 +02:00
mpl bcb5fca493 pkg/sorted: log and skip on too large a key/value
So far we were returning an error, which appears to be a little too
strict, so we now just ignore when a key or value is too large, log it,
and go on.

Fixes #849

Change-Id: Iadd4eaab7459643e22ab3043d1f45e3eab662b30
2016-08-31 17:51:52 +02:00
Mathieu Lonjaret ab25a2c2fc Merge "pkg/sorted/mysql: fix detection of outdated database schema" 2016-08-09 17:09:23 +00:00
mpl fb6fe83535 pkg/sorted/mysql: fix detection of outdated database schema
Regardless of whether the database tables are newly created, we were
_always_ stamping the database schema version in the meta table BEFORE
doing the database version check. Which means said check was actually
useless.

Also add a small sanity check of the database name.

Issue #806

Change-Id: I85e19ef7583ebd5ef1043a6deb0fe61abaa4d190
2016-08-06 01:17:41 +02:00
Mathieu Lonjaret b507434d21 Merge "sorted/levedb: check error on closing iter" 2016-08-01 23:46:44 +00:00
mpl 7757b754b8 sorted/levedb: check error on closing iter
Follow-up from the findings of
https://camlistore-review.googlesource.com/6227 which hinted that the
iter "err" field was not needed.

-Added Error check on iterator Closing.

-Removed Error call in Next, because it.it.Next already does it. See
func (i *dbIter) Next(), that checks i.err, which is the same as calling
Error(). (in github.com/syndtr/goleveldb/leveldb/db_iter.go)

-the closed field, and related check in Next are not strictly necessary,
because that's part of what Release does, in conjunction with func (i
*dbIter) Next() which is checking if we already released (look for i.dir
== dirReleased). But we're keeping it and the panic for the benefit of
detecting programmer's errors.

Also added the missing leveldb tests in index pkg.

Because of a potential infinite loop error (likely related to issue #756,
and not introduced by this CL), I've added a timer triggered panic to
break that loop when it happens.

Change-Id: I26e0815f1d85279f0ead7bf90daae2ae03f1af63
2016-08-02 01:43:34 +02:00
Tamás Gulácsi 78f21f5e15 diskpacked: allow removing non-existing blob
Let double-delete test pass.
Make leveldb and memdb Deletes go on for ErrNotFound.

Add test for batch deleting nonexisting key, and partial batch delete
errors - fix it for mongo.

Fixes #760.

Change-Id: I0a0e28836a723d245564f3dabaf328bf73bf463a
2016-06-16 20:26:56 +02:00
mpl b4af9400a2 sorted/sqlkv: rollback failed transaction
Fixes #782

Change-Id: I22e933426b1f95a987699df725d24eb4317040d5
2016-06-06 22:43:47 +02:00
Brad Fitzpatrick 75d60962f6 Move remaining stuff in third_party/* to vendor/*
Change-Id: Ifbcc02817083cba68d8c1acec3e6ec50e8f61149
2016-04-20 16:49:15 -07:00
Tamás Gulácsi a2c19c1f42 Drop leveldb-go
Use github.com/syndtr/goleveldb/leveldb/memdb in pkg/sorted memKey.
This was the last usage of code.googe.com/p/leveldb-go.

Hopefully tackles issue #600.

Change-Id: Iadcf7b69557cf4834cb2a4353ed0d2159379f423
2016-04-07 20:19:45 +02:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
Will Norris 77ed42edf8 add canonical import paths
The import path was added to the go file that included the package
documentation if one existed.  Otherwise, I used what seemed to be the
primary file for the package.

Fixes #689

Change-Id: If51be0e86529fd6f179e80af6781e639f8550fd2
2016-03-13 19:57:14 -07:00
Brad Fitzpatrick d1fea28536 sorted/mysql: cap number of queries to 20 at a time
Arbitrary limit, but prevents things from exploding during request spikes.

Fixes camlistore/camlistore#683

Change-Id: I3699d25416fb6bbc1ea4f3b984b0ce05e6abf31b
2016-02-13 13:21:00 -08:00
Brad Fitzpatrick 8cf4f297eb pkg/sorted/sqlkv: don't release gate until iterator is closed
Change-Id: I4c3f5406b89294c09fb1d64aaeffc3c581664acd
2016-02-13 13:20:10 -08:00
Brad Fitzpatrick b3ba9aa7cd sorted/sqlkv, sorted/sqlite: replace Serial bool with a *syncutil.Gate
Change-Id: I820220d49b1d316d2be0ab7fe5bf302d204108b0
2016-02-13 13:01:46 -08:00
Mathieu Lonjaret d20ad1570e Merge "server/synchandler: add exported constructor and IdleWait method" 2016-01-28 00:57:56 +00:00
mpl 1773eb0859 server/synchandler: add exported constructor and IdleWait method
This change allows (for example) to hook a blobserver and an indexer
together in a way similar as they would be in a default Camlistore setup.
This is particularly useful to setup tests that require a realistic
indexer, without having to create a heavier test with e.g. test.World.

This actual goal of this change is described below. I kept these changes
together because the one described below illustrates the need for the
synchandler changes.

pkg/index/stress/: stress test the indexer with more data

The goal of these benchmkarks is to help us compare the various sorted
implementations, so we can pick the most efficient one as a default.

A second, harder, goal would be to add tests that help us estimate the
reliability of the various kv stores, again so we can rule out the buggy
ones, or help fix them.

Change-Id: I8a1fe50398a4ba09c03786502b68b6c2599e5984
2016-01-28 01:56:00 +01:00
mpl c88d81a2fd sorted/mysql: remove DB from pool when closing
Otherwise when openOrCachedDB is called for the second time,
it would return an actually closed DB.

Change-Id: I820834e508fed1a34ab7bd19a8a91e398badff9c
2016-01-06 20:42:52 +01:00
mpl 40be4d8da2 vendor: go4.org/jsonconfig (and errorutil)
Previously pkg/jsonconfig and pkg/errorutil

Copied from go4.org at rev d1b8a2fb2de6160036e4801aa5e4d855571078b8

Change-Id: I673ed55b0825baa2607289b6082f205100261d7a
2015-12-01 17:21:49 +01:00
Brad Fitzpatrick 6f58fc2426 Fix build, move more stuff from third_party to vendor. 2015-08-18 10:19:49 +02:00
Brad Fitzpatrick 06f7accf31 Require Go 1.5 (due out soon), start move from third_party to vendor.
See https://golang.org/s/go15vendor

This commit moves the google.golang.org/cloud/... packages. The rest
of third_party will move later.

This commit is a dependency for some cloud logging work which we'll
develop in Camlistore's tree.
2015-08-15 22:45:11 +02:00
mpl eec23f4a21 serverinit: use user-defined kv type everywhere, otherwise leveldb.
In a few places, cznic/kv use was hardcoded, instead of picking the user
set kv type, if any. This change makes sure we use the user-defined one,
if set, syndtr/leveldb otherwise.

Relatedly, the low-level config generated for diskpacked now uses that
same principle for its internal index. Also, if a diskpacked is
configured without an index, it now defaults to syndtr/leveldb.

Please note that this patch DOES NOT change the default kv type in the
automatically generated high-level config.

Related: #632

Change-Id: I55dbd385230878e92776e6b83d34c36fd1fa9382
2015-08-05 16:54:29 +02:00
Tamás Gulácsi 95703e8039 pkg/sorted/sqlkv: cache query after placeholder replacement
Store the strings, as the TODO said.
This memoization saves 9/10 of running time:

BenchmarkSql-4 (before)         300000     5429 ns/op
BenchmarkSql-4 (after)          3000000     430 ns/op

Change-Id: I4edabff96043620b5af3f5b507ddd75d65b22ff1
2015-07-01 21:31:13 +02:00
Tamás Gulácsi a9a7cd73fc Upgrade github.com/syndtr/goleveldb
Commit 4875955338b0a434238a31165cb87255ab6e9e4a

Because camlistored ate my CPU time (constant 170% from 2 cpu, GOMAXPROCS=1):

(pprof) top10
36 of 40 total (90.00%)
Showing top 10 nodes out of 75 (cum >= 3)
      flat  flat%   sum%        cum   cum%
         1  2.50%  2.50%         40   100%  runtime.goexit
        35 87.50% 90.00%         35 87.50%  runtime.gopark
         0     0% 90.00%         21 52.50%  runtime.selectgo
         0     0% 90.00%         21 52.50%  runtime.selectgoImpl
         0     0% 90.00%          9 22.50%  runtime.goparkunlock
         0     0% 90.00%          5 12.50%  runtime.chanrecv
         0     0% 90.00%          3  7.50%  camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb.(*DB).compactionError
         0     0% 90.00%          3  7.50%  camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb.(*DB).jWriter
         0     0% 90.00%          3  7.50%  camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb.(*DB).mCompaction
         0     0% 90.00%          3  7.50%  camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb.(*DB).mpoolDrain

Change-Id: I792840b32bcb04d304621e61fca87aeb30f21b91
2015-04-22 22:48:16 +02:00
Brad Fitzpatrick f3ae8c8c9a sorted: fix crash on double close of memory iterator
The sorted.KeyValue and Iterator interfaces both promise that it's okay
to Close twice.

Change-Id: I169f84d64c86da86e1be417b6be8551fd4d20ced
2015-04-13 20:38:42 +02:00
Brad Fitzpatrick af36d78bd7 env: add IsDev and use it everywhere
Change-Id: I5547ce989c05f1f48774f24abee41c489326baa0
2015-04-02 05:55:01 -07:00
Brad Fitzpatrick c9a0beae45 Add new 'env' package to detect the type of environment.
Also, delete my old gce package from third_party and only use the
google metadata package (which my gce package became, and which was
also already vendored into third_party)

Fixes #596

Change-Id: I64fd6f1e9dc6f433466f91f81efd2ecbf039334f
2015-04-01 08:45:36 -07:00
mpl f6bf779cd6 sorted/kvtest: close iterator ASAP to make sqlite happy
Change-Id: I7dcca4447bea262fedc6a5fbe572034bfd8cc61d
2015-03-12 16:15:56 +01:00
mpl 763a8a9e8e Merge "sorted/kv: typo in comment about max size" 2015-01-26 19:10:41 +00:00
mpl ae989d0d19 sorted/kv: typo in comment about max size
Change-Id: I8423e7ff798cc040d684f0182be17fafda1b0331
2015-01-26 20:10:02 +01:00
mpl 36dd866f36 Merge "pkg/sorted: define (larger) values for key and value sizes" 2015-01-26 19:05:22 +00:00
mpl ae38f657b8 pkg/sorted: define (larger) values for key and value sizes
Issue #429

Change-Id: Id8205ca1581c1f21b3983e13d8c3f61293868529
2015-01-26 19:39:41 +01:00
Brad Fitzpatrick aada432c52 third_party: add oauth2/google, google.golang.org/cloud, google.golang.org/api
oauth2 at 267028f9bc2a1177dc5769be38c68c1b4fbe91c4
google cloud at 2e43671e4ad874a7bca65746ff3edb38e6e93762
google api at fc402b0d6f2a46ba7dcf0a4606031f45fb82a728
  (partial commit only, since it's 16+ MB)

And update all callers from the old
code.google.com/p/google-api-go-client over to google.golang.org/api.

Change-Id: Ide190e04bb863928f98369a7c4d2b8c19fda1f66
2015-01-22 15:10:36 -08:00
Brad Fitzpatrick c4f0a62e84 sorted: add Foreach and ForeachInRange helpers
Change-Id: Ifeba7ed6719468f01585aa7f7f9a9006fdd661de
2014-10-28 05:07:55 -07:00
Tamás Gulácsi 550a8a51b3 Add sorted/leveldb.
Modify pkg/sorted/kvfile/kvfile.go to not have a named
return in Next - just as in pkg/sorted/leveldb/leveldb.go.

Change-Id: I0d46a86b33d2e1d2992d8a41f08979eb21aaddbb
2014-09-23 18:20:27 +02:00
mpl df7952b9ba mysql: create database now distinct from create tables
Because we do not want the database name to be optional with a
placeholder (/*DB*/) in the statement that creates the database, since
it is not actually optional there - as opposed to when creating tables.

Change-Id: I05351d76d95071492d763758a11454f219524510
2014-08-08 20:06:02 +02:00
Brad Fitzpatrick 031c6199da sorted/mysql: automatically find IPs of hosts named *.cloudsql.google.internal
Change-Id: Ib03add64c2c6b4de7fc6059f2a9c22065e2b2e7d
2014-08-06 17:28:55 -07:00
Brad Fitzpatrick 1e7d12f1df sqlkv: remove one of the sql expansion funcs. make batch use KeyValue's
Fixes bug with TablePrefix where batch mutations weren't getting the db prefix.

Change-Id: Ice599e607f070e374471e5ff22b426a6a5e05800
2014-08-06 17:23:43 -07:00
Brad Fitzpatrick ac5c2fd045 sorted/mysql: create the db too if it doesn't exist.
Change-Id: I566d49052057848e9d4af0f01243a89db367e20a
2014-08-06 17:21:42 -07:00
Brad Fitzpatrick 6513d525c6 sorted/mysql: don't put database name in the DSN, share connections
Change-Id: Ia4d399e72a1290f68dc2b0de71945176c6aac482
2014-08-06 16:15:08 -07:00
Brad Fitzpatrick d6a8ecce2d sorted/sqlkv: support for adding optional 'db.' prefix before table names
This is so configurations using the same database server for many
databases (multiple queues + the index) can all share the same
underlying *sql.DB

Change-Id: Iae7d4835fe9045008709c953e36b729729b1b6f4
2014-08-06 16:13:18 -07:00
Brad Fitzpatrick b65868d754 serverinit: allow specifying port numbers in user@server:port:pass
With heuristics and tests.

Change-Id: Ifacfc725db15100c447a3251c23267a5bfd313cf
2014-08-06 15:07:43 -07:00
Brad Fitzpatrick 511c3aad12 sqlite: skip test instead of failing when not compiled in
Change-Id: If7ef7308cdb7b6aec5490ec332d4dace7b7565a0
2014-08-02 10:45:49 -07:00
Andrew Gerrand c15b4c05a7 pkg/sorted/buffer: flesh out, add test
Change-Id: I18f57425ad2e9a4d692d4efe865fea81e8f143e3
2014-07-15 08:24:54 +10:00
Brad Fitzpatrick a352572e0a sorted/buffer: start of a sorted.KeyValue buffer for reindexing
Change-Id: I2617d98d6cb0b32548723ca45620b05eab91bca2
2014-06-27 12:02:16 -07:00
mpl 45ce6cfdd3 mysql: replace mymysql with go-sql-driver
from github.com/go-sql-driver/mysql at 9a7aa3606b82e2081a13a008ada88dfdb96c20fd

Context: http://camlistore.org/issue/428

Change-Id: Ia93ac35da02933bd03d2c6b7b8e5e549ba0472cb
2014-05-01 17:42:51 +02:00
mpl a9db189cd7 docker tests: remove container when done
http://camlistore.org/issue/421

Change-Id: Iefde3a8235db0103e8fcfac51f5dfcce5df73ef6
2014-04-09 23:26:14 +02:00
mpl 899acb8e72 pkg/sorted: remove API for each distinct implementation
Change-Id: I42446683189cdb00dcfbec1f221885092fdd83d6
2014-04-08 01:37:08 +02:00
Steven L. Speek 3e50f83b1c pkg/sorted/postgres: Renamed "postgresql" -> "postgres" in init()
Change-Id: I8f1ba7c970b57c62741e534c23958918714cee0b
Fixes: Issue 418
2014-04-06 21:47:53 +02:00
mpl b0c4f85ee0 sorted/postgres: test with docker
Also, NewKeyValue now automatically creates the required tables.

http://camlistore.org/issue/263

Change-Id: I02dd7660ee08c2eaeec17131622d6f581fdd6c55
2014-03-28 19:34:09 +01:00