Skip to content

Commit 77b0268

Browse files
kay-kimdoy-materializealex-hunt-materializemaheshwaripSangJunBak
authored
Docs upcoming v26.0.0 (#34136)
Signed-off-by: Petros Angelatos <petrosagg@gmail.com> Co-authored-by: Jesse Luehrs <doy@materialize.com> Co-authored-by: doy-materialize <110416385+doy-materialize@users.noreply.github.com> Co-authored-by: alex-hunt-materialize <86254996+alex-hunt-materialize@users.noreply.github.com> Co-authored-by: Pranshu Maheshwari <maheshwarip@users.noreply.github.com> Co-authored-by: Sang Jun Bak <jun@materialize.com> Co-authored-by: Petros Angelatos <petrosagg@gmail.com> Co-authored-by: Justin Bradfield <justin@materialize.com> Co-authored-by: Dennis Felsing <dennis@felsing.org> Co-authored-by: Ben Kirwin <bkirwi@materialize.com>
1 parent 66f611c commit 77b0268

File tree

103 files changed

+3904
-1644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3904
-1644
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/bump-version

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ rm -f src/{clusterd,environmentd,materialized,persist-client,testdrive,catalog-d
6969

7070
cargo update --workspace
7171

72+
crd_descriptions_json=doc/user/data/self_managed/materialize_crd_descriptions.json
73+
cargo run -p mz-cloud-resources --bin crd-writer > "${crd_descriptions_json}"
74+
git add "${crd_descriptions_json}"
75+
7276
bin/helm-chart-version-bump --bump-orchestratord-version "v$version"
7377

7478
helm_docs_version=1.14.2
@@ -83,7 +87,11 @@ if [ "$(helm-docs --version)" != "helm-docs version $helm_docs_version" ]; then
8387
echo "Install helm-docs $helm_docs_version from https://github.com/norwoodj/helm-docs/releases/tag/v$helm_docs_version"
8488
exit 1
8589
fi
90+
# update README.md
8691
helm-docs misc/helm-charts
92+
# update values yaml descriptions
93+
helm-docs misc/helm-charts -t misc/helm-charts/operator/value_descriptions.yml.gotmpl -o value_descriptions.yml
94+
mv misc/helm-charts/operator/value_descriptions.yml doc/user/data/self_managed/materialize_operator_chart_parameter.yml
8795

8896
if $sbom; then
8997
if ! inspector-sbomgen --version > /dev/null; then

doc/user/assets/sass/_base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $rem-scale: 0.585;
3434
--milli: #{rem(2)};
3535
--xx-small: #{rem(2.5)};
3636
--x-small: #{rem(3)};
37-
--small: #{rem(4)};
37+
--small: #{rem(4.5)};
3838
--medium: #{rem(5)};
3939
--large: #{rem(6)};
4040

doc/user/assets/sass/_layout.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
.content-wrapper {
1111
display: flex;
1212
justify-content: center;
13-
padding-top: var(--nav-height);
13+
padding-top: calc(var(--nav-height) + var(--small));
1414

1515
@media(max-width: 800px) {
16-
padding-top: calc(var(--nav-height) + var(--xx-small));
16+
padding-top: calc(var(--nav-height) + var(--small));
1717
}
1818

1919
@media(max-width: 380px) {
@@ -139,7 +139,7 @@ table.inline-headings {
139139
z-index: 100;
140140
top: var(--nav-height);
141141
left: 0;
142-
height: calc(100vh - var(--nav-height));
142+
height: calc(120vh - var(--nav-height));
143143
border-right: 1px solid var(--divider-light);
144144
transform: translateX(-100%);
145145
transition: all .2s ease-out;
@@ -193,6 +193,7 @@ table.inline-headings {
193193
@media(max-width: 850px) {
194194
padding-bottom: var(--large);
195195
height: calc(100vh - var(--nav-height));
196+
margin-top: 80px;
196197
}
197198

198199
a {

doc/user/assets/sass/_nav.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149

150150
button.show-topics {
151151
display: none;
152-
margin: 0 0 var(--small) !important;
152+
margin: var(--small) 0 var(--small) !important;
153153
text-align: left;
154154
font-weight: 300;
155155
font-size: var(--base);
@@ -171,6 +171,7 @@ button.close-topics {
171171
position: absolute;
172172
justify-content: center;
173173
align-items: center;
174+
margin-top: 80px;
174175
top: 0;
175176
right: 0;
176177
transform: translateX(50%) translateY(50%);

doc/user/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ disableKinds = ['taxonomy']
77

88
[params]
99
repo = "//github.com/MaterializeInc/materialize"
10-
bannerMessage = ""
10+
bannerMessage = "**New: Self-Managed v26.0!** New features include license keys, SCRAM-SHA support, and more! For details on v26.0 features, see [Release Notes](/releases/).<br>**Note**: To upgrade from v25.2 to v26.0, you must [upgrade first to v25.2.15](https://materialize.com/docs/self-managed/v25.2/release-notes/#v25215)."
1111
bannerLink = ""
1212

1313
[frontmatter]

doc/user/content/ingest-data/postgres/_index.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ Materialize gives you the following benefits:
3838
The PostgreSQL source requires **PostgreSQL 11+** and is compatible with most
3939
common PostgreSQL hosted services.
4040

41-
| Integration guides |
42-
| ------------------------------------------- |
43-
| {{% ingest-data/postgres-native-support %}} |
44-
45-
If there is a hosted service or PostgreSQL distribution that is not listed above
46-
but you would like to use with Materialize, please submit a [feature
47-
request](https://github.com/MaterializeInc/materialize/discussions/new?category=feature-requests&labels=A-integration)
48-
or reach out in the Materialize [Community
49-
Slack](https://materialize.com/s/chat).
41+
## Integration guides
42+
43+
The following integration guides are available:
44+
45+
{{% include-md file="shared-content/postgresql-ingest-data-guides.md" %}}
5046

5147
## Considerations
5248

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
title: "Guide: Handle upstream schema changes with zero downtime"
3+
description: "How to add a column, or drop a column, from your source PostgreSQL database, without any downtime in Materialize"
4+
5+
menu:
6+
main:
7+
parent: "postgresql"
8+
weight: 85
9+
10+
---
11+
12+
{{< private-preview />}}
13+
{{< note >}}
14+
Changing column types is currently unsupported.
15+
{{< /note >}}
16+
17+
Starting in v26.0.0, Materialize allows you to handle certain types of upstream
18+
table schema changes seamlessly, specifically:
19+
20+
- Adding a column in the upstream database.
21+
- Dropping a column in the upstream database.
22+
23+
This guide walks you through how to handle these changes without any downtime in Materialize.
24+
25+
## Prerequisites
26+
27+
Some familiarity with Materialize. If you've never used Materialize before,
28+
start with our [guide to getting started](/get-started/quickstart/) to learn
29+
how to connect a database to Materialize.
30+
31+
### Set up a PostgreSQL database
32+
33+
For this guide, setup a PostgreSQL 11+ database. In your PostgreSQL, create a
34+
table `T` and populate:
35+
36+
```sql
37+
CREATE TABLE T (
38+
A INT
39+
);
40+
41+
INSERT INTO T (A) VALUES
42+
(10);
43+
```
44+
45+
### Connect your source database to Materialize
46+
47+
{{< include-md file="shared-content/postgres-source-prereq.md" >}}
48+
49+
## Create a source using the new syntax
50+
51+
In Materialize, create a source using the updated [`CREATE SOURCE`
52+
syntax](/sql/create-source/postgres-v2/).
53+
54+
```sql
55+
CREATE SOURCE IF NOT EXISTS my_source
56+
FROM POSTGRES CONNECTION my_connection (PUBLICATION 'mz_source');
57+
```
58+
59+
Unlike the [legacy syntax](/sql/create-source/postgres/), the new syntax does
60+
not include the `FOR [[ALL] TABLES|SCHEMAS]` clause; i.e., the new syntax does
61+
not create corresponding subsources in Materialize automatically. Instead, the
62+
new syntax requires a separate [`CREATE TABLE ... FROM
63+
SOURCE`](/sql/create-table/), which will create the corresponding tables and
64+
start the snapshotting process. See [Create a table from the
65+
source](#create-a-table-from-the-source).
66+
67+
{{< note >}}
68+
The [legacy syntax](/sql/create-source/postgres/) is still supported. However,
69+
the legacy syntax doesn't support upstream schema changes.
70+
{{< /note >}}
71+
72+
## Create a table from the source
73+
To start ingesting specific tables from your source database, you can create a
74+
table in Materialize. We'll add it into the v1 schema in Materialize.
75+
76+
```sql
77+
CREATE SCHEMA v1;
78+
79+
CREATE TABLE v1.T
80+
FROM SOURCE my_source(REFERENCE public.T);
81+
```
82+
83+
Once you've created a table from source, the [initial
84+
snapshot](/ingest-data/#snapshotting) of table `v1.T` will begin.
85+
86+
{{< note >}}
87+
88+
During the snapshotting, the data ingestion for the other tables associated with
89+
the source is temporarily blocked. As before, you can monitor progress for the
90+
snapshot operation on the overview page for the source in the Materialize
91+
console.
92+
93+
{{< /note >}}
94+
95+
## Create a view on top of the table.
96+
97+
For this guide, add a materialized view `matview` (also in schema `v1`) that
98+
sums column `A` from table `T`.
99+
100+
```sql
101+
CREATE MATERIALIZED VIEW v1.matview AS
102+
SELECT SUM(A) from v1.T;
103+
```
104+
105+
## Handle upstream column addition
106+
107+
### A. Add a column in your upstream PostgreSQL database
108+
109+
In your upstream PostgreSQL database, add a new column `B` to the table `T`:
110+
111+
```sql
112+
ALTER TABLE T
113+
ADD COLUMN B BOOLEAN DEFAULT false;
114+
115+
INSERT INTO T (A, B) VALUES
116+
(20, true);
117+
```
118+
119+
This operation will have no immediate effect in Materialize. In Materialize,
120+
`v1.T` will continue to ingest only column `A`. The materialized view
121+
`v1.matview` will continue to have access to column `A` as well.
122+
123+
### B. Incorporate the new column in Materialize
124+
125+
To incorporate the new column into Materialize, create a new `v2` schema and
126+
recreate the table in the new schema:
127+
128+
```sql
129+
CREATE SCHEMA v2;
130+
131+
CREATE TABLE v2.T
132+
FROM SOURCE my_source(REFERENCE public.T);
133+
```
134+
135+
The [snapshotting](/ingest-data/#snapshotting) of table `v2.T` will begin.
136+
`v2.T` will include columns `A` and `B`.
137+
138+
{{< note >}}
139+
140+
During the snapshotting, the data ingestion for the other tables associated with
141+
the source is temporarily blocked. As before, you can monitor progress for the
142+
snapshot operation on the overview page for the source in the Materialize
143+
console.
144+
145+
{{< /note >}}
146+
147+
148+
When the new `v2.T` table has finished snapshotting, create a new materialized
149+
view `matview` in the new schema. Since the new `v2.matview` is referencing the
150+
new `v2.T`, it can reference column `B`:
151+
152+
```sql {hl_lines="4"}
153+
CREATE MATERIALIZED VIEW v2.matview AS
154+
SELECT SUM(A)
155+
FROM v2.T
156+
WHERE B = true;
157+
```
158+
159+
## Handle upstream column drop
160+
161+
### A. Exclude the column in Materialize
162+
163+
To drop a column safely, in Materialize, first, create a new `v3` schema, and
164+
recreate table `T` in the new schema but exclude the column to drop. In this
165+
example, we'll drop the column B.
166+
167+
```sql
168+
CREATE SCHEMA v3;
169+
CREATE TABLE v3.T
170+
FROM SOURCE my_source(REFERENCE public.T) WITH (EXCLUDE COLUMNS (B));
171+
```
172+
173+
{{< note >}}
174+
175+
During the snapshotting, the data ingestion for the other tables associated with
176+
the source is temporarily blocked. As before, you can monitor progress for the
177+
snapshot operation on the overview page for the source in the Materialize
178+
console.
179+
180+
{{< /note >}}
181+
182+
### B. Drop a column in your upstream PostgreSQL database
183+
184+
In your upstream PostgreSQL database, drop the column `B` from the table `T`:
185+
186+
```sql
187+
ALTER TABLE T DROP COLUMN B;
188+
```
189+
190+
Dropping the column B will have no effect on `v3.T`. However, the drop affects
191+
`v2.T` and `v2.matview` from our earlier examples. When the user attempts to
192+
read from either, Materialize will report an error that the source table schema
193+
has been altered.
194+
195+
## Optional: Swap schemas
196+
197+
When you're ready to fully cut over to the new source version, you can optionally swap the schemas and drop the old objects.
198+
199+
```sql
200+
ALTER SCHEMA v1 SWAP WITH v3;
201+
202+
DROP SCHEMA v3 CASCADE;
203+
```

0 commit comments

Comments
 (0)