Commit graph

368 commits

Author SHA1 Message Date
Viktor Klang
cd8e97c060 +act - 15757 - Reworks implementation of ActorSystem shutdown
* deprecates awaitTermination, shutdown and isTerminated
  * introduces a terminate-method that returns a Future[Unit]
  * introduces a whenTerminated-method that returns a Future[Unit]
  * simplifies the implementation by removing blocking constructs
  * adds tests for terminate() and whenTerminated
2014-08-25 15:49:28 +02:00
Konrad Malawski
2a8d1c4727 Merge pull request #15713 from ktoso/port-fix-local-snapshotstore-recovery-ktoso
=per #15671 fix local snapshot store picking up wrong file (Validation)
2014-08-21 15:47:01 +02:00
Brendan Lawlor
f336b24830 =per #15671 fix local snapshot store picking up wrong file.
Added spec test to cover fix for bug 15671

Replaced deprecated NamedProcessor with NamedPersistentActor. Cleaned up unused message handling. Typos and misspellings.
2014-08-21 13:56:19 +02:00
Konrad 'ktoso' Malawski
fdb0d9ee3b =per #15590 Increase efforts to in-order on start of ALOD
AtLeastOnceDelivery can delivery out-of-order, and that's OK.
Although, in the case of message replay followed by taking user land
commands which may trigger `deliver` calls, it is nicer to at least once
try to send the replayed but not confirmed deliveries *first*, before
sending the completely new deliveries.

This change acomplishes this by triggering redelivery explicitly when
recovery has finished, and setting the timestamps on these messages a
bit in the past, so they hit their redelivery deadline right away during
this recovery induced redelivery.

Resolves #15590
2014-08-12 11:28:25 +02:00
Konrad 'ktoso' Malawski
ba3543b046 =per #15575 lessen timing issue in AtLeastOnce spec
* lower redelivery interval does not change semantics here (no one
  answers anyway), and lessens the changes to be "unlucky" with gc pauses
* was unable to reproduce error with snapshotting in 80 builds on
  jenkins. Brainstormed possible errors but not found yet..
2014-07-23 15:48:46 +02:00
Patrik Nordwall
57dece5165 =per #15472 Flush instead of unstash when PersistentActor restarts
* When using the Processor batching buffer for persistAsync and defer
  the events were unstashed by Processor.aroundPreRestart and
  thereby were received as commands after restart
* Instead we must flush this buffer when using PersistentActor

(cherry picked from commit 627ce2fc85739e221524ec48725362ef7c0566ea)
2014-06-30 13:19:15 +02:00
Patrik Nordwall
9a4425ed19 =per Fix minor doc issues
(cherry picked from commit 45c07e1f2f131e70a03b82803f11fd390572ccba)
2014-06-28 17:33:08 +02:00
Patrik Nordwall
8eec3f92d3 =per #15457 Correlate persistAsync handlers with journal messages
We have assumed that the handlers can be popped when replies come back from journal, but if messages to journal are in flight when the actor is restarted the handlers does not match up with journal replies.

This solution ignores journal replies that were emitted by an old PersistentActor instance
by passing an uid with the journal messages. This means that the handler will not be
invoked for such messages.

(cherry picked from commit 7ebaaab669c9e467a1ffb4d9ed8b6500e1801a7c)

Conflicts:
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/Processor.scala
	akka-persistence/src/main/scala/akka/persistence/journal/AsyncWriteJournal.scala
2014-06-28 17:21:55 +02:00
Patrik Nordwall
33c7f6bb4f !per Change for journal plugin compatibility
* A few more adjustments, found when verifying source compatibility of a few
  journal plugins
* Note that PersistentId will be removed with deleteMessage and we should
  not break plugins because of that
* Add missing section of at-least-once delivery in migration guide

(cherry picked from commit 6727eac6d07280d277968e2e25db44e02be3b102)

Conflicts:
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/Persistent.scala
	akka-persistence/src/main/scala/akka/persistence/Snapshot.scala
	akka-persistence/src/main/scala/akka/persistence/journal/AsyncWriteProxy.scala
2014-06-28 17:11:06 +02:00
Patrik Nordwall
f6aa491ef0 !per Additional deprecations and cleanup
(cherry picked from commit 98619647e372121fb3c2072a0eab20de4148f7d9)

