|
|
|
@@ -30,7 +30,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Sql;
|
|
|
|
|
public sealed class SqlDriver
|
|
|
|
|
: IDriver, ITagDiscovery, IReadable, ISubscribable, IHostConnectivityProbe, ISkippedTagReporter, IAsyncDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Authored tags this driver could not build into its poll table (Gitea #541).</summary>
|
|
|
|
|
/// <summary>Authored tags this driver could not build into its poll table.</summary>
|
|
|
|
|
private readonly SkippedTagLedger _skippedTags = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@@ -66,7 +66,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The driver-type string this driver registers under — <see cref="DriverTypeNames.Sql"/>, the single
|
|
|
|
|
/// source of truth the deploy pipeline stores in <c>DriverInstance.DriverType</c> and every dispatch
|
|
|
|
|
/// map keys by. Chained off the shared constant (Task 11 wired the factory + probe, so
|
|
|
|
|
/// map keys by. Chained off the shared constant (so
|
|
|
|
|
/// <c>DriverTypeNamesGuardTests</c>' bidirectional-parity check is satisfied).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const string DriverTypeName = DriverTypeNames.Sql;
|
|
|
|
@@ -74,7 +74,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// <summary>Shown for a connection string that names no recognisable server.</summary>
|
|
|
|
|
private const string UnknownEndpoint = "(unknown sql endpoint)";
|
|
|
|
|
|
|
|
|
|
/// <summary>Upper bound on the poll-loop failure backoff — the S7-proven 30 s cap adopted fleet-wide (05/STAB-8).</summary>
|
|
|
|
|
/// <summary>Upper bound on the poll-loop failure backoff — the S7-proven 30 s cap adopted fleet-wide.</summary>
|
|
|
|
|
private static readonly TimeSpan PollBackoffCap = TimeSpan.FromSeconds(30);
|
|
|
|
|
|
|
|
|
|
/// <summary>Connection-string keys that name the server, in the order they are consulted.</summary>
|
|
|
|
@@ -90,7 +90,7 @@ public sealed class SqlDriver
|
|
|
|
|
private SqlDriverOptions _options;
|
|
|
|
|
private readonly string _driverInstanceId;
|
|
|
|
|
/// <summary>Config-derived, so mutable: <see cref="ApplyBinding"/> swaps it with the connection string
|
|
|
|
|
/// and options together on a reinitialize (#516).</summary>
|
|
|
|
|
/// and options together on a reinitialize.</summary>
|
|
|
|
|
private ISqlDialect _dialect;
|
|
|
|
|
private DbProviderFactory _factory;
|
|
|
|
|
|
|
|
|
@@ -159,7 +159,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The exception instance <see cref="ReadAsync"/> has already turned into a health verdict, held only
|
|
|
|
|
/// until <see cref="HandlePollError"/> — which the poll engine calls with that same object — has
|
|
|
|
|
/// consumed it (Driver.Sql-004).
|
|
|
|
|
/// consumed it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// A field rather than a flag on the exception itself: <see cref="Exception.Data"/> is provider-owned
|
|
|
|
@@ -242,7 +242,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// downstream of it (the provider factory, the endpoint description, and the poll reader, which
|
|
|
|
|
/// captures all three). Called from the constructor and again from <see cref="InitializeAsync"/>
|
|
|
|
|
/// when a changed config arrives.
|
|
|
|
|
/// <para><b>All-or-nothing on purpose.</b> The reason Sql was excluded from the first #516 pass is
|
|
|
|
|
/// <para><b>All-or-nothing on purpose.</b> The reason Sql was excluded from the first pass is
|
|
|
|
|
/// that adopting options alone would poll a NEW tag set through the OLD connection and dialect. Doing
|
|
|
|
|
/// it in one method means a future field derived from config gets added here rather than being
|
|
|
|
|
/// forgotten on the reinit path.</para>
|
|
|
|
@@ -320,41 +320,36 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
// ---- IDriver lifecycle ----
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Builds the authored RawPath table and proves the database is reachable.
|
|
|
|
|
/// <para><paramref name="driverConfigJson"/> <b>is</b> re-parsed here when the driver was built by
|
|
|
|
|
/// the factory (Gitea #516). The original comment on this method claimed it was not, on the premise
|
|
|
|
|
/// that "config parsing belongs to the factory, which builds a fresh instance" — that was false when
|
|
|
|
|
/// written, because the host reinitialized the EXISTING child in place and every config edit was
|
|
|
|
|
/// silently discarded while the deployment still sealed green.</para>
|
|
|
|
|
/// <para>The re-parse is <b>all-or-nothing</b> via <see cref="ApplyBinding"/>: options, the
|
|
|
|
|
/// <see cref="ISqlDialect"/> and the resolved connection string are re-derived by one
|
|
|
|
|
/// <c>ParseBinding</c> call and adopted together. That is what makes it safe here — adopting options
|
|
|
|
|
/// alone would poll a NEW tag set through the OLD database, which is why this driver was excluded
|
|
|
|
|
/// from the first #516 pass. It happens BEFORE <c>BuildTagTable</c>, so the tag table and the
|
|
|
|
|
/// connection it is polled over always come from the same revision.</para>
|
|
|
|
|
/// <para>A driver constructed directly (every unit test) gets no rebinder and keeps its
|
|
|
|
|
/// constructor-supplied trio, so <c>"{}"</c>-passing lifecycle tests are unaffected.
|
|
|
|
|
/// <c>DriverSpawnPlanner</c>'s stop + respawn remains the outer guarantee.</para>
|
|
|
|
|
/// <para>The table is built first because it is pure and cannot fail; the liveness check is the only
|
|
|
|
|
/// I/O, and on failure this method records <see cref="DriverState.Faulted"/> <b>and rethrows</b> —
|
|
|
|
|
/// <c>DriverInstanceActor</c> reads a throw as InitializeFailed and lands in Reconnecting with its
|
|
|
|
|
/// retry timer running, which is exactly the recovery a database that is merely down needs.</para>
|
|
|
|
|
/// <para>The liveness check is then followed by the design §8.1 <b>catalog gate</b>
|
|
|
|
|
/// (<see cref="ApplyCatalogGateAsync"/>), which is the second and last piece of I/O. It runs after
|
|
|
|
|
/// liveness because it needs a working connection, and before the driver reports Healthy because the
|
|
|
|
|
/// tag table it publishes must be the validated one — a poll must never see an unvalidated
|
|
|
|
|
/// identifier.</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="driverConfigJson">The driver configuration JSON (unused; see remarks).</param>
|
|
|
|
|
/// <param name="cancellationToken">Cancellation token for the operation.</param>
|
|
|
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
|
|
|
/// <exception cref="InvalidOperationException">The database could not be reached, or its catalog could not be read.</exception>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// Builds the authored RawPath table and proves the database is reachable.
|
|
|
|
|
// driverConfigJson is re-parsed here when the driver was built by
|
|
|
|
|
// the factory. The original comment on this method claimed it was not, on the premise
|
|
|
|
|
// that "config parsing belongs to the factory, which builds a fresh instance" — that was false when
|
|
|
|
|
// written, because the host reinitialized the EXISTING child in place and every config edit was
|
|
|
|
|
// silently discarded while the deployment still sealed green.
|
|
|
|
|
// The re-parse is all-or-nothing via ApplyBinding: options, the
|
|
|
|
|
// ISqlDialect and the resolved connection string are re-derived by one
|
|
|
|
|
// ParseBinding call and adopted together. That is what makes it safe here — adopting options
|
|
|
|
|
// alone would poll a NEW tag set through the OLD database, which is why this driver was excluded
|
|
|
|
|
// from the first pass. It happens BEFORE BuildTagTable, so the tag table and the
|
|
|
|
|
// connection it is polled over always come from the same revision.
|
|
|
|
|
// A driver constructed directly (every unit test) gets no rebinder and keeps its
|
|
|
|
|
// constructor-supplied trio, so "{}"-passing lifecycle tests are unaffected.
|
|
|
|
|
// DriverSpawnPlanner's stop + respawn remains the outer guarantee.
|
|
|
|
|
// The table is built first because it is pure and cannot fail; the liveness check is the only
|
|
|
|
|
// I/O, and on failure this method records DriverState.Faulted and rethrows —
|
|
|
|
|
// DriverInstanceActor reads a throw as InitializeFailed and lands in Reconnecting with its
|
|
|
|
|
// retry timer running, which is exactly the recovery a database that is merely down needs.
|
|
|
|
|
// The liveness check is then followed by the design §8.1 catalog gate
|
|
|
|
|
// (ApplyCatalogGateAsync), which is the second and last piece of I/O. It runs after
|
|
|
|
|
// liveness because it needs a working connection, and before the driver reports Healthy because the
|
|
|
|
|
// tag table it publishes must be the validated one — a poll must never see an unvalidated
|
|
|
|
|
// identifier.
|
|
|
|
|
public async Task InitializeAsync(string driverConfigJson, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
WriteHealth(new DriverHealth(DriverState.Initializing, null, null));
|
|
|
|
|
|
|
|
|
|
// #516: adopt a changed config BEFORE the tag table is built, so the table and the connection it
|
|
|
|
|
// adopt a changed config BEFORE the tag table is built, so the table and the connection it
|
|
|
|
|
// will be polled over come from the same revision. ApplyBinding takes the options, dialect and
|
|
|
|
|
// connection string as one unit; adopting options alone would poll a NEW tag set through the OLD
|
|
|
|
|
// database, which is why this driver was excluded from the first pass. A null rebinder (direct
|
|
|
|
@@ -453,29 +448,23 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
// ---- ITagDiscovery ----
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Exactly one pass: the tag set is the authored one, fixed at Initialize, so re-running discovery
|
|
|
|
|
/// could only produce the same nodes.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// Exactly one pass: the tag set is the authored one, fixed at Initialize, so re-running discovery
|
|
|
|
|
// could only produce the same nodes.
|
|
|
|
|
public DiscoveryRediscoverPolicy RediscoverPolicy => DiscoveryRediscoverPolicy.Once;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// False — <see cref="DiscoverAsync"/> replays authored tags rather than enumerating the backend, so
|
|
|
|
|
/// the universal discovery browser must not treat this driver as browsable. (Live schema browsing is
|
|
|
|
|
/// a separate surface: <c>Driver.Sql.Browser</c>.)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// False — DiscoverAsync replays authored tags rather than enumerating the backend, so
|
|
|
|
|
// the universal discovery browser must not treat this driver as browsable. (Live schema browsing is
|
|
|
|
|
// a separate surface: Driver.Sql.Browser.)
|
|
|
|
|
public bool SupportsOnlineDiscovery => false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Streams the authored tags as read-only variables.
|
|
|
|
|
/// <para>An undeclared tag materialises as <see cref="DriverDataType.String"/> — the same fallback
|
|
|
|
|
/// <see cref="ISqlDialect.MapColumnType"/> uses for an unrecognised column type — because a column's
|
|
|
|
|
/// real type is only known once a poll has returned result-set metadata, which has not happened at
|
|
|
|
|
/// discovery time. Author <c>"type"</c> on a numeric tag.</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="builder">The address-space builder to stream discovered nodes into.</param>
|
|
|
|
|
/// <param name="cancellationToken">Cancellation token for the operation.</param>
|
|
|
|
|
/// <returns>A completed task — discovery is synchronous over the authored table.</returns>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// Streams the authored tags as read-only variables.
|
|
|
|
|
// An undeclared tag materialises as DriverDataType.String — the same fallback
|
|
|
|
|
// ISqlDialect.MapColumnType uses for an unrecognised column type — because a column's
|
|
|
|
|
// real type is only known once a poll has returned result-set metadata, which has not happened at
|
|
|
|
|
// discovery time. Author "type" on a numeric tag.
|
|
|
|
|
public Task DiscoverAsync(IAddressSpaceBuilder builder, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
ArgumentNullException.ThrowIfNull(builder);
|
|
|
|
@@ -513,14 +502,9 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
// ---- IReadable ----
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reads a batch, delegating to <see cref="SqlPollReader"/> and classifying what came back
|
|
|
|
|
/// (<see cref="ObservePollOutcome"/>).
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fullReferences">The RawPaths to read.</param>
|
|
|
|
|
/// <param name="cancellationToken">Cancellation token for the operation.</param>
|
|
|
|
|
/// <returns>One snapshot per reference, at the same index.</returns>
|
|
|
|
|
/// <exception cref="DbException">The database could not be reached — the engine backs off on this.</exception>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// Reads a batch, delegating to SqlPollReader and classifying what came back
|
|
|
|
|
// (ObservePollOutcome).
|
|
|
|
|
public async Task<IReadOnlyList<DataValueSnapshot>> ReadAsync(
|
|
|
|
|
IReadOnlyList<string> fullReferences, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
@@ -550,7 +534,7 @@ public sealed class SqlDriver
|
|
|
|
|
TransitionHostTo(HostState.Stopped);
|
|
|
|
|
// Mark THIS exception object as already classified before it goes back to the poll engine, which
|
|
|
|
|
// routes it to HandlePollError next. The mark is what makes the deferral there exact — see that
|
|
|
|
|
// method for why inferring it from the exception's type was not (Driver.Sql-004).
|
|
|
|
|
// method for why inferring it from the exception's type was not.
|
|
|
|
|
Volatile.Write(ref _classifiedByRead, ex);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
@@ -558,16 +542,11 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
// ---- ISubscribable (polling overlay via the shared engine) ----
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Registers a polled subscription.
|
|
|
|
|
/// <para>A non-positive <paramref name="publishingInterval"/> falls back to the configured
|
|
|
|
|
/// <see cref="SqlDriverOptions.DefaultPollInterval"/>; anything faster than
|
|
|
|
|
/// <see cref="PollGroupEngine.DefaultMinInterval"/> is floored by the engine.</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fullReferences">The RawPaths to poll.</param>
|
|
|
|
|
/// <param name="publishingInterval">The requested publishing interval.</param>
|
|
|
|
|
/// <param name="cancellationToken">Cancellation token for the operation.</param>
|
|
|
|
|
/// <returns>The subscription handle.</returns>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// Registers a polled subscription.
|
|
|
|
|
// A non-positive publishingInterval falls back to the configured
|
|
|
|
|
// SqlDriverOptions.DefaultPollInterval; anything faster than
|
|
|
|
|
// PollGroupEngine.DefaultMinInterval is floored by the engine.
|
|
|
|
|
public Task<ISubscriptionHandle> SubscribeAsync(
|
|
|
|
|
IReadOnlyList<string> fullReferences, TimeSpan publishingInterval, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
@@ -585,12 +564,10 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
// ---- IHostConnectivityProbe ----
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The single logical host this instance dials. There is no background probe loop: the state is a
|
|
|
|
|
/// by-product of the Initialize-time liveness check and of every poll, so the report is always a
|
|
|
|
|
/// statement about traffic that actually happened rather than about a synthetic ping.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A one-element list describing the configured database endpoint.</returns>
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
// The single logical host this instance dials. There is no background probe loop: the state is a
|
|
|
|
|
// by-product of the Initialize-time liveness check and of every poll, so the report is always a
|
|
|
|
|
// statement about traffic that actually happened rather than about a synthetic ping.
|
|
|
|
|
public IReadOnlyList<HostConnectivityStatus> GetHostStatuses()
|
|
|
|
|
{
|
|
|
|
|
lock (_probeLock)
|
|
|
|
@@ -606,7 +583,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// <item>Any snapshot that is <b>evidence the database answered</b>
|
|
|
|
|
/// (<see cref="IsAnswerEvidence"/> — Good, but also an absent row, a NULL cell, an uncoercible
|
|
|
|
|
/// cell) ⇒ <c>LastSuccessfulRead</c> advances and the host is Running, <em>without</em> changing
|
|
|
|
|
/// the health state. That clock is what the comms-loss watchdog reads (Driver.Sql-006).</item>
|
|
|
|
|
/// the health state. That clock is what the comms-loss watchdog reads.</item>
|
|
|
|
|
/// <item>Any <b>connection-class</b> Bad snapshot (<see cref="SqlStatusCodes.BadTimeout"/>) ⇒
|
|
|
|
|
/// Degraded; when nothing at all answered, the host is Stopped.</item>
|
|
|
|
|
/// <item>Any <b>query-failure</b> Bad snapshot (<see cref="SqlStatusCodes.BadCommunicationError"/>)
|
|
|
|
@@ -683,7 +660,7 @@ public sealed class SqlDriver
|
|
|
|
|
// The database answered, just not with a value: an absent row, a NULL cell, a cell that would
|
|
|
|
|
// not coerce. Those are data/authoring facts, so the health STATE is deliberately left exactly
|
|
|
|
|
// as it was — but they are still proof the transport works, and the evidence clock the
|
|
|
|
|
// comms-loss watchdog reads must say so (Driver.Sql-006).
|
|
|
|
|
// comms-loss watchdog reads must say so.
|
|
|
|
|
TouchLastSuccessfulRead();
|
|
|
|
|
TransitionHostTo(HostState.Running);
|
|
|
|
|
return;
|
|
|
|
@@ -701,7 +678,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// True for the status codes that mean "the database did not answer", as opposed to "the data is not
|
|
|
|
|
/// there" or "the query was refused".
|
|
|
|
|
/// <para><see cref="SqlStatusCodes.BadCommunicationError"/> is deliberately <b>not</b> here despite
|
|
|
|
|
/// its name (Driver.Sql-005): the reader mints it from <c>GroupResult.Failed</c>, which is reachable
|
|
|
|
|
/// its name: the reader mints it from <c>GroupResult.Failed</c>, which is reachable
|
|
|
|
|
/// only after <c>OpenAsync</c> returned. Treating it as "did not answer" made one group failing on a
|
|
|
|
|
/// schema change, a lock or a revoked grant report the whole endpoint down. See
|
|
|
|
|
/// <see cref="IsQueryFailureClass"/>.</para>
|
|
|
|
@@ -725,9 +702,8 @@ public sealed class SqlDriver
|
|
|
|
|
/// <c>LastSuccessfulRead</c> records, which is not the same question as "is this value good".
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// <para>Driver.Sql-006. <c>DriverInstanceActor</c>'s comms-loss watchdog force-reconnects a driver
|
|
|
|
|
/// that is non-Healthy <b>and</b> whose <c>LastSuccessfulRead</c> has been frozen for 90 s (Gitea
|
|
|
|
|
/// #527), on the stated premise that the clock is the honest evidence the transport works. Advancing
|
|
|
|
|
/// <para><c>DriverInstanceActor</c>'s comms-loss watchdog force-reconnects a driver
|
|
|
|
|
/// that is non-Healthy <b>and</b> whose <c>LastSuccessfulRead</c> has been frozen for 90 s, on the stated premise that the clock is the honest evidence the transport works. Advancing
|
|
|
|
|
/// it on Good alone made a truncated staging table or a deleted key set look — to that watchdog —
|
|
|
|
|
/// exactly like a dead socket, so a database answering every poll on time got its connection torn
|
|
|
|
|
/// down and rebuilt every 90 s, forever.</para>
|
|
|
|
@@ -749,7 +725,7 @@ public sealed class SqlDriver
|
|
|
|
|
or SqlStatusCodes.BadCommunicationError; // the connection opened; the server refused the query
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Routes a poll-loop reader failure to the health surface (05/STAB-9). Deliberately does <b>not</b>
|
|
|
|
|
/// Routes a poll-loop reader failure to the health surface. Deliberately does <b>not</b>
|
|
|
|
|
/// touch host state: the engine also reports its own contract violations here, which say nothing
|
|
|
|
|
/// about connectivity — the unreachable-database transition is raised by <see cref="ReadAsync"/>,
|
|
|
|
|
/// which knows the exception came from the reader.
|
|
|
|
@@ -763,7 +739,7 @@ public sealed class SqlDriver
|
|
|
|
|
// a second time, so defer to the classification that already happened.
|
|
|
|
|
//
|
|
|
|
|
// Matched on the exception INSTANCE ReadAsync marked, not on its type. `ex is DbException` was the
|
|
|
|
|
// stated intent — "the class ReadAsync owns" — but not what it implemented (Driver.Sql-004): the
|
|
|
|
|
// stated intent — "the class ReadAsync owns" — but not what it implemented: the
|
|
|
|
|
// reader raises a plain InvalidOperationException when the provider factory returns no connection,
|
|
|
|
|
// and a provider can raise ArgumentException/FormatException off a malformed connection string on
|
|
|
|
|
// the same open path. Those are classified by ReadAsync exactly like a DbException, yet a type test
|
|
|
|
@@ -822,7 +798,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// The one read-modify-write of the health field, as a compare-and-swap retry loop.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Driver.Sql-010. Health is transitioned from every poll loop (one per subscription) plus any
|
|
|
|
|
/// Health is transitioned from every poll loop (one per subscription) plus any
|
|
|
|
|
/// ad-hoc <see cref="ReadAsync"/>, and every transition needs the current snapshot to build the next
|
|
|
|
|
/// one — <see cref="Degrade"/> preserves <c>LastSuccessfulRead</c>, the Faulted guard reads the state.
|
|
|
|
|
/// A plain <c>Volatile</c> read followed by a <c>Volatile</c> write lets a concurrent update land in
|
|
|
|
@@ -944,7 +920,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// unsupportable.</para>
|
|
|
|
|
/// <para><b>No tags ⇒ no I/O.</b> A driver with nothing authored has nothing to validate, and issuing
|
|
|
|
|
/// catalog queries to prove that would be a round-trip that can only fail.</para>
|
|
|
|
|
/// <para>Bounded by the same wall-clock discipline as the liveness check (R2-01 / STAB-14): the work
|
|
|
|
|
/// <para>Bounded by the same wall-clock discipline as the liveness check: the work
|
|
|
|
|
/// runs on the thread pool so a provider implementing the async path synchronously blocks a pool
|
|
|
|
|
/// thread rather than wedging Initialize forever with no retry.</para>
|
|
|
|
|
/// </remarks>
|
|
|
|
@@ -969,7 +945,7 @@ public sealed class SqlDriver
|
|
|
|
|
|
|
|
|
|
var result = SqlCatalogGate.Apply(authored.Values, catalog, _dialect);
|
|
|
|
|
|
|
|
|
|
// Gitea #541: a gate rejection leaves the tag unpolled and publishing BadNodeIdUnknown with the
|
|
|
|
|
// a gate rejection leaves the tag unpolled and publishing BadNodeIdUnknown with the
|
|
|
|
|
// driver Healthy — the same invisible outcome as a blob that did not map, so it is the same signal.
|
|
|
|
|
PublishSkipLedger(result.Rejected.Select(r =>
|
|
|
|
|
new SkippedTag(r.RawPath, $"rejected by the catalog gate: {r.Field} — {r.Reason}")));
|
|
|
|
@@ -1019,7 +995,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// Opens ONE connection, runs the dialect's liveness statement, and disposes it. No connection is
|
|
|
|
|
/// held between this check and the first poll — the reader opens, uses and disposes per poll, so a
|
|
|
|
|
/// long-lived connection here would only be a second thing to keep alive.
|
|
|
|
|
/// <para><b>Bounded by wall-clock, not only by the token</b> (the R2-01 / STAB-14 lesson): some ADO.NET
|
|
|
|
|
/// <para><b>Bounded by wall-clock, not only by the token</b> (a lesson learned from earlier hangs): some ADO.NET
|
|
|
|
|
/// providers implement the async path synchronously, and a wedged socket can hang inside the
|
|
|
|
|
/// provider's own cancellation handshake. If Initialize hung there, <c>DriverInstanceActor</c>'s init
|
|
|
|
|
/// task would never complete and the driver would sit in Connecting forever with no retry. The work
|
|
|
|
@@ -1040,7 +1016,7 @@ public sealed class SqlDriver
|
|
|
|
|
/// converting a breach into a <see cref="TimeoutException"/> worded from <paramref name="what"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// <para>The R2-01 / STAB-14 shape, shared by the two pieces of I/O Initialize performs. It exists
|
|
|
|
|
/// <para>The bounded-I/O shape, shared by the two pieces of I/O Initialize performs. It exists
|
|
|
|
|
/// because a token is not a deadline: some ADO.NET providers implement the async path synchronously,
|
|
|
|
|
/// and a wedged socket can hang <em>inside</em> the provider's own cancellation handshake. Without an
|
|
|
|
|
/// independent wall clock, <c>DriverInstanceActor</c>'s init task would never complete and the driver
|
|
|
|
|