doc/developer/design/20230810_alter_connection.md
ALTER CONNECTIONA CONNECTION must be valid for a source to ingest data--however, in our
current scheme, CONNECTIONs are immutable so any change to the service hosting
the source permanently wedges the source in Materialize. This is undesirable
because the DROP/CREATE cycle for a source can be very painful for users
because of rehydration.
Allow users to modify a CONNECTION s/t they can repair the TCP connection
between MZ and their services.
Allow users to meticulously control their sources' state changes.
We can perform a process similar to ALTER SOURCE wherein we update some state
in memory, re-plan something, update it in the catalog, and then communicate the
updated state throughout the system.
Parse ALTER CONNECTION <name> AS (KAFKA|POSTGRES) SET <option> =? <val>.
AS clause dictates the options available. These will get
unified in an enum that passes from parsing into planning.During planning/purification:
AS clause matches existing connection type.CREATE CONNECTION.During sequencing:
Load the connection in memory. Update its values.
Re-plan the value to get its updated CREATE CONNECTION string, just as
we do for ALTER SOURCE.
Commit a catalog update op for the connection.
Find all sources that use the connection and update their ingestion
description to use the new connection. I believe this only needs to be
done to the in-memory version of the SOURCE because the on-disk
representation only contains the connection details by name.
To the storage controller, send a RunIngestion command with the new,
in-memory representation of the ingestion.
This will restart all of the sources with the new connection state.
ALTER SOURCE...SET CONNECTION would let us swap out one connection object
for another. This would let users create new connections, validate that they
work, and then swap them over one-by-one.
The advantage here is being able to more meticulously control the state changes sources encounter. The downside is that it has to be done meticulously, source-by-source and cannot change all sources using this connection at once.
The original design overlooked that:
into_inline_connection.Derivations:
ALTER CONNECTION with specifying the
source type, which meant that we had to associate connection settings with
source types in planning rather than in the parser.DROP and RESET options, as well as let users provide a list of
changes.n/a