Conflicts:
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/snapshot/SnapshotStore.scala
2014-06-28 16:07:08 +02:00
Patrik Nordwall
33027999da !per #15427 Deprecate deleteMessage and writeConfirmations in journal plugin api
(cherry picked from commit 4c271b6b092989ebde26fcd135e6ad56f797a763)
2014-06-28 15:59:58 +02:00
Patrik Nordwall
07e67b90ea !per #15428 Deprecate deleteMessage
(cherry picked from commit 4973d0b37d635a0a2c9a94c2898da988e4f14fc7)
2014-06-28 15:59:33 +02:00
Patrik Nordwall
b667e6c37a =per #15459 Use full batching for persistAsync and defer
(cherry picked from commit 20ac844b4f3999d0261f1a08957c2c2a8367c672)

Conflicts:
	akka-bench-jmh/src/main/scala/akka/persistence/PersistenceActorDeferBenchmark.scala
2014-06-27 12:18:56 +02:00
Patrik Nordwall
32ca608c97 +per #15327 Add AtLeastOnceDelivery trait
* also remove final of around methods, and let deliver send when not recoveryRunning

(cherry picked from commit 312b0d107a179accaf135f64ed9c3b78f3e351d1)
2014-06-26 22:58:46 +02:00
Konrad 'ktoso' Malawski
b1d1d87111 !per #15436 make persistenceId abstract in NEW classes
(cherry picked from commit de3249f7f4b859c3caa232e579d9a3bae7406803)

Conflicts:
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/PersistentActorExample.scala
2014-06-26 16:29:30 +02:00
Konrad 'ktoso' Malawski
3fd240384c +per #15424 Added PersistentView, deprecated View
A PersistentView works the same way as View did previously, except:

* it requires an `peristenceId` (no default is provided)
* messages given to `receive` are NOT wrapped in Persistent()

akka-streams not touched, will update them afterwards on different branch

Also solves #15436 by making persistentId in PersistentView abstract.

(cherry picked from commit dcafaf788236fe6d018388dd55d5bf9650ded696)

Conflicts:
	akka-docs/rst/java/lambda-persistence.rst
	akka-docs/rst/java/persistence.rst
	akka-docs/rst/scala/persistence.rst
	akka-persistence/src/main/scala/akka/persistence/Persistent.scala
	akka-persistence/src/main/scala/akka/persistence/View.scala
2014-06-26 10:10:09 +02:00
Patrik Nordwall
d6ffdf521c =per #15429 Rewrite persistence documentation and samples for 2.3.4 changes
(cherry picked from commit 02351e32f110a8c4a249f0f3f84bae5898d1a836)

Conflicts:
	akka-samples/akka-sample-persistence-java-lambda/tutorial/index.html
	akka-samples/akka-sample-persistence-java/tutorial/index.html
	akka-samples/akka-sample-persistence-scala/build.sbt
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/ConversationRecoveryExample.scala
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/PersistentActorExample.scala
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/ProcessorChannelExample.scala
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/ProcessorChannelRemoteExample.scala
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/SnapshotExample.scala
	akka-samples/akka-sample-persistence-scala/src/main/scala/sample/persistence/StreamExample.scala
	akka-samples/akka-sample-persistence-scala/tutorial/index.html
2014-06-25 15:37:35 +02:00
Konrad 'ktoso' Malawski
242473bae8 =per #15230 deprecate Channel and PersistentChannel
Conflicts:
	akka-persistence/src/main/scala/akka/persistence/Channel.scala
	akka-persistence/src/main/scala/akka/persistence/PersistentChannel.scala
	akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala
2014-06-24 20:37:01 +02:00
Konrad 'ktoso' Malawski
4bb321a83a !per #15230 rename processorId => persistentId
* This is NOT binary compatible, we're in an *experimental* module.
* disabled binary compat checks for package akka.persistence
* Source compatibility is retained, but users should migrate do the new
  method name ASAP.
* Plugin APIs were migrated in a way that allows the old plugins to
  compile agains 2.3.4 without having to change anything. Hopefuly this
  will help authors migrate to 2.3.4 sooner. This is only source level compatible, not binary compatible.
