Commit Graph
14324 Commits
Author SHA1 Message Date
John Colvin d16c696ecf Add api server to docker compose 2025-08-24 13:46:51 -04:00
John Colvin c371fd8e99 Change api server ports so they don't conflict w/ ds webapp 2025-08-24 13:46:51 -04:00
John Colvin 16fb295a37 build: Resolve app data dir and shared mem prefix at runtime
We really can't define them at compile time anymore as we build multiple
exes that depend on libspark in the same dir (e.g., spark api server,
pubsub, ds-publisher, webapp, etc.). That means one libspark.so (or dll)
must serve all exes. We should compile a consistent libspark to mitigate
the risk of running an exe with the wrong version (of libspark). For
example, running pubsub with a libspark configured for spark api server,
leftover from an earlier build.
2025-08-24 13:46:51 -04:00
John Colvin bb157c768c Don't log "initializing spark config" if it has already been initialized 2025-08-24 13:46:51 -04:00
John Colvin 8c9ac51bb6 vscode: Add debug cfg for spark api server 2025-08-24 13:46:51 -04:00
John Colvin 39d04285d0 Use dependency injection in spark api server 2025-08-24 13:46:51 -04:00
John Colvin 41db558841 Add SparkLoggerAdapter for Msft ILogger 2025-08-24 13:46:51 -04:00
John Colvin cdebdd5765 fix: Don't assert on exception in BooleanExpression.evaluate
Bugs (fixed):
  * DataStream WebApp Server sometimes crashes when the user enters a
    bad query.
