Repository: incubator-eagle
Updated Branches:
  refs/heads/master 3301c9d68 -> 74c3cbb5b


EAGLE-602: Exception that Spec Version [xxx] of AlertBolt is newer than Stream 
Event Version [null]

Auhtor: Zeng, Bryant
Reviewer: ralphsu

This closes #486


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/74c3cbb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/74c3cbb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/74c3cbb5

Branch: refs/heads/master
Commit: 74c3cbb5b1653974870e805b717987eb75e5113d
Parents: 3301c9d
Author: mizeng <miz...@ebaysf.com>
Authored: Mon Oct 10 17:58:54 2016 +0800
Committer: Ralph, Su <suliang...@gmail.com>
Committed: Thu Oct 13 15:26:19 2016 +0800

----------------------------------------------------------------------
 .../org/apache/eagle/alert/engine/runner/AlertBolt.java  | 11 ++++++-----
 .../engine/serialization/impl/StreamEventSerializer.java |  6 ++++++
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/74c3cbb5/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
index f437d43..fbee580 100755
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
@@ -107,11 +107,12 @@ public class AlertBolt extends AbstractStreamBolt 
implements AlertBoltSpecListen
         try {
             PartitionedEvent pe = 
deserialize(input.getValueByField(AlertConstants.FIELD_0));
             String streamEventVersion = pe.getEvent().getMetaVersion();
-            if (streamEventVersion != null && 
!streamEventVersion.equals(specVersion)) {
-                if (streamEventVersion == null) {
-                    // if stream event version is null, need to initialize it
-                    pe.getEvent().setMetaVersion(specVersion);
-                } else if (specVersion != null && streamEventVersion != null
+
+            if (streamEventVersion == null) {
+                // if stream event version is null, need to initialize it
+                pe.getEvent().setMetaVersion(specVersion);
+            } else if (streamEventVersion != null && 
!streamEventVersion.equals(specVersion)) {
+                if (specVersion != null && streamEventVersion != null
                     && specVersion.contains("spec_version_") && 
streamEventVersion.contains("spec_version_")) {
                     // check if specVersion is older than stream_event_version
                     // Long timestamp_of_specVersion = 
Long.valueOf(specVersion.split("spec_version_")[1]);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/74c3cbb5/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
index d7119db..8ffcb83 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
@@ -89,6 +89,12 @@ public class StreamEventSerializer implements 
Serializer<StreamEvent> {
         String metaVersionStreamId = dataInput.readUTF();
         String streamId = metaVersionStreamId.split("/")[1];
         String metaVersion = metaVersionStreamId.split("/")[0];
+        // sometimes metaVersionStreamId will be "null/id", then metaVersion 
will be "null" rather than null
+        // need to handle it for future use
+        if (metaVersion.equals("null")) {
+            metaVersion = null;
+        }
+
         event.setStreamId(streamId);
         event.setMetaVersion(metaVersion);
 

Reply via email to