-
-
Notifications
You must be signed in to change notification settings - Fork 130
Add compact index support for private sources #392
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
base: main
Are you sure you want to change the base?
Add compact index support for private sources #392
Conversation
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.
looking good!
I'm also interested to hear if this gave you any ideas about how we could improve the compact index gem for consumers, so their implementations could potentially be shorter/easier.
8fbeaa2
to
8993ad0
Compare
80b1844
to
0c3e854
Compare
Is there any extra configuration needed to enable this? Wanted to test locally, but see this when trying to bundle install against it:
|
@technicalpickles shouldn't be, what's showing up in the server logs? |
Startup:
During
|
I'll revisit this once there's a version of sqlite for jruby that supports what I used here |
88c97fc
to
6bf4489
Compare
408a581
to
10aeb06
Compare
Hey @segiddins, the jdbc-sqlite3 seems like a long term blocker at this point. Is the performance greatly affected by not having string_agg? I'd be willing to fix it up to see if we can get this in if you don't have time, but I could use some context about that choice. |
It's the only way to get an array out of SQLite unfortunately. I wish we knew what jruby usage was like :/ |
Would it feasible to disable compact index on jruby until the blocker is fixed? That way, non-jruby users would get the benefit. We could also keep a PR open to enable it on jruby, so we have a reminder and/or place to validate fixes. |
CI logs are not reachable anymore. Would you mind to rebase this and update deps? Seems there are some news at jruby/activerecord-jdbc-adapter#1149 (comment). |
10aeb06
to
770c564
Compare
When I was looking closely at JRuby compact index results, they were coming out ordered differently even with identical code (and even aggregated as a separate query with its own sort) so I suspect jdbc-sqlite3 is not behaving identically to cruby's adapters. The order might be because of time field precision differences since we sort by created_at. Just a hunch. |
What do you think of skipping conformance tests for jruby and releasing compact index as experimental on jruby for now? We can see it's passing for most other rubies, and with the conformance tests working, we have a reasonably high confidence that this is a working implementation. We also don't know if anyone runs their gemstash as jruby, but we could wait for feedback to try to diagnose these issues if we find people need it. |
|
||
Sequel.migration do | ||
change do | ||
alter_table :versions do # TODO: backfill info_checksum, sha256, required_ruby_version, required_rubygems_version |
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.
@indirect any thoughts on how best to do this, now that the PR is passing?
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.
Should we add a gemstash update
or gemstash sync
command that would be a standard idempotent way to reindex/update after a new version is released?
Have we done a migration like this before?
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.
yeah, I think a command to migrate
or update
is the way to go, with some docs about how to update to the newer version.
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.
Are we sure we need an explicit command? I found Gemstash::Env.migrate
which handles running migrations. That is called in Gemstash::Env.db
, so basically anytime the db is accessed it is automatically migrated before rturning a connection.
edit: I see now, it's more about the backfill than the migration.
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 suspect we'll need to do something to detect if the backfill has been done, and disable compact indexes with a warning. Tht'd be a good place to tell the user to run a command.
schema.rb
Outdated
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.
- delete
This sounds like a great plan, as I know compact index support would help a lot for our usage of gemstash at Doximity (and we are not on jruby). Also, getting this merged would possibly nudge jruby/genstash users to debug and fix any follow up issues if needed. 😏 |
It's passing on jruby now ;) |
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 small style stuff and calling out boilerplate comments. Looks great.
@auth.check("fetch") | ||
end | ||
|
||
# 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.
Review feedback
end | ||
end | ||
|
||
# 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.
Additional feedback
fetch_from_storage | ||
return result if result | ||
|
||
build_result | ||
store_result | ||
result |
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.
Nit: With a few tweaks and this change you could remove all mentions of @result
and the attr_reader :result
.
fetch_from_storage | |
return result if result | |
build_result | |
store_result | |
result | |
result = fetch_from_storage | |
return result if result | |
result = build_result | |
store_result(result) | |
result |
It also avoids the need to do @result = nil
in the rescue for race condition.
@result = file.read | ||
resource.save("versions.list" => @result) |
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.
...You'd just need to store to a temp var here.
# before | ||
Gemstash::GemPusher.new(auth, read_gem("example", "0.1.0")).serve | ||
# after |
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.
Missing test?
413a113
to
d6dacf3
Compare
This reverts commit 53d6769.
Signed-off-by: Samuel Giddins <[email protected]>
Signed-off-by: Samuel Giddins <[email protected]>
Signed-off-by: Samuel Giddins <[email protected]>
Signed-off-by: Samuel Giddins <[email protected]>
Signed-off-by: Samuel Giddins <[email protected]>
Remove boilerplate comment placeholders from CompactIndexBuilder classes and delete schema.rb file as requested in review comments.
d6dacf3
to
2853517
Compare
Started work on backfil logic over on #412 |
Description:
Ensured working via https://github.com/rubygems/gem_server_conformance
Tasks:
I will abide by the code of conduct.