2025-08-24 13:46:50 -04:00
John Colvin bb7a000689 Assert that local ip address is successfully obtained 2025-08-24 13:46:50 -04:00
John Colvin d62816ac0b improvement: Resolve hostnames when comparing ip addrs
So we can to configure pubsub routes by hostname or ipv4 (ipv6 hasn't
been tested yet...so we should assume it doesn't work).
2025-08-24 13:46:50 -04:00
John Colvin 964ec5b565 Assert TcpConnection endpoint matches expected 2025-08-24 13:46:50 -04:00
John Colvin 46247b6439 Catch exceptions on AsyncTCPConnector_AsyncWrapper background thread
Since it spawns a new thread on each attempt, uncaught exceptions were previously undetected,
and caused silent failures down the pipe. This should make it easier to track such bugs down.
2025-08-24 13:46:50 -04:00
John Colvin 10e862074c fix: Format PubSubRoute as json in log msgs
It was previously using the default ToString, which simply returns the type name
2025-08-24 13:46:50 -04:00
John Colvin 9ce0bd1e35 build: Upgrade packages (deps) in DataStreamTests 2025-08-24 13:46:50 -04:00
John Colvin 6d93cf856f cleanup: Remove unused ViewStreamDatabase config 2025-08-24 13:46:50 -04:00
John Colvin fd68164eef vscode: Add PubSubServer debug cfg to skip build 2025-08-24 13:46:50 -04:00
John Colvin 863efdd53f Remove reference to spark protobuf Config in ViewStream
We can't read spark protobuf Config until it has been initialized,
and since ViewStream doesn't have the configServer param handy it
isn't able to initialize config if necessary. In that case, it would simply
block until config was initialized by someone else. Such a risk doesn't
seem justified for this particular configuration dependency
(DataStreamConfig.UseUncopiedNewRowsInFire). For now, its hardcoded to false.
2025-08-24 13:46:50 -04:00
John Colvin 3d94eabab7 refactor: Run RemoteQueryManager as an IHostedService
This paradigm more accurately represents the RemoteQueryManager as a
Service that can be started/stopped.
2025-08-24 13:46:50 -04:00
John Colvin 450ef9985a fix: Ensure spark config init and login are only performed once
As a static function that could be called from anywhere in the code
(directly or indirectly), 'Configuration.Initialize' was vulnerable to
race bugs. The "Configuration.get<T>()" method, whose calls are
ubiquitous in our code, would initialize config if it hadn't been done
so already. Without a reference to the configServer param, this param
would effectively be ignored/overridden with null.

It's important that login only be performed once, for obvious reasons
(our exes that connect to sparkd are generally designed to process data
for a single user). Furthermore, not every routine that requires a
successful login has a reference to the credentials needed to do it. To
address this, we now pass the ISparkdLoginService singleton to these
routines so they can wait until the singular login task has completed
before they begin.
2025-08-24 13:46:50 -04:00
John Colvin 0bf7e209a0 Assert ViewStreamDatabase.instance is only created once
The instance must be initialized via ViewStreamDatabase.SetGlobalInstance
2025-08-24 13:46:50 -04:00
John Colvin b5c666c505 cleanup: Remove unused code from ViewStreamDatabase 2025-08-24 13:46:49 -04:00
John Colvin 198cda76a8 fix: Define BoooleanConstant before StringConstant
Otherwise the former masks the latter and prevents it from matching
2025-08-24 13:46:49 -04:00
John Colvin dc17774e07 cleanup: Remove unnecessary deps from csprojs 2025-08-24 13:46:49 -04:00
John Colvin c9c33045f4 fix: Catch exception when creating TcpClient 2025-08-24 13:46:49 -04:00
John Colvin e36b3bf115 fix: Make SystemSubscriptionMapPublisher threadsafe
The PubSubState.onTagMapChanged event may not be invoked on
the same thread as doWork.
2025-08-24 13:46:49 -04:00
John Colvin a6383c08a4 fix: Add a few null checks
* TimeBasedFilter
* TableAccumulator2
* NonIncGroupByStream
2025-08-24 13:46:49 -04:00
John Colvin ee651061b9 Reduce task wait/timeout code in AsyncTCPConnector 2025-08-24 13:46:49 -04:00
John Colvin 2a497b460d fix build warnings: Make props nullable strings in SharedStreamConfig 2025-08-24 13:46:49 -04:00
John Colvin ac5edfb0ce Assert that System publishers 'doWork' is always called on same thread 2025-08-24 13:46:49 -04:00
John Colvin 54cf46e926 deploy: Add pubsub and md-publisher services to compose.yaml 2025-08-24 13:46:49 -04:00
John Colvin 116778a0cc refactor: Model config profiles after dotnet appsettings
Namely, in DataStreamPublisher and PubSubServer. This is part of a
broader paradigm shift towards dotnet factory pattern.

https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines

* Rename Configurations/<name>.json -> appsettings.<name>.json
* Move reusable startup code into new Bts.Extensions.Hosting proj
2025-08-24 13:46:49 -04:00
John Colvin f7b835997e Add ErrorChanged event to propagate DataStream exceptions 2025-08-24 13:46:49 -04:00
John Colvin c920c6f3a9 fix build: Fix Spark build after making config init async 2025-08-24 13:46:49 -04:00
John Colvin 36de4d1578 refactor: Tweak SparkCoreServices to synchronize Configuration.init globally 2025-08-24 13:46:49 -04:00
John Colvin 0571cb40a0 refactor: Change Configuration.initialize to be async 2025-08-24 13:46:48 -04:00
John Colvin 1ca6acdd23 vscode: Add 'isSparkApiEnabled' input to launch.json 2025-08-24 13:46:48 -04:00
John Colvin f4f3c881db Remove unused PubSubConfig props 2025-08-24 13:46:48 -04:00
John Colvin 36e150f6c7 Capture OperationCanceledException (instead of TaskCanceledException)
The former is the base class for the latter, so this will widen the umbrella to catch a few corner cases
that would otherwise been handled by the generic "Exception" catch block. One corner case I know
of is when an op is canceled via "CancellationToken.ThrowIfCancellationRequested". In that case,
an OperationCanceledException is thrown (not a TaskCanceledException).

https://stackoverflow.com/questions/34359129/operationcanceledexception-vs-taskcanceledexception-when-task-is-canceled
2025-08-24 13:46:48 -04:00
John Colvin f98b435e0b Fix dsqa config json 2025-08-24 13:46:48 -04:00
John Colvin dce4c5f543 fix: Always call 'handle_internal_pubs' in PubSubMessageReactor main loop 2025-08-24 13:46:48 -04:00
John Colvin d4d696e135 Fix mismatched types in PubSubServerTagStatsStream schema 2025-08-24 13:46:48 -04:00
John Colvin bb818d9dcc Add DataStreamPublisher service modules designed for Dependency Injection
* Change DataStreamPublisher json fields to match cs class property names verbatim
* Rename Publishers -> PublisherNodes in DataStreamPublisherConfig
2025-08-24 13:46:48 -04:00
John Colvin 14e838de6a refactor: Decouple ViewPublisher from IPubTableBroker impl 2025-08-24 13:46:48 -04:00
John Colvin 6fe35e2692 Add PubSub service modules designed for Dependency Injection
* Get rid of JsonPropertyName attributes in PubSubConfig
  - The Dependency Injection framework (based around dotnet ApplicationBuilder)
    does not support this attribute, and maps property names verbatim to json fields.

* Change PubSubServer json fields to match cs class property names verbatim
2025-08-24 13:46:48 -04:00
John Colvin 08f9784ed0 refactor: Decouple RemoteQueryManager from IManagedSubscriber, IPubTableBroker impl 2025-08-24 13:46:48 -04:00
John Colvin bde4ee6308 refactor: Decouple ManagedSubscriber from ISubscriberCore impl 2025-08-24 13:46:48 -04:00
John Colvin 03116a2973 refactor: Only support 1 tag type in IPubSubServerTagHandler 2025-08-24 13:46:48 -04:00
John Colvin d0d6d587d7 refactor: Decouple PubTableBroker from IPublisherCore impl
Reference interface rather than the PublisherCore impl.
2025-08-24 13:46:48 -04:00
John Colvin 765e45d95a fix: Dispose market data sub in various md streams 2025-08-24 13:46:48 -04:00
John Colvin cd833ceb36 cleanup: Remove unused pubsub tag handler code
* Removed 'IPubSubServerTagHandler.register'
  - All implementations of this function were empty
* Removed 'IPubSubServerTagHandler.supportedTagTypes'
  - This property wasn't referenced anywhere
* Remove IWorker inheritance from IPubSubServerTagHandler
  - No reason these interfaces have to be tied together
2025-08-24 13:46:47 -04:00