Commit Graph

1716 Commits

Author SHA1 Message Date
Marin Tomic
ffe7df793a Remove writers preference test for RWLock
Summary:
Writers preference is not guaranteed by the standard and as such
 there are variations between implementations in different versions
of libphthread.

Reviewers: dgleich

Reviewed By: dgleich

Differential Revision: https://phabricator.memgraph.io/D1305
2018-03-19 15:57:32 +01:00
florijan
0b2d0b0d61 Fix macro bench clients common rethrow
Summary:
I think the rethrow as it was done in `.../clientes/common.hpp` is not
correct as it could have caught any exception type descending from
`BasicException`, copied it into `optional<BasicException>` and thus
losing exact type and members of the original exception. I think that
the proposed formulation of a rethrow in the `catch` does it properly.
I made a small test for this behavior, see P11.

Reviewers: teon.banek, mferencevic, mislav.bradac

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1298
2018-03-16 11:26:04 +01:00
florijan
95f1b6fe56 Fix remote plan invalidation
Summary:
Ensures that query plans are invalidated on the remote only when it's
guaranteed they will never be used on the master. This is done by
invalidating remote caches in the `CachedPlan` destructor.

There are two unplesant side-effects. First, an RPC call is made in an
object destructor. This is somewhat ugly, but not that different then
making an RPC call that must succeed in any other function. Note that
this does NOT slow down any query execution because the relevant
destructor is called by the skiplist garbage collector. The second ugly
side-effect is that in the unit test now we need to sleep to ensure the
skiplist GC destructs a cached plan before checking that it's
invalidated on the remote worker.

We might want to redesign this at some point.

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1302
2018-03-16 11:18:16 +01:00
Marin Tomic
83302e2c69 Make Version destructor non-recursive
Summary:
Recursion in Version destructor was causing a SEGFAULT for
long version lists because of a stack overflow.

Reviewers: florijan

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1301
2018-03-15 11:12:51 +01:00
Marin Tomic
2263a423b8 Add deletion, more stats to card fraud and RWLock
Summary:
^^

this is a sample config to be used:
```
{
    "num_workers": 1,
    "cards_per_worker": 10001,
    "pos_per_worker": 10001,

    "fraud_probability": 0.01,
    "hop_probability": 0.05,

    "cleanup": {
        "check_interval_sec": 10,
        "tx_hi": 150000,
        "tx_lo": 100000
    },

    "analytic": {
        "query_interval_ms": 500,
        "pos_limit": 10
    }
}
```

I also added `RWLock` --- a wrapper around `pthread_rwlock`

Reviewers: mferencevic, mculinovic, florijan, teon.banek

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1280
2018-03-14 16:23:23 +01:00
florijan
7dbee00f2f Fix updating a newly created edge
Reviewers: msantl, teon.banek, dgleich

Reviewed By: msantl

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1299
2018-03-14 12:49:24 +01:00
florijan
543f953ab5 Check all RPC call results
Summary: Also make error reporting in consistent style: "NameRpc failed"

Reviewers: teon.banek, msantl

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1294
2018-03-13 15:16:50 +01:00
florijan
03f1547a8d Invalidate distributed plan caches
Summary:
 - Remove caches on workers as a result of plan expiration or race
   during insertion.
 - Extract caching functionality into a class.
 - Minor refactor of Interpreter::operator()
 - New RPC and test for it.
 - Rename ConsumePlanRes to DispatchPlanRes for consistency, remove
   return value as it's always true and never used.
 - Interpreter is now constructed with a `GraphDb` reference. At the
   moment only for reaching the `distributed::PlanDispatcher`, but in
   the future we should probably use that primarily for planning.

I added a function to `PlanConsumer` that is only used for testing.
I prefer not doing this, but I felt this needed testing. I can remove
it now if you like.

Reviewers: teon.banek, msantl

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1292
2018-03-13 14:59:51 +01:00
Teon Banek
226992f420 Check values can be used for range indexed ScanAll
Summary: Test indexing ScanAll with invalid property values

Reviewers: florijan, msantl

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1293
2018-03-13 10:23:30 +01:00
Teon Banek
db5d991abf Make not-returning expected type a compile error
Reviewers: florijan, mferencevic, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1295
2018-03-13 10:19:11 +01:00
Matija Santl
4e29b7031a Add a class that logs stacktrace on destruction
Summary:
Added a class that is supposed to be used as a base class on classes
where we want to see the stacktrace of destructor call.

Example of the output is P7 where classes `GraphDb` and `Client` extend
`LogDestructor` base.

Reviewers: florijan, teon.banek

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1281
2018-03-13 10:10:52 +01:00
florijan
44aefe775e Fix flakyness in tests/unit/distributed_coord
Summary:
Instead of waiting for a fix period for the coordinations to start and
coordinate with the master, wait for each of them individually to report
being done.

Also: rename `WorkerInThread` to `WorkerCoordinationInThread`.

Reviewers: dgleich, teon.banek, msantl

