Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3658

Constraint disappearing from rete network due to alpha node hashing

    XMLWordPrintable

    Details

      Description

      Under very specific conditions, the alpha node hashing in CompositeObjectSinkAdapter can "drop" viable sinks from the RETE network. Specifically, if two alpha nodes represent the same constraint, the hashing will view them as identical even if the outbound sinks from these nodes differ.

      Using ReteooVisitor from the Drools Eclipse plugin as inspiration, I wrote some code to walk my knowledge base from a particular ObjectTypeNode and describe each node along the way. The results are below:

      [ObjectTypeNode(56)::EntryPoint::DEFAULT objectType=[ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup] expiration=-1ms ]
      X [AlphaNode(219) constraint=roleType == "GATEWAY"] (hashCode -578253791, index 1)
         [JoinNode(220) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [ AccumulateNode(221) ]
           [RuleTerminalNode(222): rule=Compute mapred_submit_replication for MR2 Service]
        [AlphaNode(214) constraint=roleType == "GATEWAY"] (hashCode -578253791, index 1)
         [JoinNode(215) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [ AccumulateNode(216) ]
           [RuleTerminalNode(217): rule=Compute mapred_submit_replication for MapReduce Service]
      X [AlphaNode(57) constraint=roleType == HdfsServiceHandler.RoleNames.NAMENODE.name()]
         [JoinNode(58) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [RuleTerminalNode(59): rule=Compute dfs_namenode_handler_count for an NN role config group]
      X [AlphaNode(194) constraint=roleType == MapReduceServiceHandler.RoleNames.TASKTRACKER.name()]
         [JoinNode(195) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [ExistsNode(197) - [ClassObjectType class=com.cloudera.cmf.model.DbService]]
           [RuleTerminalNode(198): rule=Configure MapReduce TT instrumentation with MGMT]
          [NotNode(199) - [ClassObjectType class=com.cloudera.cmf.model.DbService]]
           [RuleTerminalNode(200): rule=Configure MapReduce TT instrumentation without MGMT]
      X [AlphaNode(210) constraint=roleType == MapReduceServiceHandler.RoleNames.JOBTRACKER.name()]
         [JoinNode(211) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [RuleTerminalNode(212): rule=Compute mapred_job_tracker_handler_count for MapReduce Service]
      X [AlphaNode(62) constraint=roleType == HueServiceHandler.RoleNames.BEESWAX_SERVER.name()]
         [JoinNode(63) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
          [RuleTerminalNode(64): rule=Assign Beeswax Warehouse dir]
      X [JoinNode(235) - [ClassObjectType class=com.cloudera.cmf.model.DbRoleConfigGroup]]
         [QueryTerminalNode(236): query=FIND_ALL_ROLE_CONFIG_GROUPS]
      

      Every node that made it into the adapter's hashedSinkMap, hashableSinks, or otherSinks is marked with an 'X'. Note that alpha node 214 is missing. It was in hashedSinkMap, but was evicted when alpha node 219 was added, because 219 hashes to the same key. Without alpha node 214, the rest of a rule underneath it becomes orphaned and never fires.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mfusco Mario Fusco
              Reporter:
              hltbdivl Adar Dembo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: