rereadnolock causes non-forward-only query to read first table twice - Forum - OpenEdge Development - Progress Community

rereadnolock causes non-forward-only query to read first table twice

 Forum

rereadnolock causes non-forward-only query to read first table twice

  • Following sample demonstrates the issue.

    In a session with -rereadnolock the number of records read from the first table is double the number of records available in the table.

    find _file where _file._file-name = "customer" no-lock.
    find _tablestat where _file._file-number = _tablestat._tablestat-id no-lock.

    def var qh as handle.
    def var count as int.
    def var startread as int.

    startread = _tablestat._tablestat-read.
    create query qh .
    qh:forward-only = false.
    qh:set-buffers(buffer customer:handle, buffer salesrep:handle).
    qh:query-prepare("for each customer, first salesrep of customer").
    qh:query-open().
    do while qh:get-next(): count = count + 1. end.
    qh:query-close().
    find _tablestat where _file._file-number = _tablestat._tablestat-id no-lock.
    disp count startread _tablestat._tablestat-read _tablestat._tablestat-read - startread label "diff" with no-box side-labels.

  • Off-topic note:

    > find _tablestat where _file._file-number = _tablestat._tablestat-id no-lock.

    The code works as expected with any value of -basetable only since version 11.7 (mayby 11.7 something).

    DISPLAY PROVERSION(1) "Wait...".
    FOR FIRST _StatBase EXCLUSIVE-LOCK:
      ASSIGN _TableBase = 2.
    END.
    
    FIND FIRST _TableStat NO-LOCK WHERE _TableStat-Id EQ 2.
    DISPLAY _TableStat-Id.

    The code above will show "3" in versions before 11.7 and "2" in version 11.7.

    DISPLAY PROVERSION(1) "Wait...".
    FOR FIRST _DbParams EXCLUSIVE-LOCK WHERE _DbParams-Name EQ "-basetable":U:
      ASSIGN  _DbParams._DbParams-Value = "2":U.
    END.
    
    FIND FIRST _TableStat NO-LOCK WHERE _TableStat-Id EQ 2.
    DISPLAY _TableStat-Id.

    This code shows "2" in version 12.0.

  • > The code works as expected with any value of -basetable only since version 11.7 (mayby 11.7 something).

    This was fixed in 11.7.0.

    pugchallenge.org/.../New_VSTs.pdf

    "OE 11.7.0 fixed VSI for base != 1"