Commit Graph

822 Commits

Author SHA1 Message Date
Hector Sanjuan
47f7fe7d92 Fix #346: Enable NAT hole punching for libp2p host
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-27 17:47:46 +02:00
Hector Sanjuan
059fcdaa42 Go-libp2p: update to 5.0.17
Among other things, this fixes race condition test failures in libp2p and
random panics in go-log.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-27 17:30:47 +02:00
Hector Sanjuan
c4c6e17ccf
Merge pull request #436 from Laevos/fix/indirectpinstatus
fix #428: Use a regexp to match for indirect status in IPFSPinStatusF…
2018-05-27 12:06:18 +02:00
Hector Sanjuan
41552621e6
Merge pull request #437 from Laevos/fix/lockfile
fix #423: Remove lock file when daemon force quits
2018-05-27 12:04:02 +02:00
Laevos
a01ecab3a7 fix #423: Remove lock file when daemon force quits
License: MIT
Signed-off-by: Lilith McMullen <iggnsthe@live.com>
2018-05-25 21:01:46 -05:00
Laevos
a3c77dafb8 fixed formatting issues
License: MIT
Signed-off-by: Lilith McMullen <iggnsthe@live.com>
2018-05-25 20:38:47 -05:00
Laevos
e62c4171ef fix #428: Use a regexp to match for indirect status in IPFSPinStatusFromString()
Since indirect pins are of the form `indirect through <cid>`, let's use
a regexp to match them instead of an equality operator.

License: MIT
Signed-off-by: Lilith McMullen <iggnsthe@live.com>
2018-05-25 20:08:45 -05:00
Hector Sanjuan
2e05583bb4
Merge pull request #429 from ipfs/fix/StatusSync
StateSync(): some improvements
2018-05-25 10:29:40 +02:00
Hector Sanjuan
5e6f73bdc1
Merge pull request #430 from ipfs/fix/data-folder
Fix/data folder
2018-05-25 10:12:23 +02:00
Hector Sanjuan
4d8f975d9b StateSync(): some improvements
This commit:

* Does not collect and return changed items when doing StateSync (they are
not used)
* Removes the StateSync RPC method (no longer used)
* Uses tracker.StatusAll() rather than requesting Status on each Cid (should
be faster with upcoming pintracker)
* Does not launch a go-routine to track every item. Track is an async
operation. This likely causes 1000s goroutines to be started with no good
reason.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-25 09:58:18 +02:00
Hector Sanjuan
7638fabe1e Fix sharness
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-25 09:54:52 +02:00
Hector Sanjuan
6d9ddfaf85
Merge pull request #427 from ipfs/fix/pin-context-timeout
ipfshttp: Use custom http clients for pin/unpin
2018-05-25 09:44:53 +02:00
Hector Sanjuan
4942ddc6d4 Raft: automatically rename ipfs-cluster-data folder to "raft"
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-24 17:03:05 +02:00
Hector Sanjuan
aeb6b005d1 Consensus: Make the default Raft data folder name "raft"
This is a breaking change.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-24 16:54:24 +02:00
Hector Sanjuan
9336097791
Merge pull request #426 from MichaelMure/fix/make-rebuild
Makefile: add a source target to properly trigger a build on source change
2018-05-24 09:24:53 +02:00
Hector Sanjuan
9662bb27f9
Merge pull request #418 from ipfs/update/gx
Update to latest gx version. Be more verbose when installing.
2018-05-24 09:23:06 +02:00
Hector Sanjuan
2f2a70b4ba
Merge pull request #420 from ipfs/feat/pin-method-default-refs
Set refs as default pinning method, with 10 parallel pins
2018-05-24 09:20:26 +02:00
Adrian Lanzafame
80e7baca91
ipfshttp: hande request timeouts to ifps daemon correctly
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-24 17:13:56 +10:00
Michael Muré
047fa48ec9
Makefile: add a source target to properly trigger a build on source change
Fix #425

License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>
2018-05-18 01:46:19 +02:00
Hector Sanjuan
5563297d40 Set refs as default pinning method, with 10 parallel pins
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 17:00:33 +02:00
Hector Sanjuan
cc698e2ecf Update to latest gx version. Be more verbose when installing.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 14:54:46 +02:00
Hector Sanjuan
884f9d199a
gx publish 0.4.0-rc1
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 11:57:55 +02:00
Hector Sanjuan
16c602e5c7
Release 0.4.0-rc1
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 11:56:38 +02:00
Hector Sanjuan
bbc9cc65aa
Merge pull request #417 from ipfs/fix/govet
Fix: some govet warnings
2018-05-14 11:53:07 +02:00
Hector Sanjuan
e9cf656bbe
Merge pull request #415 from ipfs/fix/408-TestClustersPin-final
Fix #408: Race condition when StateSync runs
2018-05-14 11:51:57 +02:00
Hector Sanjuan
73aabfa8ec Fix #408: Race condition when StateSync runs
When StateSync() runs and triggers Untrack() on items
that have just been removed from the state but on which
Untrack() is underway, the operation tracker would be
reset to phase queued and in some cases stay so.

