Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1333,36 +1333,49 @@ jobs:
[automount]
options = "metadata"

# Keep repeated registry reads, subprocess launches, and SQLite writes off
# the Windows-mounted checkout (/mnt/d), where WSL filesystem I/O is costly.
- shell: wsl-bash -u root {0}
name: Copy test workspace to Linux filesystem
run: |
mkdir -p /tmp/stackql-wsl-tests
cp -a . /tmp/stackql-wsl-tests/

- shell: wsl-bash -u root {0}
name: Stackql permissions
run: |
cd /tmp/stackql-wsl-tests
chmod a+rwx build/stackql
chmod a+rx build/signing-fixtures
ls -al build/stackql

- shell: wsl-bash -u root {0}
name: Install Python dependencies
run: |
cd /tmp/stackql-wsl-tests
python3 -m venv .venv;
source .venv/bin/activate;
pip3 install -r cicd/requirements.txt;

- shell: wsl-bash {0}
name: Generate rewritten registry for simulations
run: |
cd /tmp/stackql-wsl-tests
source .venv/bin/activate;
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"

- shell: wsl-bash {0}
name: Create certificates for robot tests
run: |
cd /tmp/stackql-wsl-tests
openssl req -x509 -keyout test/server/mtls/credentials/pg_server_key.pem -out test/server/mtls/credentials/pg_server_cert.pem -config test/server/mtls/openssl.cnf -days 365
openssl req -x509 -keyout test/server/mtls/credentials/pg_client_key.pem -out test/server/mtls/credentials/pg_client_cert.pem -config test/server/mtls/openssl.cnf -days 365
openssl req -x509 -keyout test/server/mtls/credentials/pg_rubbish_key.pem -out test/server/mtls/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365

- shell: wsl-bash {0}
name: Run robot mocked functional tests
run: |
cd /tmp/stackql-wsl-tests
. cicd/version.txt
export BUILDBRANCH="${{github.ref}}"
export BUILDPATCHVERSION="${{github.run_number}}"
Expand All @@ -1384,6 +1397,7 @@ jobs:
name: Output from mocked functional tests
if: always()
run: |
cd /tmp/stackql-wsl-tests
cat ./test/robot/reports/output.xml

- shell: wsl-bash {0}
Expand All @@ -1393,6 +1407,7 @@ jobs:
env:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
run: |
cd /tmp/stackql-wsl-tests
. cicd/version.txt
export AZURE_CLIENT_ID='${{ secrets.AZURE_CLIENT_ID }}'
export AZURE_CLIENT_SECRET='${{ secrets.AZURE_CLIENT_SECRET }}'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- version*
- 'stable/**'
tags:
- lint*
- build*
Expand Down
10 changes: 1 addition & 9 deletions internal/stackql/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import (
dto "github.com/stackql/stackql/internal/stackql/runtimeconfig"
"github.com/stackql/stackql/internal/stackql/sql_system"
"github.com/stackql/stackql/internal/stackql/sqlengine"
sqlcontrol "github.com/stackql/stackql/internal/stackql/sqlengine/control"
"github.com/stackql/stackql/internal/stackql/tablenamespace"
"github.com/stackql/stackql/internal/stackql/typing"
"github.com/stackql/stackql/pkg/txncounter"
)

