Commit Graph

1331 Commits

Author SHA1 Message Date
Hector Sanjuan
de56cf166e Address comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-28 11:59:26 +02:00
Hector Sanjuan
01f7a9e4e8 Fix: maptracker race issues
This commit attempts to fix race issues in the maptracker since the
introduction of the OperationTracker.

There were two main problems:
 * Duplicity tracking the state both in the state map and the opTracker
 * Non atomiciy of operations with different threads being able to affect
 other threads operations.

A test performing random Track/Untracks on the same Cid quickly showed
that items would sometimes stay as pin_queued or pin_unqueued. That happened
because operations could be cancelled under the hood by a different request,
while leaving the map status untouched.

It was not simply to deal with this issues without a refactoring.

First, the state map has been removed, and the operation tracker now provides
status information for any Cid. This implies that the tracker keeps all
operations and operations have a `PhaseDone`. There's also a
new `OperationRemote` type.

Secondly, operations are only created in the tracker and can only be removed
by their creators (they can be overwritten by other operations though).
Operations cannot be accessed directly and modifications are limited to setting
Error for PhaseDone operations.

After created, *Operations are queued in the pinWorker queues which handle any
status updates. This means, that, even when an operation has been removed from
the tracker, status updates will not interfere with any other newer operations.

In the maptracker, only the Unpin worker Cleans operations once processed. A
sucessful unpin is the only way that a delete() happens in the tracker map.
Otherwise, operations stay there until a newer operation for the Cid arrives
and 1) cancels the existing one 2) takes its place. The tracker refuses to
create a new operation if a similar "ongoing" operation of the same type
exists.

The final change is that Recover and RecoverAll() are not async and play by the
same rules as Track() and Untrack(), queueing the items to be recovered.

Note: for stateless pintracker, the tracker will need to Clean() operation
of type OperationPin as well, and complement the Status reported
by the tracker with those coming from IPFS.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-28 11:59:26 +02:00
Hector Sanjuan
acc8366f58 Rename optracker to pintracker/optracker
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-28 11:59:26 +02:00
Adrian Lanzafame
c89508035a Maptracker: extract optracker and make improvements
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-28 11:59:26 +02:00
Hector Sanjuan
d92751a0d0
Merge pull request #439 from ipfs/go-1.10
Test with Go 1.10
2018-05-28 10:19:35 +02:00
Hector Sanjuan
9d278cbb44
Merge pull request #441 from ipfs/fix/host-nat
Fix #346: Enable NAT hole punching for libp2p host
2018-05-28 10:19:17 +02:00
Hector Sanjuan
530c23f7b4
Merge pull request #440 from ipfs/gx/update-psxsm3
Go-libp2p: update to 5.0.17
2018-05-28 10:18:51 +02:00
Hector Sanjuan
926a5e28cc Remove coverage.sh. Go 1.10 supports a coverprofile from multiple packages.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-27 18:19:14 +02:00
Hector Sanjuan
37a75e5e38 Test with Go 1.10
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-27 18:11:05 +02:00
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