Also happened for Track()

This caused failures of TestClustersPin as SyncStatus()
is triggered regularly while Tracks() and Untracks() happen.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-12 10:49:45 +02:00
Hector Sanjuan
aa1f74e69b Fix: some govet warnings
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-11 19:59:10 +02:00
Hector Sanjuan
7b9aac969e
Merge pull request #400 from ipfs/feat/pubsub-monitoring
Feat: pubsub monitoring
2018-05-09 13:21:06 +02:00
Hector Sanjuan
5ca8ca39eb Monitor/tests: Allow to run tests using the basic monitor.
Do it in additional stage in Travis.

Also, test fixes.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-09 11:39:21 +02:00
Hector Sanjuan
69c47fe811 Monitor: remove safe parameter for metrics.Window
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-09 11:01:52 +02:00
Hector Sanjuan
e4844ca819 Monitor: address comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-09 11:01:52 +02:00
Hector Sanjuan
6159a7f15a Cluster: do not request metrics from leader on allocate()
The monitors now do broadcasting and we can get metrics from the
local one.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-09 11:01:52 +02:00
Hector Sanjuan
954ede931f Monitor: more refactoring. Rename util to metrics
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-09 11:01:41 +02:00
Hector Sanjuan
8c8487d74b Pubsubmon: enable by default when using ipfs-cluster-service
This makes pubsubmon the default. The basic monitor is still usable
with a hidden --monitor basic flag.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 18:47:05 +02:00
Hector Sanjuan
bb8c20b2fb Enable pubsubmon in cluster e2e tests
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 18:47:05 +02:00
Hector Sanjuan
6f84b3bb01 Add new pubsubmon: A monitor that uses pubsub to send and receive metrics
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 18:47:05 +02:00
Hector Sanjuan
73b962f799 Basic Monitor: test Publish()
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:26:06 +02:00
Hector Sanjuan
a9d6fe3479 Types: rename metric.SetTTLDuration to metric.SetTTL
GetTTL returns duration. SetTTL should take duration too, not seconds.
This removes the original SetTTL method which used seconds.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:26:06 +02:00
Hector Sanjuan
8f8e76ac9a Monitor: extract MetricsChecker to util module
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:26:06 +02:00
Hector Sanjuan
72e1d64de2 Fix publish cancelling contexts too early.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:26:06 +02:00
Hector Sanjuan
3c3341e491 Monitor: add PublishMetric() to component interface
The monitor component should be in charge of deciding how it is
best to send metrics to other peers and what that means.

This adds the PublishMetric() method to the component interface
and moves that functionality from Cluster main component to the
basic monitor.

There is a behaviour change. Before, the metrics where sent only to
the leader, while the leader was the only peer to broadcast them everywhere.
Now, all peers broadcast all metrics everywhere. This is mostly
because we should not rely on the consensus layer providing a Leader(), so
we are taking the chance to remove this dependency.

Note that in any-case, pubsub monitoring should replace the
existing basic monitor. This is just paving the ground.

Additionally, in order to not duplicate the multiRPC code
in the monitor, I have moved that functionality to go-libp2p-gorpc
and added an rpcutil library to cluster which includes useful
methods to perform multiRPC requests (some of them existed in
util.go, others are new and help handling multiple contexts etc).

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:26:06 +02:00
Hector Sanjuan
1886782530 Feat pubsubmon: Extract MetricsWindow to utils module
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 14:24:49 +02:00
Hector Sanjuan
029cd77c27
Merge pull request #398 from ipfs/feat/promote-consensus
Emancipate the consensus component
2018-05-07 08:29:14 +02:00
Hector Sanjuan
33d9cdd3c4 Feat: emancipate Consensus from the Cluster component
This commit promotes the Consensus component (and Raft) to become a fully
independent thing like other components, passed to NewCluster during
initialization. Cluster (main component) no longer creates the consensus
layer internally. This has triggered a number of breaking changes
that I will explain below.

Motivation: Future work will require the possibility of running Cluster
with a consensus layer that is not Raft. The "consensus" layer is in charge
of maintaining two things:
  * The current cluster peerset, as required by the implementation
  * The current cluster pinset (shared state)

While the pinset maintenance has always been in the consensus layer, the
peerset maintenance was handled by the main component (starting by the "peers"
key in the configuration) AND the Raft component (internally)
and this generated lots of confusion: if the user edited the peers in the
configuration they would be greeted with an error.

