-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table_resolver refactor - introduce patternSplitter, decisionMerger #925
base: main
Are you sure you want to change the base?
Conversation
61cdda1
to
0bfe29b
Compare
I really like logic :) |
quesma/table_resolver/rules.go
Outdated
if lhsClickhouse, ok := connDecisionLhs.(*ConnectorDecisionClickhouse); ok { | ||
if lhsClickhouse.ClickhouseTableName != rhsClickhouse.ClickhouseTableName { | ||
return nil, &Decision{ | ||
Reason: "Inconsistent ClickHouse table usage", |
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.
We should add more details here.
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.
Fixed in last commit - made the reason (and corresponding Err) more clear.
quesma/table_resolver/rules.go
Outdated
} else { | ||
if !reflect.DeepEqual(lhsClickhouse, rhsClickhouse) { | ||
return nil, &Decision{ | ||
Reason: "Inconsistent ClickHouse table usage", |
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.
The same reason is returned above. There is no way to distinguish which one rule has been fired.
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.
Fixed in last commit - made the reason (and corresponding Err) more clear.
quesma/table_resolver/rules.go
Outdated
} | ||
if !foundMatching { | ||
return nil, &Decision{ | ||
Reason: "Inconsistent connectors", |
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.
As above, we need more details here.
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.
Fixed in last commit - made the reason (and corresponding Err) more clear.
A/B testing is turned on in the configuration by specifying two targets: ClickHouse and Elastic (`target: [ch, es]`). table_resolver correctly handles it for single index case, but it's not working correctly for the pattern case (even if the pattern matches only a single index with A/B testing requested). Adding a (skipped) test for such case (a proper fix needs some discussion).
69b408a
to
7716b53
Compare
This PR changes the way patterns (wildcards such as
logs*
) are handled bytable_resolver
.Previously, many
table_resolver
rules had two code paths - one code path for a single index (e.g.logs1
) and one code path for patterns (e.g.logs1,logs2
orlogs*
), making those rules more complicated. Moreover, one rulemakeCheckIfPatternMatchesAllConnectors
was the primary one to handle patterns and it contained fragments of other rules.This PR introduces
patternSplitter
,decisionMerger
. Thetable_resolver
now works like this:patternSplitter
splits a pattern (e.g.logs*
) into concrete single indexes (e.g.logs1
,logs2
)decisionMerger
merges decisions of single indexes, making sure that the decisions are compatible. It yields a single decision.