Breakpoints and Exceptions

The breakpoint function pauses Event Stream Processor if there is a problem with the data model. A breakpoint stops Event Stream Processor and allows the user to troubleshoot the problem.

There are two options for pausing the system: sending an explicit pause command or setting a breakpoint on a stream or window (this includes local streams). You can set breakpoints on a stream's input or output; there is no limit to the number of breakpoints you can add. When a tuple hits a breakpoint, the execution is paused.

You can set specific conditions on a stream or window breakpoint. For example, you can place a filter on a breakpoint so only certain records trigger the pause. You can also set a time condition, which allows the user to trigger the breakpoint after a specified number of records.

There are two kinds of breakpoints for streams:

Unconditional Breakpoints and Exceptions

A simple breakpoint is unconditional: once the stream is in the right location, the breakpoint is triggered and the Event Stream Processor is paused. You can trigger more than one breakpoint simultaneously. Multiple breakpoints can be defined in the exact same location. The platform can tell one breakpoint from another by the unique ID assigned when the breakpoint is created. If you create two breakpoints that are the same, Event Stream Processor gives each one a separate ID, allowing both breakpoints to be triggered at the same time.

Once a breakpoint is created, you can enable it, disable it, or alter some of its information. The breakpoint cannot be moved to another location or have its conditional expression changed. To make major changes, you must delete the breakpoint and create a new one.

You may pause the platform at any record. For example, if a bug surfaces on the 1000th record passing though a stream, you can let 999 records pass, then pause and single-step from that point. To do this, configure a breakpoint to trigger on every nth row. If you restart the platform, the breakpoint triggers on the 2000th row next. In bp list, the field enabledEvery shows the breakpoint number as N, and leftToTrigger shows how many records remain to be seen before the breakpoint is triggered. Every time the breakpoint is triggered, leftToTrigger is reset to the original value of enabledEvery. By default, when you create a breakpoint, enabledEvery is set to 1, to trigger on each row. It can be changed with the esp_client command bp every.

Users can disable a breakpoint temporarily by configuring the breakpoint to trigger on every 0th record or by using the bp on command, which triggers the breakpoint on each record.

Conditional Breakpoints and Exceptions

Use conditional breakpoints to see a record with certain contents pass through a stream.

You can apply Conditional breakpoints on Event Stream Processor by specifying a filter expression for a breakpoint. The filter expression is evaluated first and if it results in a false (0 or NULL) value, the breakpoint is skipped. The breakpoint is triggered only if the expression results in a true value (or its leftToTrigger count is reduced).

The filter expression is standard in SPLASH. It uses the data from two pre-defined record variables: currow and oldrow. The variable currow contains the current record; oldrow is defined only for the breakpoints on input. For INSERT and a plain UPDATE the value of oldrow is NULL. For UPDATE_ BLOCK oldrow contains the second record of the block, the old data that is being replaced. For DELETE and SAFEDELETE oldrow contains the same data as currow. A particular field can be accessed using the usual currow.field syntax. You can obtain the row operation code using getOpcode(currow) .

The row definition that provides these predefined variables changes with different types of breakpoints.

For a breakpoint on output, the breakpoint is defined on the Row Definition. The expression is evaluated on the output rows produced during the preceding COMPUTE. Since multiple rows can be produced, the expression is evaluated on each. If no rows are produced, the expression is evaluated once with currow set to NULL. In this case, oldrow is not available because the UPDATE_ BLOCK is not produced on output of COMPUTE.

For a breakpoint on input from a specific stream, the breakpoint is defined on the Row Definition of that input stream. The expression is evaluated on the record or update block that is about to be computed. Filter expressions are not permitted for this kind of breakpoint.

A source stream receives data from outside of the platform instead of other streams. To add a conditional breakpoint on the input of a source stream, use the source stream's own name for the input stream with bp add {filterInput} {filterInput}.