This repository was archived by the owner on Nov 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Lack of schema refresh after new field in common table #1461
Merged
nablaone
merged 6 commits into
main
from
que-246-lack-of-schema-refresh-after-new-field-in-common-table
Jun 12, 2025
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
927c2ba
test case first
nablaone 3e65a79
THE FIX
nablaone b44d918
comment
nablaone 84786e0
Add endpoint to reload tables
nablaone d2460e2
More sophisticated test
nablaone 8191703
Refresh the elastic index that stores virtual table definitions. Make…
nablaone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| frontendConnectors: | ||
| - name: elastic-ingest | ||
| type: elasticsearch-fe-ingest | ||
| config: | ||
| listenPort: 8080 | ||
| - name: elastic-query | ||
| type: elasticsearch-fe-query | ||
| config: | ||
| listenPort: 8080 | ||
| backendConnectors: | ||
| - name: e | ||
| type: elasticsearch | ||
| config: | ||
| url: "http://{{ .elasticsearch_host }}:{{ .elasticsearch_port }}" | ||
| user: elastic | ||
| password: quesmaquesma | ||
| - name: c | ||
| type: clickhouse-os | ||
| config: | ||
| url: clickhouse://{{ .clickhouse_host }}:{{ .clickhouse_port }} | ||
| logging: | ||
| path: "logs" | ||
| level: "info" | ||
| disableFileLogging: false | ||
| enableSQLTracing: true | ||
| processors: | ||
| - name: QP | ||
| type: quesma-v1-processor-query | ||
| config: | ||
| useCommonTable: true | ||
| indexes: | ||
| "*": | ||
| target: | ||
| - c | ||
| - name: IP | ||
| type: quesma-v1-processor-ingest | ||
| config: | ||
| useCommonTable: true | ||
| indexes: | ||
| "*": | ||
| target: | ||
| - c | ||
|
|
||
| pipelines: | ||
| - name: my-elasticsearch-proxy-read | ||
| frontendConnectors: [ elastic-query ] | ||
| processors: [ QP ] | ||
| backendConnectors: [ e, c ] | ||
| - name: my-elasticsearch-proxy-write | ||
| frontendConnectors: [ elastic-ingest ] | ||
| processors: [ IP ] | ||
| backendConnectors: [ e, c ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright Quesma, licensed under the Elastic License 2.0. | ||
| // SPDX-License-Identifier: Elastic-2.0 | ||
|
|
||
| package testcases | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/stretchr/testify/assert" | ||
| "net/http" | ||
| "testing" | ||
| "time" | ||
| ) | ||
|
|
||
| type OnlyCommonTableTestcase struct { | ||
| IntegrationTestcaseBase | ||
| } | ||
|
|
||
| func NewOnlyCommonTableTestcase() *OnlyCommonTableTestcase { | ||
| return &OnlyCommonTableTestcase{ | ||
| IntegrationTestcaseBase: IntegrationTestcaseBase{ | ||
| ConfigTemplate: "quesma-only-common-table.yml.template", | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func (a *OnlyCommonTableTestcase) SetupContainers(ctx context.Context) error { | ||
| containers, err := setupAllContainersWithCh(ctx, a.ConfigTemplate) | ||
| a.Containers = containers | ||
| return err | ||
| } | ||
|
|
||
| func (a *OnlyCommonTableTestcase) RunTests(ctx context.Context, t *testing.T) error { | ||
|
|
||
| t.Run("test alter virtual table", func(t *testing.T) { a.testAlterVirtualTable(ctx, t) }) | ||
| return nil | ||
| } | ||
|
|
||
| func (a *OnlyCommonTableTestcase) testAlterVirtualTable(ctx context.Context, t *testing.T) { | ||
|
|
||
| resp, body := a.RequestToQuesma(ctx, t, "POST", "/logs-6/_doc", []byte(`{"name": "Przemyslaw", "age": 31337}`)) | ||
| fmt.Println(string(body)) | ||
| assert.Equal(t, http.StatusOK, resp.StatusCode) | ||
|
|
||
| // wait for internal processing, especially for the periodic task that updates the schema | ||
| time.Sleep(60 * time.Second) | ||
|
|
||
| resp, body = a.RequestToQuesma(ctx, t, "POST", "/logs-6/_doc", []byte(`{"name": "Przemyslaw", "age": 31337, "this-is-a-new-field": "new-field"}`)) | ||
| fmt.Println(string(body)) | ||
| assert.Equal(t, http.StatusOK, resp.StatusCode) | ||
|
|
||
| q := `{ "fields": [ "*" ]}` | ||
|
|
||
| _, bodyBytes := a.RequestToQuesma(ctx, t, "POST", "/logs-6/_field_caps", []byte(q)) | ||
|
|
||
| fmt.Println(string(bodyBytes)) | ||
|
|
||
| assert.Contains(t, string(bodyBytes), `"this-is-a-new-field"`) | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is very tricky to add. Slow IT are hard to debug and takes a lot to some engineering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I know.
I will add an endpoint to reload tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the test. Added endpoint. And fixed "eventually consistent" index that keeps a list of virtual tables.