0

We are facing a strange issue on Sitecore 8.1 Update-1 environment. While rebuilding Reporting database, we always find below error.

10528 09:55:18 ERROR [Experience Analytics]: SegmentProcessor failed to process interaction 'b92e3a39-d037-4926-82cd-208f350a6e07' segment '7b0bc1b1-3c16-44b4-a4f0-bd12b647d157' - System.InvalidOperationException: Definition not found: itemId: '{60AD67C5-D927-4316-9B03-EDCCE11DEBA6}' culture: 'Invariant Language (Invariant Country)' type: 'Sitecore.Marketing.Definitions.Goals.IGoalDefinition'
   at Sitecore.ExperienceAnalytics.Core.Repositories.ClassificationResolver`1.GetClassificationUris(ID itemId)
   at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.ByGoalFacetGroup.Filter(PageEventData pageEvent)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.PageEventDimensionBase.GetDimensionKeys(IVisitAggregationContext context)
   at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.PageEventDimensionBase.<GetData>d__2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at Sitecore.ExperienceAnalytics.Aggregation.Pipeline.SegmentProcessor.ProcessSegments(AggregationPipelineArgs args, IEnumerable`1 segments)

Mostly this happens when we have the item in master DB, and it's not found in the reporting database. But it's not the case here.

  • The item {60AD67C5-D927-4316-9B03-EDCCE11DEBA6} does not exist in Master/Web DB.
  • We used a new Mongo DB database for Analytics
  • We used clean Reporting databases.

How can I ignore processing this Goal or other marketing definitions (Those might be created earlier and then deleted from database).

Note: If I create a Goal with same ID, it works, and jumps for throwing errors for other deleted Goals

1

The reason this is failing is that of the obvious indication that the GOAL has been deleted from Sitecore. However, when a goal is removed from Sitecore Mongo still contains the Page Events which track back to the Goal ID that doesn't exist, thereby failing the Segment Processor.

This might be expected behavior, as the Goal is no longer in Sitecore. To xDB/Mongo, Goals are stored as Page Events. Because it is in Mongo, there's no way to tell Sitecore NOT to process it.

You could manually delete the Page Events in Mongo DB and rebuild reporting database, but that is generally not advised.

Alternatively, you could override the ProcessSegments() processor, and adjust the exception logic to fail gracefully and log, instead of throwing an error up the stack.

public void ProcessSegments(AggregationPipelineArgs args, IEnumerable<IAggregationSegment> segments)
{
  VisitData visit = args.Context.Visit;
  Hash32 siteNameId = AggregationProcessor.UpdateSiteNamesDimension(args);
  DateTime date = new DateTimeDayPrecisionStrategy().Translate(DateUtil.ToServerTime(visit.StartDateTime).SpecifyKind(DateTimeKind.Local));
  IVisitAggregationContext context = args.Context;
  foreach (IAggregationSegment segment in segments)
  {
    try
    {
      lock (segment)
      {
        foreach (DimensionData item_0 in segment.GetData(context).Where<DimensionData>((Func<DimensionData, bool>) (data =>
        {
          if (data != null)
            return !data.DimensionKey.IsNullOrEmpty();
          return false;
        })))
        {
          Hash64 local_8 = args.GetDimension<DimensionKeys>().Add(item_0.DimensionKey);
          Hash64 local_10 = args.GetDimension<SegmentRecords>().Add(segment.SegmentId, date, siteNameId, local_8);
          SegmentMetricsKey local_11 = new SegmentMetricsKey()
          {
            SegmentRecordId = local_10,
            ContactTransitionType = ContactStateResolver.Resolve(visit)
          };
          SegmentMetrics local_12 = args.GetFact<SegmentMetrics>();
          if (item_0.MetricsValue != null)
          {
            local_12.Emit(local_11, item_0.MetricsValue);
            AggregationContainer.GetLogger().Debug(string.Format("SegmentProcessor emitted metrics. VisitDate={0}, SegmentRecordId={1},ContactTransitionType={2},DimensionKey={3} Metrics:Bounces={4},Conversions={5},Count={6},PageViews={7},TimeOnSite={8},Value={9},Visits={10}", (object) date, (object) local_11.SegmentRecordId, (object) local_11.ContactTransitionType, (object) local_8, (object) item_0.MetricsValue.Bounces, (object) item_0.MetricsValue.Conversions, (object) item_0.MetricsValue.Count, (object) item_0.MetricsValue.Pageviews, (object) item_0.MetricsValue.TimeOnSite, (object) item_0.MetricsValue.Value, (object) item_0.MetricsValue.Visits));
          }
        }
      }
    }
    catch (Exception ex)
    {
      AggregationContainer.GetLogger().SingleError(string.Format("SegmentProcessor failed to process interaction '{2}' segment '{0}' - {1}", (object) segment.SegmentId, (object) ex, (object) context.Visit.InteractionId), (object) this);
      throw new InvalidOperationException(ex.Message, ex);
    }
  }
}
  • Unfortunately as I mentioned above, the item does not exist in master or web dbs – Yogesh Patel May 31 '17 at 20:08
  • That's why it's failing. It's the REPORTING database, that the dimension exists in. OPen up the reporting database, and do a search for the segment ID. I'll provide a screen shot in my answer. – Pete Navarra May 31 '17 at 20:09
  • Sorry, i used clean reporting db – Yogesh Patel May 31 '17 at 20:10
  • I mean the goal item is not there in master db, will check the segment item – Yogesh Patel May 31 '17 at 20:12
  • Ahh I see what's going on. Very similar to another error I've seen, which is how I answered. I'll update my answer to accomodate. – Pete Navarra May 31 '17 at 20:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.