ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RCVJRNA re-read journal entries when attach new receiver

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RCVJRNA re-read journal entries when attach new receiver

    Dear all,

    We use an IFS Monitor to trigger programs when a file is added to an IFS folder. This works Ok, when a file is placed on the IFS, the processing program is triggered instantly. But once in a while it took longer sometimes up to 20 minutes. In the job-log we found on the moment this happens the following message ?638316 entries received from journal QAUDJRN in QSYS.? (CPC7061) at the moment of the delay.
    When we did some more investigation, we found that this occurred always exactly at the time a new journal receiver was attached to journal QAUDJRN.

    The CL command we use to receive the journal entries is

    RCVJRNE JRN(QAUDJRN) EXITPGM(GIFS20) +
    RCVRNG(*CURCHAIN) FROMENTLRG(&SEQNBRA) +
    JRNCDE((T)) ENTTYP(CO) ENTFMT(*TYPE4) +
    DELAY(*NEXTENT 60)

    We only receive the entry type CO. At this moment we keep about one month history in the audit journal, and when we count all CO-entries in all receivers, and the total number of CO entries in all receivers is the same as the number of entries in the message.
    So it looks like, when a new receiver is attached, the RCVJRNE read all entries again, although the exit program is not called. My questions are
    1. Why are all entries (re-)read, when a receiver is changed?
    2. How can we avoid this?


    Thanks......

  • #2
    Re: RCVJRNA re-read journal entries when attach new receiver

    You are using *CURCHAIN which will search all of the receivers for the entries. Suggest you look at managing the receiver name and doing a specific receiver request. If you retrieve a PR entry is gives you the newly attached receiver name. Using *CURRENT could miss some entries as it changes the receiver. You also need to update the sequence number with the entry last read..

    Chris...

    Comment


    • #3
      Re: RCVJRNA re-read journal entries when attach new receiver

      You don't show enough code, so we can only guess. It could also help if you showed enough journal attributes for us to know how many receivers can be expected in the current chain when the command starts and perhaps an estimate of how many entries would be in each receiver.

      Since you are specifying the DELAY() parameter, I strongly suggest that you read its help-text and pay extra attention to each of its various Note: sections.

      I don't have a useful test I can set up quickly, but I'd agree with Chris. You specify FROMENTLRG(), so I'd expect the command to run through entries until it finds the first sequence number that satisfies the condition. It counts and reports entries without needing to pass them to the exit program.
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: RCVJRNA re-read journal entries when attach new receiver

        Thanks both for your answer


        Indeed we use the *CURCHAIN to make sure we do not miss entries. In our exit program we keep track on the journal sequence number last processed. When we re-start the monitor, what is happening every night, this number is placed in the field &SEQNBRA. This works Ok. The problem is later in the process, at the moment some other process is changing the journal receiver. At that moment it looks like that within the RCVJRNE command something is triggered to read all entries from all journal receivers. This cost time.

        I have debugged my programs, and this confirmed me that the value &SEQNBRA was correct. It also confirmed me that the exit program during such an occasion was only triggered for the new entries. So why does the RCVJRNE starts reading all entries in the receivers?


        Bert

        Comment


        • #5
          Re: RCVJRNA re-read journal entries when attach new receiver

          Thanks both for your answer


          Indeed we use the *CURCHAIN to make sure we do not miss entries. In our exit program we keep track on the journal sequence number last processed. When we re-start the monitor, what is happening every night, this number is placed in the field &SEQNBRA. This works Ok. The problem is later in the process, at the moment some other process is changing the journal receiver. At that moment it looks like that within the RCVJRNE command something is triggered to read all entries from all journal receivers. This cost time.

          I have debugged my programs, and this confirmed me that the value &SEQNBRA was correct. It also confirmed me that the exit program during such an occasion was only triggered for the new entries. So why does the RCVJRNE starts reading all entries in the receivers?

          Comment


          • #6
            Re: RCVJRNA re-read journal entries when attach new receiver

            A journal receiver is sequential. It isn't indexed. Maintaining receiver indexes would add overhead that needs to be minimized. Finding a sequence number in a receiver is practically the same as finding a value in a sequential database file. You start at the beginning and read each item, comparing against the desired value. When you find a match (or the first higher), that's when you drop into actual item processing.

            By using *CURCHAIN, your process defines the starting point. You could potentially bypass millions of entries by starting at the needed receiver. In addition to tracking the sequence number, you'd also need to track the receivers you previously processed. Next time the job runs, you'd name the starting receiver instead of specifying *CURCHAIN.
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              Re: RCVJRNA re-read journal entries when attach new receiver

              I would suggest you react to a J PR or J NR entry, then store the new receiver name and only retrieve entries from that receiver. That way you are not going to need *CURCHAIN as you will always only work on a single receiver. The way you are doing it is causing the OS to rebuild the entire index over all of the receivers which is why that sudden hit occurs (it cannot be sure the sequence number you have passed in is in the new receiver). If you are processing by sequence number and *CURCHAIN you could have other problems such as a reset of the sequence number so using the journal receiver information and the sequence number will give you more control and be a lot safer. We went through all of this when we developed our High Availability products (RAP & HA4i) so I understand some of the issues.

              Chris...

              Comment


              • #8
                Re: RCVJRNA re-read journal entries when attach new receiver

                Hi guys,

                Thanks for your answers,

                Chris, your story makes sense, at this moment we already have created a "work around". We change the receiver just once a day in the middle of the night. But nevertheless I wanted to understand what was happening. When there is some time we will try the suggestion of Chris.

                Bert

                Comment

                Working...
                X