* added deprecation warnings on all processorId methods and provided bridges where possible
* for users, the migration should be painless, they can still override
  the old method, and it'll work. But we encourage them to move to
  persistenceId; All delegation code will have to be removed afterwards ofc.

Conflicts:
	akka-persistence/src/main/scala/akka/persistence/Channel.scala
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/Persistent.scala
	akka-persistence/src/main/scala/akka/persistence/PersistentChannel.scala
	akka-persistence/src/main/scala/akka/persistence/Processor.scala
	akka-persistence/src/main/scala/akka/persistence/Snapshot.scala
	akka-persistence/src/main/scala/akka/persistence/journal/AsyncWriteProxy.scala
	akka-persistence/src/main/scala/akka/persistence/journal/inmem/InmemJournal.scala
	akka-persistence/src/main/scala/akka/persistence/journal/leveldb/LeveldbKey.scala
	akka-persistence/src/main/scala/akka/persistence/snapshot/SnapshotStore.scala
	akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala
	project/AkkaBuild.scala
2014-06-24 17:05:18 +02:00
Marcin Kubala
f4793a399f =act,clu,con,doc,per,rem,sam #15114 append missing parens at Actor.sender() invocations 2014-06-20 23:05:51 +02:00
Konrad 'ktoso' Malawski
a71790bb18 +per #15229 defer for PersistentActor
* Deferred events are not persisted, thus will not participate in replays
  etc. If users want events to be persisted, they can simply use
  `persistAsync` instead.
* This, 3rd, rewrite extends the Persistent hierarchy by a top level
  trait "Resequenceable", which is used to mark every event to be sent
  in sequence back to the PersistentActor. These are split into
  NonPersistentRepr or PersistentRepr, and acted upon accordingly.
* defer is guaranteed to be called, even after persistence failures
* Includes docs updates for java/scala/java8

Resolves #15229
Depends on #15227

Conflicts:
	akka-docs/rst/scala/code/docs/persistence/PersistenceDocSpec.scala
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/Processor.scala
	akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
	project/AkkaBuild.scala
2014-06-10 17:09:24 +02:00
Björn Antonsson
9bcaeff87d +per #13944 Send RecoveryComplete message at end of recovery
Fixes #13944

Conflicts:
	akka-docs/rst/scala/code/docs/persistence/PersistenceDocSpec.scala
	akka-persistence/src/main/scala/akka/persistence/Processor.scala
	project/AkkaBuild.scala
2014-06-10 13:22:10 +02:00
Konrad 'ktoso' Malawski
d51b79c95a !per persistAsync
Breaks binary compatibility because adding new methods to Eventsourced
trait. Since akka-persistence is experimental this is ok, yet
source-level compatibility has been perserved thankfuly :-)

Deprecates:
* Rename of EventsourcedProcessor -> PersistentActor
* Processor -> suggest using PersistentActor
* Migration guide for akka-persistence is separate, as wel'll deprecate in minor versions (its experimental)
* Persistent as well as ConfirmablePersistent - since Processor, their
  main user will be removed soon.

Other changes:
* persistAsync works as expected when mixed with persist
* A counter must be kept for pending stashing invocations
* Uses only 1 shared list buffer for persit / persistAsync
* Includes small benchmark
* Docs also include info about not using Persistent() wrapper
* uses java LinkedList, for best performance of append / head on
  persistInvocations; the get(0) is safe, because these msgs only
  come in response to persistInvocations
* Renamed internal *MessagesSuccess/Failure messages because we kept
  small mistakes seeing the class "with s" and "without s" as the same
* Updated everything that refered to EventsourcedProcessor to
  PersistentActor, including samples

Refs #15227

Conflicts:
	akka-docs/rst/project/migration-guides.rst
	akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
	akka-persistence/src/main/scala/akka/persistence/Persistent.scala
	akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
	project/AkkaBuild.scala