Reviewed By: msantl

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1288
2018-03-12 12:30:59 +01:00
florijan
67092ae4d7 Fix ScanAll cursor family w.r.t. empty collections
Reviewers: teon.banek, dgleich, msantl

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1291
2018-03-12 11:18:07 +01:00
Dominik Gleich
a97de56d31 Forcefully set hints in gc phase
Summary:
Phase 2

Force populate hints

Reviewers: florijan

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1285
2018-03-09 14:51:32 +01:00
florijan
bdc7ec9b71 Create a local distributed test based on the credit card fraud demo.
Reviewers: msantl, mtomic

Reviewed By: msantl

Differential Revision: https://phabricator.memgraph.io/D1289
2018-03-09 13:52:42 +01:00
florijan
42ca81eb01 Use custom future that waits on destruct
Reviewers: teon.banek, dgleich

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1286
2018-03-09 10:16:17 +01:00
florijan
848749cf25 Fix and rename REPL
Summary: Fix and rename REPL

Reviewers: teon.banek

Reviewed By: teon.banek

Differential Revision: https://phabricator.memgraph.io/D1284
2018-03-08 10:58:43 +01:00
Marin Tomic
68c68655cc Fix transaction id offset
Summary: ^^

Reviewers: mferencevic

Reviewed By: mferencevic

Differential Revision: https://phabricator.memgraph.io/D1283
2018-03-07 16:49:55 +01:00
Marin Tomic
0013c80881 Change transaction id distribution strategy
Summary: this will make delete query more efficient

Reviewers: mferencevic, mculinovic

Reviewed By: mferencevic

Differential Revision: https://phabricator.memgraph.io/D1282
2018-03-07 14:47:19 +01:00
Matija Santl
b8685509aa Add distributed cartesian test
Summary: Cartesian test

Reviewers: teon.banek, florijan

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1279
2018-03-07 11:17:19 +01:00
Matija Santl
011b653ce6 Fix RemoteProduceRpcServer OngoingProduce
Summary: Create a map entry with correct key (tx_id and plan_id).

Reviewers: teon.banek, florijan

Reviewed By: teon.banek

Subscribers: mferencevic

Differential Revision: https://phabricator.memgraph.io/D1278
2018-03-06 16:11:33 +01:00
Marin Tomic
5637703317 add strata v1 scenario
Reviewers: mculinovic, mferencevic

Reviewed By: mferencevic

Subscribers: pullbot, buda

Differential Revision: https://phabricator.memgraph.io/D1266
2018-03-06 11:20:39 +01:00
Marko Culinovic
89cf8ca077 Add connected_frauds to pos properties
Summary: Property connected_frauds added and set to zero for strata scenario.

Reviewers: mtomic

Reviewed By: mtomic

Differential Revision: https://phabricator.memgraph.io/D1275
2018-03-06 11:02:09 +01:00
florijan
23efdf27d0 Optimize card_fraud_generate_snapshot
Summary:
Reduce memory usage and execution time in card fraud snapshot
generation.

Reviewers: mculinovic

Reviewed By: mculinovic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1270
2018-03-05 16:36:00 +01:00
Teon Banek
9c95d4c381 Allow replacing Accumulate with Synchronize in all cases
Summary:
This fixes a bug where the planning would raise NotYetImplemented error,
due to preventing plan splitting while the operator is already on
master. For example, `MATCH (a), (b) CREATE (a)-[e:r]->(b) RETURN e`
would split the plan after Cartesian and before Create. Thus, the rest
of the plan would be on master, including the Accumulate before Produce.
We still can (and must) replace Accumulate with Synchronize but this
would fail due to unneeded check.

Reviewers: florijan, msantl

Reviewed By: msantl

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1272
2018-03-05 15:35:36 +01:00
florijan
43c0e91057 Enable transaction killer on worker
Summary:
I have not thoroughly thought this through, especially the worker
destruction (is it legit to abort all running tx?), but it's tested to
abort during remote pull, what we need.

Also I improved error handling for vertex deletion failure during
remote pull (@dgleich).

Reviewers: teon.banek, msantl, dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1263
2018-03-05 12:45:42 +01:00
Matej Ferencevic
41f3b75709 Remove stats to mitigate lock contention
Reviewers: mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1271
2018-03-05 11:53:51 +01:00
Matej Ferencevic
36eed4743a Improve RPC client error messages
Reviewers: mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1268
2018-03-05 10:42:46 +01:00
Matej Ferencevic
f3da6a7bf3 Fix socket file descriptor leaks
Reviewers: mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1267
2018-03-05 10:41:55 +01:00
Marin Tomic
d673d692cb Add error message to AvailableMem
Summary:
test:

```
#include <iostream>
#include "utils/sysinfo/memory.hpp"

#include <sys/resource.h>

int main(void) {
  rlimit lim;
  lim.rlim_cur = 0;
  lim.rlim_max = 0;
  setrlimit(RLIMIT_NOFILE, &lim);
  std::cout << utils::AvailableMem();
  return 0;
}
```

