Skip to content

Update pub function to properly filter subscriptions - #391

Merged
pkerrAqua merged 7 commits into
masterfrom
subfilter_fix
Dec 6, 2021
Merged

pkerrAqua merged 7 commits into
masterfrom
subfilter_fix

Conversation

@pkerrAqua

@pkerrAqua pkerrAqua commented Nov 15, 2021 •

Copy link
Copy Markdown
Contributor

An issue arose when subscribing to a table via dashboards. Using normal u.q (from kx website), .u.pub would publish changes no problem.

When using torq pubsub.q, .u.pub seemed to be publishing all records of the table being published with the filtered sym list. An example of which is, records for the table called streamSnap were being published with 2500 records at a time. However, the max records that were ever passed into the .u.pub function was 300 (all syms, changes only). Along with raised cpu usage of chrome browser tab to 150%, making the browser unresponsive, it was publishing data not passed into .u.pub.

Therefore pub function within pubsub.q needs updated, so that only filtered data passed into .u.pub is what is being published instead of the entire table.

@pkerrAqua
pkerrAqua requested a review from jonnypress November 15, 2021 16:23
@pkerrAqua pkerrAqua self-assigned this Nov 15, 2021
@pkerrAqua pkerrAqua linked an issue Nov 15, 2021 that may be closed by this pull request

@jonathonmcmurray jonathonmcmurray left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me, I think the tests need a little work still.

Also remember to write a useful description for PRs please (give a little context for what's currently broken & how it's being fixed)

Comment thread code/common/pubsub.q Resolved
Comment thread code/common/pubsub.q Resolved
Comment thread code/common/pubsub.q Resolved
Comment thread tests/stp/pubsub/pubsub.csv Resolved
Comment thread tests/stp/pubsub/pubsub.csv Resolved
Comment thread tests/stp/pubsub/pubsub.csv Resolved
Comment thread tests/stp/pubsub/pubsub.csv Resolved
Comment thread tests/stp/pubsub/pubsub.csv Resolved

@jonnypress jonnypress left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this good to go? Changes look good to me

@jonnypress

Copy link
Copy Markdown
Contributor

If this is good to go can we get it merged and closed?

@pkerrAqua
pkerrAqua merged commit 54559b1 into master Dec 6, 2021
@pkerrAqua
pkerrAqua deleted the subfilter_fix branch December 6, 2021 11:18
jaen15marcos added a commit to jaen15marcos/TorQ that referenced this pull request Nov 13, 2026
Running the tickerplant suites on several engines turned up failures
that are not engine differences at all: they fail on kdb+ on master.
Three are bugs in the segmented tickerplant, and the rest are tests that
fell behind the code. All of it is in tests/stp or the code those tests
exercise.

Tickerplant bugs

- End of day and end of period called .stpps.pubclear[.stplg.t]. That
  list is every table in the process, including logmsg, but pubclear
  resets each table from the publish schemas, which since DataIntellectTech#638 have no
  entry for logmsg. A dictionary of tables returns an empty copy of its
  first table for a key it doesn't have, so at every roll logmsg was
  quietly replaced by an empty table with another table's columns. The
  three calls now pass .stpps.t, as the batch code already does.
- The exit handler closed .stpps.t, the published tables, although a
  log is opened for every table. On a clean shutdown the logmsg log
  stayed open and its row in the meta table kept a null end time. It
  now closes .stplg.logtabs, the same list end of day uses.
- A chained tickerplant that is not creating logs replaces the
  loghandles view with a dictionary of no-ops (DataIntellectTech#368). If it was then
  switched to create its own logs, the logs were opened but nothing was
  written to them, because loghandles was still that dictionary. The
  view is now restored when a chained tickerplant opens logs.

Tests that were wrong

- stp/pubsub: seven rows from DataIntellectTech#391 call rdbHandle, which the suite
  never defines. They now use the suite's own publisher, with one row
  that gives it trades to filter.
- stp/eod and three chained suites still called .stplg.stpeod, which
  DataIntellectTech#523 folded into .stplg.endofday.
- stp/eod, stp/periodend, stp/chainedperiodend sized the meta table by
  the publish list, which is one short since DataIntellectTech#638.
- stp/tz upserted six values into the time zone table, which has had
  four columns since the tzinfo file was regenerated in DataIntellectTech#603.
- stp/custommode expects quote_iex, trade_iex and heartbeat. The
  Starter Pack dropped the _iex tables, so the suite now has its own
  schema file. It also moved the logs with setenv on KDBTPLOG, which
  the tickerplant has read once at start-up since DataIntellectTech#638; it now sets
  .stplg.kdbtplog. Its bad update is a one-item list and its file count
  is compared by value, so the same rows also hold on Korze and L.
- Seven run.sh passed -results where runtests.q reads -testresults, so
  those suites never wrote a results file; two also left out $write.
- helperfunctions.q: gethandle opened a new handle on every call and
  never closed the old one. A process has a limit on open connections,
  and stp/wdb reopened handles often enough to reach it.

On KDB-X 5.0, master against this branch: stp/pubsub 34/41 to 42/42,
eod 10/15 to 15/15, exit 4/5 to 5/5, periodend 6/8 to 8/8, tz 26/31 to
31/31, custommode 39/47 to 47/47, chainedstp 37/40 to 40/40, and
stp/wdb 73/96 to 96/96.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sym filtered subscription fix

3 participants