2014-06-10 11:09:12 +02:00
Björn Antonsson
5f3d6029b1 Merge pull request #15376 from akka/wip-13898-failed-SharedLeveldbJournalSpec-master-ban
=per #13898 Make LocalSnapshotStore directory creation more robust (Validation)
2014-06-09 14:06:03 +02:00
Björn Antonsson
6c4f61b405 =per #13898 Make LocalSnapshotStore directory creation more robust 2014-06-09 11:49:26 +02:00
Björn Antonsson
e5a17576cd =per #13962 Close LevelDB snapshots to avoid resource leakage 2014-06-09 11:45:05 +02:00
Björn Antonsson
ad1a4e9c70 Merge pull request #15324 from akka/wip-15131-snapshotstore-directory-check-master-ban
=per #15131 Make LocalSnapshotStore fail if it can't create target directory (Forward Port)
2014-06-02 16:25:22 +02:00
Björn Antonsson
eec1b7ce73 =per #15131 Make LocalSnapshotStore fail if it can't create target directory 2014-06-02 08:40:20 +02:00
Björn Antonsson
2c3c13eddd =per #15212 Avoid half written snapshots in LocalSnapshotStore
Conflicts:
	project/AkkaBuild.scala
2014-05-30 18:20:33 +02:00
Björn Antonsson
80c68af14c =per #15280 Make snapshot header length field deserialize correctly 2014-05-27 16:17:11 +02:00
Martynas Mickevicius
fdcd964165 =pro #15031 separate sbt build file for every module 2014-05-14 10:05:09 +02:00
Konrad 'ktoso' Malawski
684c0279ec =act,tes Initial draft of internal MetricsKit
Note: This is NOT aimed to provide an micro-benchmarking solution.
The goal is to provide data for broad trend analysis. For techniques
that fight the inliner and other specialised techniques, refer to JMH.

+ custom console and graphite reporters
  - had to be custom because it's not possible to add custom metric
    types to the existing reporters
+ initial hdr.Histogram histogram() provider, see
  http://latencyutils.github.io/LatencyUtils/
+ Not using timers provided by Metrics, instead use the above histogram
+ Added average Actor size measurement
+ Measuring the "blocking time" when an actor is created, before we fire
  of the async part of this process; Measures in loop and will fluctuate
  a lot. Times are in `us` -- System.nanoTime should provide good enough
  resolution.
+ Measuring total actor creation time by using
  `KnownOpsInTimespanTimer`, which given a known number of ops, in a
  large amount of time, roughtly estimates time per one operation.
  // Yes, we are aware of the possibility of GC pauses and other horrors
+ All classes are `private[akka]`, we should not encourage people to use
  this yet
+ Counters use Java 8's `LongAdder`, which is metric's private;
  The new trend in Java land will be copy paste-ing this class ;)
+ Metrics are logged to Graphite, so we can long-term analyse these
+ Reporters are configurable using typesafe-config

! I'm not very happy about how I work around Metrics not being too open
  for adding additional custom metrics. Seems like a hack at places.
  I will consider removing the Metrics dependency all together.
  numbers

Example output:

```
-- KnownOpsInTimespanTimer-------------------------------------------
  actor-creation.total.creating-100000-actors.Props|new-EmptyArgsActor|…||-same
               ops = 100000
              time = 1.969 s
             ops/s = 50782.22
               avg = 19.69 μs

-- AveragingGauge---------------------------------------------------
  actor-creation.Props|new-EmptyArgsActor|…||-same.avg-mem-per-actor
                avg = 439.67
```
2014-05-08 14:52:39 +02:00
Patrik Nordwall
e860a94e33 Merge pull request #2119 from akka/wip-3974-sharding-NoSuchElementException-master-patriknw
=3974 per Persist (serialize) actor refs  with transport info (forward port)
2014-04-09 14:04:01 +02:00
Patrik Nordwall
4114947a73 =per #3957 Always reject external Persistent in EventsourcedProcessor
(cherry picked from commit 229578b559b302f0873e16385ba28ab3dabd9035)
2014-04-08 11:46:09 +02:00
Björn Antonsson
6dfe51d71a +per #3927 Enable EventsourcedProcessor to handle ConfirmablePersistent
(cherry picked from commit 6db2a2838a142798a97889486712bfd0f9f5052e)
2014-04-08 11:45:46 +02:00
Patrik Nordwall
e4b2af3783 =3974 per Persist (serialize) actor refs with transport info
* The reason for the problem with NoSuchElementException in ClusterSharding was
  that actor references were not serialized with full address information. In
  certain fail over scenarios the references could not be resolved and therefore
  the ShardRegionTerminated did not match corresponding ShardRegionRegistered.
