-
Notifications
You must be signed in to change notification settings - Fork 127
Feature/partitions #455
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
Feature/partitions #455
Conversation
cmd/gitbase/command/server.go
Outdated
| DisableSquash bool `long:"no-squash" description:"Disables the table squashing."` | ||
| TraceEnabled bool `long:"trace" env:"GITBASE_TRACE" description:"Enables jaeger tracing"` | ||
| ReadOnly bool `short:"r" long:"readonly" description:"Only allow read queries. This disables creating and deleting indexes as well." env:"GITBASE_READONLY"` | ||
| Parallelism uint `long:"parallelism" default:"4" description:"Maximum number of parallel threads per table."` |
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.
maybe default GOMAXPROCS
| func NewDatabaseEngine( | ||
| readonly bool, | ||
| version string, | ||
| parallelism int, |
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.
uint?
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.
Only needs to be uint in the flag, so the user can't input less than 0, after that it doesn't matter
| ab = ab.ReadOnly() | ||
| } | ||
|
|
||
| if parallelism > 1 { |
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.
maybe 0 means by default, 1 - no parallelize
| if len(i.repos) == 0 || stringContains(i.repos, repo.ID) { | ||
| var err error | ||
| commits, err = NewCommitsByHashIter(repo, i.commitHashes) | ||
| var commitTreesHashIdx = CommitTreesSchema.IndexOf("commit_hash", CommitTreesTableName) |
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.
why it's a package var? Can be a function?
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.
Because this value will be used in other functions
mcarmonaa
left a comment
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.
I like how the new interfaces make simpler the table's implementation.
Apart from the questions, LGTM
| func (r *blobsTable) TransformUp(f sql.TransformNodeFunc) (sql.Node, error) { | ||
| return f(r) | ||
| func (r *blobsTable) WithFilters(filters []sql.Expression) sql.Table { | ||
| nt := *r |
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.
I've seen this in the rest of the tables too, why can't r be used directly?
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.
Because it returns a new instance. By deref-ing the table, it makes a copy, so we don't have to manually create a table with all the fields, just modify the ones needed in the copy and return it as a pointer.
If in the future the table has more fields, we don't have to go to these methods and add the fields to the new instance.
commit_blobs.go
Outdated
| func (t *commitBlobsTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return t, nil | ||
| func (t *commitBlobsTable) WithProjection(colNames []string) sql.Table { | ||
| return t |
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.
doesn't accept this table pushdowns of projections?
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.
Nope, only blobs and files, which don't read the blob if the blob_content is not pushed down
commit_files.go
Outdated
| func (t *commitFilesTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return t, nil | ||
| func (t *commitFilesTable) WithProjection(colNames []string) sql.Table { | ||
| return t |
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.
doesn't accept this table pushdowns of projections?
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.
same answer
commit_trees.go
Outdated
| func (t *commitTreesTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return t, nil | ||
| func (t *commitTreesTable) WithProjection(colNames []string) sql.Table { | ||
| return t |
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.
doesn't accept this table pushdowns of projections?
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.
same answer
commits.go
Outdated
|
|
||
| return sql.NewSpanIter(span, repoIter), nil | ||
| func (r *commitsTable) WithProjection(colNames []string) sql.Table { | ||
| return r |
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.
doesn't accept this table pushdowns of projections?
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.
same answer
ref_commits.go
Outdated
| func (t *refCommitsTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return t, nil | ||
| func (t *refCommitsTable) WithProjection(colNames []string) sql.Table { | ||
| return t |
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.
doesn't accept this table pushdowns of projections?
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.
same answer
references.go
Outdated
| func (r *referencesTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return r, nil | ||
| func (r *referencesTable) WithProjection(colNames []string) sql.Table { | ||
| return r |
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.
doesn't accept this table pushdowns of projections?
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 could maybe just remove this methods so the tables don't implement ProjctedTable
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.
@erizocosmico yep, that is a good idea.
remotes.go
Outdated
| func (r *remotesTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { | ||
| return r, nil | ||
| func (r *remotesTable) WithProjection(colNames []string) sql.Table { | ||
| return r |
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.
doesn't accept this table pushdowns of projections?
repositories.go
Outdated
|
|
||
| return sql.NewSpanIter(span, rowRepoIter), nil | ||
| func (r *repositoriesTable) WithProjection(colNames []string) sql.Table { | ||
| return r |
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.
doesn't accept this table pushdowns of projections?
tree_entries.go
Outdated
|
|
||
| return sql.NewSpanIter(span, repoIter), nil | ||
| func (r *treeEntriesTable) WithProjection(colNames []string) sql.Table { | ||
| return r |
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.
doesn't accept this table pushdowns of projections?
|
@erizocosmico I would say to remove all the table methods that are not being used (WithFilter, WithProjects and so on). The new API is modular and we don't need them if the table is not making use of them. |
|
Only |
|
Done @ajnavarro @mcarmonaa |
|
Changed the default parallelism @kuba-- |
|
Tests will pass once src-d/go-mysql-server#345 is merged and go-mysql-server upgraded. |
|
Tests should be passing now |
ajnavarro
left a comment
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.
There are some problems regarding the usage of partitions and join pushdown. Per example, this query:
SELECT count(*) FROM commits c NATURAL JOIN ref_commits r WHERE r.ref_name = 'HEAD';
It's using exchange nodes, but the pushdown node disappear compared to the previous version.
|
Just fixed the issue with the exchanges and the squashed tables |
|
More bugs found: Results are not the same: Result of |
|
@erizocosmico can you rebase and update go-mysql-server with the new fixes please? |
|
yup |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
Rebased and upgraded |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
@ajnavarro I cannot reproduce the discrepancy in results with the query you gave me. Can you try again now to see if this was maybe fixed by the update of go-mysql-server? |
|
@erizocosmico having the same problem. I'm using |
|
@ajnavarro with or without indexes? |
|
@erizocosmico without indexes. |
|
I thought I had reproduced this but turns out the discrepancy was because I was running the old one on So, still can't reproduce this running it over all my Are you running both or the result of the old version is what you got when you ran it back then? |
ajnavarro
left a comment
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.
all bugs resolved.
Closes #450