Prints out:
```
E0303 15:08:53.314087 17511] Failed to read amount of available memory from /proc/meminfo
```

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1269
2018-03-05 10:18:16 +01:00
Marko Culinovic
a997d7a15b Modify kill and clean operations
Summary:
Clean operations are executed in parallel, kill command now
kills memgraph on all machines explicitly.

Reviewers: mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1259
2018-03-05 10:00:43 +01:00
Matija Santl
418db646c1 Abort from remote pulls if db says so
Summary:
If the `db` says we need to abort we should abort. There are two
places (in both `PullRemote` and `PullRemoteOrderBy`) where the check is made.
The first one is on the very beginning of the `Pull` method and the second one
is in the loop that checks/waits for remote results.

Reviewers: teon.banek, florijan

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1265
2018-03-02 14:23:02 +01:00
Dominik Gleich
d5b9a11e87 DetachRemoveVertex remote
Reviewers: florijan

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1264
2018-03-02 10:51:26 +01:00
Matija Santl
1ca98826af Use the same ClientPools in distributed
Summary:
Instead of passing `coordination`, pass `rpc_worker_clients` that
holds a map of worker_id->clientPool. By having only one instance of
`RpcWorkerClients` that is owned by `GraphDB` and passing it by refference
we'll share the same client pools for rpc clients.

Reviewers: teon.banek, florijan, dgleich, mferencevic

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1261
2018-03-01 17:14:59 +01:00
Teon Banek
f963c54f77 Use 10us sleep while waiting on RPC
Summary:
Usually a single RPC call takes 50us, which is a lot lower than our
millisecond sleep. Calling sleep with less than a ms duration may not
be really supported (due to timer granularity), but this change should
cause some sub-ms sleep.

Reviewers: florijan, msantl, mferencevic

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1258
2018-03-01 14:50:36 +01:00
Matej Ferencevic
5839dbc401 Fix distributed tests
Reviewers: mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1262
2018-03-01 13:19:18 +01:00
florijan
75c6a57ec2 Comment detach delete logic
Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1260
2018-03-01 10:38:07 +01:00
Teon Banek
b7f77d40ad Stack allocate the RPC Request
Summary:
There's no need to heap allocate the request which is used only to be
serialized and sent over the network. Unfortunately, this change
complicates the reading a bit, because we need to deserialize the raw
pointer and put it in std::unique_ptr instead of simply deserializing
the unique_ptr.

Heap allocation shows up visibly in perf during benchmarks, so this
change may yield some improvement.

Reviewers: mferencevic, mtomic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1254
2018-02-28 16:22:45 +01:00
florijan
e61bb8ab1e Support distributed edge removal
Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1256
2018-02-28 14:35:40 +01:00
Matej Ferencevic
1c1da67745 Fix master build
Reviewers: mtomic, buda

Reviewed By: mtomic

Differential Revision: https://phabricator.memgraph.io/D1255
2018-02-28 12:23:53 +01:00
Dominik Gleich
4c8f924965 Optimize locks
Summary: Speedup findsetnewold

Reviewers: florijan, buda, teon.banek

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1252
2018-02-28 11:36:03 +01:00
Dominik Gleich
99375a4b47 Vertex removal using rpcs
Summary:
Remove vertex remote

Add tests

Reviewers: florijan, teon.banek

Reviewed By: florijan

Subscribers: teon.banek, pullbot

Differential Revision: https://phabricator.memgraph.io/D1230
2018-02-28 11:35:44 +01:00
Matej Ferencevic
7e945c6667 Integrate distributed card fraud test with Apollo
Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1247
2018-02-28 11:09:18 +01:00
Matej Ferencevic
19abd0ce02 Move TED talk examples to another suite in QA
Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1249
2018-02-27 19:19:42 +01:00
Marko Culinovic
9af3e99928 Remove log
Reviewers: buda

Reviewed By: buda

Differential Revision: https://phabricator.memgraph.io/D1253
2018-02-27 19:01:18 +01:00
Marko Culinovic
e5f14cdcb6 Add cluster prefix flag to statsd
Summary:
Flag cluster-prefix is added because we want to differentiate
between stats collected on different memgraph clusters.

Reviewers: mtomic, buda

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1245
2018-02-27 18:06:00 +01:00
Dominik Gleich
79dc10960e Fix double free
Summary: It was possible for transaction to be double freed because both the AllClear and SingleClear of transactions could delete the pointer

Reviewers: florijan, mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1250
2018-02-27 14:31:18 +01:00
Matej Ferencevic
a826f41444 Temporarily disable parallel macro benchmarks
Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1248
2018-02-27 11:05:13 +01:00
florijan
bb62f463f8 Refactor distributed transactional cache GC
Summary:
Release of per-transaction data in distributed Memgraph refactored. The
master node no longer releases each time a transaction is done, thus
offloading some work from the engine.

Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1235
2018-02-27 10:47:58 +01:00
Matej Ferencevic
7b262599e6 Fix Bolt timeout check
Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1242
2018-02-26 18:18:01 +01:00