Skip to content
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

Cleanup pushdown terminology #3691

Merged
merged 31 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c7fb045
wip
noisersup Nov 9, 2023
2877a31
wip
noisersup Nov 9, 2023
cb7b85d
unsafe removal part uno
noisersup Nov 9, 2023
143c9dd
unsafe removal part dos
noisersup Nov 9, 2023
6926153
unsafe removal part drei
noisersup Nov 9, 2023
a68f056
unsafe removal part quatro
noisersup Nov 9, 2023
6e85bf0
Merge remote-tracking branch 'upstream/main' into cleanup-pushdown-te…
noisersup Nov 13, 2023
24dc52a
wip
noisersup Nov 14, 2023
15a2077
wip
noisersup Nov 15, 2023
84ad078
separate flags
noisersup Nov 15, 2023
94ee984
wip
noisersup Nov 15, 2023
9fce730
wip
noisersup Nov 15, 2023
bd2dcc2
wip
noisersup Nov 15, 2023
7e61b95
wip
noisersup Nov 15, 2023
4a03d61
wip
noisersup Nov 15, 2023
069ea9a
wip
noisersup Nov 15, 2023
bedd581
wip
noisersup Nov 15, 2023
f913767
wip
noisersup Nov 15, 2023
acc73fe
Merge branch 'main' into cleanup-pushdown-term-3688
AlekSi Nov 16, 2023
2adeed3
split
noisersup Nov 16, 2023
8f901f4
cleanup
noisersup Nov 16, 2023
2c7f43e
Merge branch 'main' into cleanup-pushdown-term-3688
AlekSi Nov 17, 2023
a7e17e2
rename
noisersup Nov 17, 2023
52568d8
rename
noisersup Nov 17, 2023
5aaf0c8
rm docs
noisersup Nov 17, 2023
68db116
fix
noisersup Nov 17, 2023
2016d9b
fix
noisersup Nov 17, 2023
2852ea9
fix
noisersup Nov 17, 2023
3bd7e92
Merge remote-tracking branch 'upstream/main' into cleanup-pushdown-te…
noisersup Nov 17, 2023
48e93df
Merge branch 'main' into cleanup-pushdown-term-3688
mergify[bot] Nov 20, 2023
8416137
Merge branch 'main' into cleanup-pushdown-term-3688
mergify[bot] Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
split
  • Loading branch information
noisersup committed Nov 16, 2023
commit 2adeed3b62f118ebeb12f7e2c6fb3798bc3ebf9b
4 changes: 0 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ vars:
SHARD_INDEX: 1
SHARD_TOTAL: 1
DISABLE_FILTER_PUSHDOWN: false
ENABLE_SORT_PUSHDOWN: false
ENABLE_UNSAFE_SORT_PUSHDOWN: false
TEST_RUN: ""
TEST_TIMEOUT: 35m
Expand Down Expand Up @@ -219,7 +218,6 @@ tasks:
-postgresql-url='postgres://username@127.0.0.1:5432/ferretdb?search_path='
-compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem'
-disable-filter-pushdown={{.DISABLE_FILTER_PUSHDOWN}}
-enable-sort-pushdown={{.ENABLE_SORT_PUSHDOWN}}
-enable-unsafe-sort-pushdown={{.ENABLE_UNSAFE_SORT_PUSHDOWN}}

test-integration-sqlite:
Expand All @@ -246,7 +244,6 @@ tasks:
-target-tls
-compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem'
-disable-filter-pushdown={{.DISABLE_FILTER_PUSHDOWN}}
-enable-sort-pushdown={{.ENABLE_SORT_PUSHDOWN}}
-enable-unsafe-sort-pushdown={{.ENABLE_UNSAFE_SORT_PUSHDOWN}}

test-integration-hana:
Expand All @@ -273,7 +270,6 @@ tasks:
-hana-url=$FERRETDB_HANA_URL
-compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem'
-disable-filter-pushdown={{.DISABLE_FILTER_PUSHDOWN}}
-enable-sort-pushdown={{.ENABLE_SORT_PUSHDOWN}}
-enable-unsafe-sort-pushdown={{.ENABLE_UNSAFE_SORT_PUSHDOWN}}