type Bundle interface {
GetAuthContexts() map[string]*dto.AuthCtx
GetControlAttributes() sqlcontrol.ControlAttributes

GetGC() garbagecollector.GarbageCollector
GetNamespaceCollection() tablenamespace.Collection
GetDBMSInternalRouter() dbmsinternal.Router
Expand All @@ -44,7 +43,6 @@ func NewBundle(
sqlEngine sqlengine.SQLEngine,
sqlSystem sql_system.SQLSystem,
pgInternalRouter dbmsinternal.Router,
controlAttributes sqlcontrol.ControlAttributes,
txnStore kstore.KStore,
txnCtrMgr txncounter.Manager,
authContexts map[string]*dto.AuthCtx,
Expand All @@ -58,7 +56,6 @@ func NewBundle(
namespaces: namespaces,
sqlEngine: sqlEngine,
sqlSystem: sqlSystem,
controlAttributes: controlAttributes,
txnStore: txnStore,
txnCtrMgr: txnCtrMgr,
formatter: sqlSystem.GetASTFormatter(),
Expand All @@ -72,7 +69,6 @@ func NewBundle(
}

type simpleBundle struct {
controlAttributes sqlcontrol.ControlAttributes
garbageCollector garbagecollector.GarbageCollector
namespaces tablenamespace.Collection
sqlEngine sqlengine.SQLEngine
Expand Down Expand Up @@ -124,10 +120,6 @@ func (sb *simpleBundle) GetAuthContexts() map[string]*dto.AuthCtx {
return sb.authContexts
}

func (sb *simpleBundle) GetControlAttributes() sqlcontrol.ControlAttributes {
return sb.controlAttributes
}

func (sb *simpleBundle) GetDBMSInternalRouter() dbmsinternal.Router {
return sb.pgInternalRouter
}
Expand Down
8 changes: 0 additions & 8 deletions internal/stackql/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ const (
ReversalStreamID int64 = -1
)

type GCStatus int

const (
GCWhite GCStatus = iota
GCBlack
GCGrey
)

type BackendQueryType int

const (
Expand Down
13 changes: 0 additions & 13 deletions internal/stackql/drm/drm_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/stackql/stackql/internal/stackql/logging"
"github.com/stackql/stackql/internal/stackql/sql_system"
"github.com/stackql/stackql/internal/stackql/sqlengine"
sqlcontrol "github.com/stackql/stackql/internal/stackql/sqlengine/control"
"github.com/stackql/stackql/internal/stackql/sqlmachinery"
"github.com/stackql/stackql/internal/stackql/streaming"
"github.com/stackql/stackql/internal/stackql/tablenamespace"
Expand Down Expand Up @@ -42,7 +41,6 @@ type Config interface {
GetCurrentTable(internaldto.HeirarchyIdentifiers) (internaldto.DBTable, error)
GetRelationalType(string) string

GetControlAttributes() sqlcontrol.ControlAttributes
GetGolangValue(string) interface{}
GetGolangSlices([]typing.ColumnMetadata) ([]interface{}, []string)
GetNamespaceCollection() tablenamespace.Collection
Expand Down Expand Up @@ -85,7 +83,6 @@ type Config interface {

type staticDRMConfig struct {
namespaceCollection tablenamespace.Collection
controlAttributes sqlcontrol.ControlAttributes
sqlEngine sqlengine.SQLEngine
sqlSystem sql_system.SQLSystem
typCfg typing.Config
Expand Down Expand Up @@ -150,14 +147,6 @@ func (dc *staticDRMConfig) ColumnToRelationalColumn(
return relationalColumn
}

func (dc *staticDRMConfig) GetControlAttributes() sqlcontrol.ControlAttributes {
return dc.getControlAttributes()
}

func (dc *staticDRMConfig) getControlAttributes() sqlcontrol.ControlAttributes {
return dc.controlAttributes
}

func (dc *staticDRMConfig) GetGolangSlices(nonControlColumns []typing.ColumnMetadata) ([]interface{}, []string) {
return dc.getGolangSlices(nonControlColumns)
}
Expand Down Expand Up @@ -561,11 +550,9 @@ func GenerateDRMConfig(
sqlSystem sql_system.SQLSystem,
typCfg typing.Config,
namespaceCollection tablenamespace.Collection,
controlAttributes sqlcontrol.ControlAttributes,
) (Config, error) {
rv := &staticDRMConfig{
namespaceCollection: namespaceCollection,
controlAttributes: controlAttributes,
sqlEngine: sqlSystem.GetSQLEngine(),
sqlSystem: sqlSystem,
typCfg: typCfg,
Expand Down
11 changes: 0 additions & 11 deletions internal/stackql/drm/prepared_statement_ctx.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package drm

import (
"strings"

"github.com/stackql/stackql/internal/stackql/internal_data_transfer/internaldto"
"github.com/stackql/stackql/internal/stackql/sql_system"
"github.com/stackql/stackql/internal/stackql/tablenamespace"
Expand All @@ -19,7 +17,6 @@ type PreparedStatementCtx interface {
GetIndirectContexts() []PreparedStatementCtx
GetCtrlColumnRepeats() int
GetNonControlColumns() []typing.ColumnMetadata
GetGCHousekeepingQueries() string
GetQuery() string
SetGCCtrlCtrs(tcc internaldto.TxnControlCounters)
SetIndirectContexts(indirectContexts []PreparedStatementCtx)
Expand Down Expand Up @@ -152,11 +149,3 @@ func NewPreparedStatementCtx(
func NewQueryOnlyPreparedStatementCtx(query string, nonControlCols []typing.ColumnMetadata) PreparedStatementCtx {
return &standardPreparedStatementCtx{query: query, nonControlColumns: nonControlCols, ctrlColumnRepeats: 0}
}

func (ps *standardPreparedStatementCtx) GetGCHousekeepingQueries() string {
var housekeepingQueries []string
for _, table := range ps.TableNames {
housekeepingQueries = append(housekeepingQueries, ps.sqlSystem.GetGCHousekeepingQuery(table, ps.txnCtrlCtrs))
}
return strings.Join(housekeepingQueries, "; ")
}
36 changes: 4 additions & 32 deletions internal/stackql/entryutil/entryutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import (
"github.com/stackql/stackql/internal/stackql/datasource/sql_datasource"
"github.com/stackql/stackql/internal/stackql/dbmsinternal"
"github.com/stackql/stackql/internal/stackql/garbagecollector"
"github.com/stackql/stackql/internal/stackql/gcexec"
"github.com/stackql/stackql/internal/stackql/handler"
"github.com/stackql/stackql/internal/stackql/iqlerror"
"github.com/stackql/stackql/internal/stackql/kstore"
dto "github.com/stackql/stackql/internal/stackql/runtimeconfig"
"github.com/stackql/stackql/internal/stackql/sql_system"
"github.com/stackql/stackql/internal/stackql/sqlengine"
sqlcontrol "github.com/stackql/stackql/internal/stackql/sqlengine/control"
"github.com/stackql/stackql/internal/stackql/tablenamespace"
"github.com/stackql/stackql/internal/stackql/typing"
"gopkg.in/yaml.v2"
Expand All @@ -32,7 +30,6 @@ import (

//nolint:funlen // let us not worry about tidyness in this boilerplate
func BuildInputBundle(runtimeCtx dto.RuntimeCtx) (bundle.Bundle, error) {
controlAttributes := sqlcontrol.GetControlAttributes("standard")
sqlCfg, err := dto.GetSQLBackendCfg(runtimeCtx.SQLBackendCfgRaw)
if err != nil {
return nil, err
Expand All @@ -46,16 +43,15 @@ func BuildInputBundle(runtimeCtx dto.RuntimeCtx) (bundle.Bundle, error) {
if err != nil {
return nil, fmt.Errorf("error unmarshalling auth: %w", err)
}
se, err := buildSQLEngine(sqlCfg, controlAttributes)
se, err := buildSQLEngine(sqlCfg)
if err != nil {
return nil, err
}
namespaces, err := initNamespaces(runtimeCtx.NamespaceCfgRaw, se)
if err != nil {
return nil, err
}
gcCfg, err := dto.GetGCCfg(runtimeCtx.GCCfgRaw)
if err != nil {
if _, err = dto.GetGCCfg(runtimeCtx.GCCfgRaw); err != nil {
return nil, err
}
txnStoreCfg, err := dto.GetKStoreCfg(runtimeCtx.StoreTxnCfgRaw)
Expand All @@ -65,7 +61,6 @@ func BuildInputBundle(runtimeCtx dto.RuntimeCtx) (bundle.Bundle, error) {
system, err := sql_system.NewSQLSystem(
se,
namespaces.GetAnalyticsCacheTableNamespaceConfigurator().GetLikeString(),
controlAttributes,
sqlCfg,
ac, typCfg, runtimeCtx.ExportAlias)
if err != nil {
Expand All @@ -87,11 +82,7 @@ func BuildInputBundle(runtimeCtx dto.RuntimeCtx) (bundle.Bundle, error) {
if err != nil {
return nil, err
}
gcExec, err := buildGCExec(se, namespaces, system, txnStore)
if err != nil {
return nil, err
}
gc := buildGC(gcExec, gcCfg, se)
gc := garbagecollector.NewGarbageCollector(system)
txnCtrMgr, err := getTxnCounterManager(se)
if err != nil {
return nil, err
Expand All @@ -115,7 +106,6 @@ func BuildInputBundle(runtimeCtx dto.RuntimeCtx) (bundle.Bundle, error) {
se,
system,
pgInternal,
controlAttributes,
txnStore,
txnCtrMgr,
ac,
Expand Down Expand Up @@ -154,29 +144,11 @@ func initNamespaces(

func buildSQLEngine(
sqlCfg dto.SQLBackendCfg,
controlAttributes sqlcontrol.ControlAttributes,
) (sqlengine.SQLEngine, error) {
return sqlengine.NewSQLEngine(sqlengine.Config{
DBEngine: sqlCfg.DBEngine, DSN: sqlCfg.GetDSN(), DbInitFilePath: sqlCfg.DbInitFilePath,
InitMaxRetries: sqlCfg.InitMaxRetries, InitRetryInitialDelay: sqlCfg.InitRetryInitialDelay,
}, controlAttributes)
}

func buildGCExec(
sqlEngine sqlengine.SQLEngine,
namespaces tablenamespace.Collection,
system sql_system.SQLSystem,
txnStore kstore.KStore,
) (gcexec.GarbageCollectorExecutor, error) {
return gcexec.GetGarbageCollectorExecutorInstance(sqlEngine, namespaces, system, txnStore)
}

func buildGC(
gcExec gcexec.GarbageCollectorExecutor,
gcCfg dto.GCCfg,
sqlEngine sqlengine.SQLEngine,
) garbagecollector.GarbageCollector {
return garbagecollector.NewGarbageCollector(gcExec, gcCfg, sqlEngine)
})
}

func getTxnCounterManager(sqlEngine sqlengine.SQLEngine) (txncounter.Manager, error) {
Expand Down
Loading
Loading