The bootstrap process (adding a peer to an existing cluster) and configuration
key also complicated many things, since the main component did it, but only
when the consensus was initialized and in single peer mode.

In all this we also mixed the peerstore (list of peer addresses in the libp2p
host) with the peerset, when they need not to be linked.

By initializing the consensus layer before calling NewCluster, all the
difficulties in maintaining the current implementation in the same way
have come to light. Thus, the following changes have been introduced:

* Remove "peers" and "bootstrap" keys from the configuration: we no longer
edit or save the configuration files. This was a very bad practice, requiring
write permissions by the process to the file containing the private key and
additionally made things like Puppet deployments of cluster difficult as
configuration would mutate from its initial version. Needless to say all the
maintenance associated to making sure peers and bootstrap had correct values
when peers are bootstrapped or removed. A loud and detailed error message has
been added when staring cluster with an old config, along with instructions on
how to move forward.

* Introduce a PeerstoreFile ("peerstore") which stores peer addresses: in
ipfs, the peerstore is not persisted because it can be re-built from the
network bootstrappers and the DHT. Cluster should probably also allow
discoverability of peers addresses (when not bootstrapping, as in that case
we have it), but in the meantime, we will read and persist the peerstore
addresses for cluster peers in this file, different from the configuration.
Note that dns multiaddresses are now fully supported and no IPs are saved
when we have DNS multiaddresses for a peer.

* The former "peer_manager" code is now a pstoremgr module, providing utilities
to parse, add, list and generally maintain the libp2p host peerstore, including
operations on the PeerstoreFile. This "pstoremgr" can now also be extended to
perform address autodiscovery and other things indepedently from Cluster.

* Create and initialize Raft outside of the main Cluster component: since we
can now launch Raft independently from Cluster, we have more degrees of
freedom. A new "staging" option when creating the object allows a raft peer to
be launched in Staging mode, waiting to be added to a running consensus, and
thus, not electing itself as leader or doing anything like we were doing
before. This additionally allows us to track when the peer has become a
Voter, which only happens when it's caught up with the state, something that
was wonky previously.

* The raft configuration now includes an InitPeerset key, which allows to
provide a peerset for new peers and which is ignored when staging==true. The
whole Raft initialization code is way cleaner and stronger now.

* Cluster peer bootsrapping is now an ipfs-cluster-service feature. The
--bootstrap flag works as before (additionally allowing comma-separated-list
of entries). What bootstrap does, is to initialize Raft with staging == true,
and then call Join in the main cluster component. Only when the Raft peer
transitions to Voter, consensus becomes ready, and cluster becomes Ready.
This is cleaner, works better and is less complex than before (supporting
both flags and config values). We also backup and clean the state whenever
we are boostrapping, automatically

* ipfs-cluster-service no longer runs the daemon. Starting cluster needs
now "ipfs-cluster-service daemon". The daemon specific flags (bootstrap,
alloc) are now flags for the daemon subcommand. Here we mimic ipfs ("ipfs"
does not start the daemon but print help) and pave the path for merging both
service and ctl in the future.

While this brings some breaking changes, it significantly reduces the
complexity of the configuration, the code and most importantly, the
documentation. It should be easier now to explain the user what is the
right way to launch a cluster peer, and more difficult to make mistakes.

As a side effect, the PR also:

* Fixes #381 - peers with dynamic addresses
* Fixes #371 - peers should be Raft configuration option
* Fixes #378 - waitForUpdates may return before state fully synced
* Fixes #235 - config option shadowing (no cfg saves, no need to shadow)

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 07:39:41 +02:00
Hector Sanjuan
bfcf700fa8
Merge pull request #383 from ipfs/feat/pintracker-revamp
Feat: pintracker revamp
2018-05-07 07:38:15 +02:00
Hector Sanjuan
f748cbcb03
Merge pull request #403 from LEonGAo1991/fix/unit-test-for-https-endpoint
Add unit test for HTTPS endpoint
2018-05-05 19:42:47 +02:00
LeonGGGG
50dd729a52 Fix #191: Add go HTTPs tests
Added https server and client in restapi_test.go, with a sample unit test in TestRestAPIIDEndpoint

License: MIT
Signed-off-by: Liang Gao lianggao91@hotmail.com
2018-05-04 18:31:29 -07:00
Adrian Lanzafame
19257ad8fd
finish maptracker tests
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-04 21:18:30 +10:00
Adrian Lanzafame
401eb408c4
rename operationCtx functions
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-05-04 21:18:12 +10:00
Hector Sanjuan
859cf75a01 Pintracker: improve tests
Avoid writing tests which will hang indefinitely on failure conditions.
Introduce TODOs.
Rename some vars to more explicit names.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-02 16:13:18 +02:00