* Wrap serialization with transport information from defaultAddress

(cherry picked from commit 3e73ae5925cf1293a9a5d61e48919b1708e84df2)
2014-04-07 14:08:04 +02:00
Patrik Nordwall
d7757b90f6 Merge pull request #2099 from akka/wip-3933-persistent-channel-patriknw
=per #3933 Correction of seq number logic for persistent channel
2014-03-25 13:40:37 +01:00
Patrik Nordwall
c7e157121a =per #3933 Correction of seq number logic for persistent channel
* Problem when using PersistentChannel from Processor
* When the seq numbers of the sending processor and the seq numbers
  of the PersistentChannel was out of sync the PersistentChannel
  did not de-duplicate confirmed deliveres that were resent by
  the processor.
* There is a hand-off in the RequestWriter that confirms the
  Processor seq number, and therefore the seq number of the
  RequestWriter must be used in the ConfirmablePersistent from
  the RequestReader
* More tests, covering this scenario
2014-03-24 13:10:35 +01:00
Patrik Nordwall
8ebc413643 +con #3937 Start ShardCoordinator again after PersistenceFailure
* Add supervisor level that will start the ShardCoordinator again after
  a configurable backoff duration
* Make the timeout of SharedLeveldbJournal configurable
* Include cause of PersistenceFailure in message of ActorKilledException
2014-03-23 20:14:19 +01:00
Björn Antonsson
723c931d16 +act,sam,doc #3940 Added receive setter for Java Lambda actors
* Added a setter for Java lambda actors to "hide" the not so nice looking type signature of the "receive" method.
* Updated docs to reflect the changes.
* Converted samples to use the new setter.
2014-03-22 10:53:54 +01:00
Björn Antonsson
26c493ea4a =per #3915 Make become work during recovery for EventsourcedProcessor et.c. 2014-03-22 00:47:03 +01:00
dario.rexin
2cbad298d6 =all #3858 Make case classes final 2014-03-07 13:20:01 +01:00
Roland Kuhn
8a0a6d9e13 +per #3906 use AbstractActor for Java8 Persistence
- also rename and link doc chapter
2014-03-04 16:15:13 +01:00
Nabeel Ali Memon
a0a541eda7 +per #3906 add Java8 support for Persistence
- Provided new interfaces for akka-persistence to be usable directly
  through ReceiveBuilder/PartialFunction. Added a sample java project to
  showcase the usage of these API's with akka-persistence.
- Fixed a minor comment block in javadoc code snippet.
- Renamed java event persistor and fixed a documentation typo.
- Put back java event persistence methods in
  UntypedEventsourcedProcessor and copied them into
  AbstractEventsourcedProcessor for the sake of clarity in javadocs.
  Also corrected some doc punctuations.
- Documentation for akka-persistence java 8 lambda expressions support.
- Moved code examples referred from within lambda-persistence.rst to
  java8 compatible sample project.
- Removed remaining unwanted java8 compatible source files.
2014-03-04 16:14:57 +01:00
Björn Antonsson
24a5f64fcd Merge pull request #2044 from krasserm/wip-3898-increase-expect-timeout-krasserm
=per #3898 Increase expect timeout for SharedLeveldbJournalSpec
2014-03-04 13:36:34 +01:00
Roland Kuhn
b5eeb08fde +act #3900 make systemActorOf available to Extensions 2014-03-03 12:00:25 +01:00
Martin Krasser
5b87222cea =per #3898 Increase expect timeout for SharedLeveldbJournalSpec 2014-02-28 08:05:03 +01:00
Patrik Nordwall
40f161994b Merge pull request #1991 from krasserm/wip-3862-no-generated-sequence-number-expectation-krasserm
=per #3862 Fix concurrency bug in LevelDB journal
2014-02-13 11:38:21 +01:00
Martin Krasser
5bd7191ef4 =per #3862 Fix concurrency bug in LevelDB journal
- which may generate same numeric ids for different processor/channel ids.
2014-02-10 10:16:54 +01:00
Adam Voss
cce29dfa51 Changes all occurances of Typesafe copyright to extend to 2014. 2014-02-04 21:20:09 -06:00