test-integration-mongodb:
Expand Down
2 changes: 0 additions & 2 deletions cmd/ferretdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ var cli struct {
RecordsDir string `default:"" help:"Testing: directory for record files."`

DisableFilterPushdown bool `default:"false" help:"Experimental: disable filter pushdown."`
EnableSortPushdown bool `default:"false" help:"Experimental: enable sort pushdown."`
EnableUnsafeSortPushdown bool `default:"false" help:"Experimental: enable unsafe sort pushdown."`
EnableOplog bool `default:"false" help:"Experimental: enable capped collections, tailable cursors and OpLog." hidden:""`

Expand Down Expand Up @@ -383,7 +382,6 @@ func run() {

TestOpts: registry.TestOpts{
DisableFilterPushdown: cli.Test.DisableFilterPushdown,
EnableSortPushdown: cli.Test.EnableSortPushdown,
EnableUnsafeSortPushdown: cli.Test.EnableUnsafeSortPushdown,
EnableOplog: cli.Test.EnableOplog,
},
Expand Down
5 changes: 0 additions & 5 deletions integration/setup/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func setupListener(tb testtb.TB, ctx context.Context, logger *zap.Logger) string

TestOpts: registry.TestOpts{
DisableFilterPushdown: *disableFilterPushdownF,
EnableSortPushdown: *enableSortPushdownF,
EnableUnsafeSortPushdown: *enableUnsafeSortPushdownF,
EnableOplog: true,
},
Expand All @@ -187,10 +186,6 @@ func setupListener(tb testtb.TB, ctx context.Context, logger *zap.Logger) string
tb.Fatal("Both -target-tls and -target-unix-socket are set.")
}

if *enableSortPushdownF && *enableUnsafeSortPushdownF {
tb.Fatal("Both -enable-sort-pushdown and -enable-unsafe-sort-pushdown are set.")
}

switch {
case *targetTLSF:
listenerOpts.TLS = "127.0.0.1:0"
Expand Down
1 change: 0 additions & 1 deletion integration/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ var (
logLevelF = zap.LevelFlag("log-level", zap.DebugLevel, "log level for tests")

disableFilterPushdownF = flag.Bool("disable-filter-pushdown", false, "disable filter pushdown")
enableSortPushdownF = flag.Bool("enable-sort-pushdown", false, "enable sort pushdown")
enableUnsafeSortPushdownF = flag.Bool("enable-unsafe-sort-pushdown", false, "enable unsafe sort pushdown")
)

Expand Down
6 changes: 3 additions & 3 deletions integration/setup/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func FilterPushdownDisabled() bool {
return *disableFilterPushdownF
}

// SortPushdownEnabled returns true if sort pushdown is enabled.
func SortPushdownEnabled() bool {
return *enableSortPushdownF
// UnsafeSortPushdownEnabled returns true if unsafe sort pushdown is enabled.
func UnsafeSortPushdownEnabled() bool {
return *enableUnsafeSortPushdownF
}
1 change: 0 additions & 1 deletion internal/handlers/registry/hana.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func init() {
StateProvider: opts.StateProvider,

DisableFilterPushdown: opts.DisableFilterPushdown,
EnableSortPushdown: opts.EnableSortPushdown,
EnableUnsafeSortPushdown: opts.EnableUnsafeSortPushdown,
EnableOplog: opts.EnableOplog,
}
Expand Down
1 change: 0 additions & 1 deletion internal/handlers/registry/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func init() {
StateProvider: opts.StateProvider,

DisableFilterPushdown: opts.DisableFilterPushdown,
EnableSortPushdown: opts.EnableSortPushdown,
EnableUnsafeSortPushdown: opts.EnableUnsafeSortPushdown,
EnableOplog: opts.EnableOplog,
}
Expand Down
1 change: 0 additions & 1 deletion internal/handlers/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type NewHandlerOpts struct {
// TestOpts represents experimental configuration options.
type TestOpts struct {
DisableFilterPushdown bool
EnableSortPushdown bool
EnableUnsafeSortPushdown bool
EnableOplog bool
}
Expand Down
1 change: 0 additions & 1 deletion internal/handlers/registry/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func init() {
StateProvider: opts.StateProvider,

DisableFilterPushdown: opts.DisableFilterPushdown,
EnableSortPushdown: opts.EnableSortPushdown,
EnableUnsafeSortPushdown: opts.EnableUnsafeSortPushdown,
EnableOplog: opts.EnableOplog,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/handlers/sqlite/msg_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
}

// Skip sorting if there are more than one sort parameters
if (h.EnableSortPushdown || h.EnableUnsafeSortPushdown) && sort.Len() == 1 {
if h.EnableUnsafeSortPushdown && sort.Len() == 1 {
var order types.SortType

k := sort.Keys()[0]
Expand All @@ -277,7 +277,7 @@

order, err = common.GetSortType(k, v)
if err != nil {
closer.Close()

Check warning on line 280 in internal/handlers/sqlite/msg_aggregate.go

View check run for this annotation

Codecov / codecov/patch

internal/handlers/sqlite/msg_aggregate.go#L280

Added line #L280 was not covered by tests
return nil, err
}

Expand Down
10 changes: 4 additions & 6 deletions internal/handlers/sqlite/msg_explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

// Skip sorting if there are more than one sort parameters
if (h.EnableSortPushdown || h.EnableUnsafeSortPushdown) && params.Sort.Len() == 1 {
if h.EnableUnsafeSortPushdown && params.Sort.Len() == 1 {
var order types.SortType

k := params.Sort.Keys()[0]
Expand All @@ -107,20 +107,18 @@

// Limit pushdown is not applied if:
// - `filter` is set, it must fetch all documents to filter them in memory;
// - `sort` is set but sort pushdown is not enabled, it must fetch all documents
// - `sort` is set but `UnsafeSortPushdown` is not set, it must fetch all documents
// and sort them in memory;
// - `skip` is non-zero value, skip pushdown is not supported yet.
if params.Filter.Len() == 0 &&
(params.Sort.Len() == 0 || h.EnableSortPushdown || h.EnableUnsafeSortPushdown) &&
params.Skip == 0 {
if params.Filter.Len() == 0 && (params.Sort.Len() == 0 || h.EnableUnsafeSortPushdown) && params.Skip == 0 {
qp.Limit = params.Limit
}

if h.DisableFilterPushdown {
qp.Filter = nil
}

if !h.EnableSortPushdown {
if !h.EnableUnsafeSortPushdown {
qp.Sort = nil
}

Expand All @@ -139,9 +137,9 @@

// our extensions
// TODO https://github.com/FerretDB/FerretDB/issues/3235
"pushdown", res.FilterPushdown,
"sortingPushdown", res.SortPushdown,
"limitPushdown", res.LimitPushdown,

Check warning on line 142 in internal/handlers/sqlite/msg_explain.go

View check run for this annotation

Codecov / codecov/patch

internal/handlers/sqlite/msg_explain.go#L140-L142

Added lines #L140 - L142 were not covered by tests

"ok", float64(1),
))},
Expand Down
8 changes: 3 additions & 5 deletions internal/handlers/sqlite/msg_find.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (h *Handler) MsgFind(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, er
}

// Skip sorting if there are more than one sort parameters
if (h.EnableSortPushdown || h.EnableUnsafeSortPushdown) && params.Sort.Len() == 1 {
if h.EnableUnsafeSortPushdown && params.Sort.Len() == 1 {
var order types.SortType

k := params.Sort.Keys()[0]
Expand All @@ -132,12 +132,10 @@ func (h *Handler) MsgFind(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, er

// Limit pushdown is not applied if:
// - `filter` is set, it must fetch all documents to filter them in memory;
// - `sort` is set but sort pushdown is not enabled, it must fetch all documents
// - `sort` is set but `UnsafeSortPushdown` is not set, it must fetch all documents
// and sort them in memory;
// - `skip` is non-zero value, skip pushdown is not supported yet.
if params.Filter.Len() == 0 &&
(params.Sort.Len() == 0 || h.EnableSortPushdown || h.EnableUnsafeSortPushdown) &&
params.Skip == 0 {
if params.Filter.Len() == 0 && (params.Sort.Len() == 0 || h.EnableUnsafeSortPushdown) && params.Skip == 0 {
qp.Limit = params.Limit
}

Expand Down
1 change: 0 additions & 1 deletion internal/handlers/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type NewOpts struct {

// test options
DisableFilterPushdown bool
EnableSortPushdown bool
EnableUnsafeSortPushdown bool
EnableOplog bool
}
Expand Down
Loading