Skip to content
  • @mkozono Could you please guide to resolve below error?

    irb(main):003:0> service = Geo::ChecksumRecalculationService.new(::Geo::PackageFileReplicator, seconda
    ry_geo_node: secondary_node)
    (irb):3:in `<main>': uninitialized constant Geo::ChecksumRecalculationService (NameError)
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/commands/console/console_command.rb:74:in `start'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/commands/console/console_command.rb:19:in `start'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/commands/console/console_command.rb:106:in `perform'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/command/base.rb:87:in `perform'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/command.rb:48:in `invoke'
            from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/railties-7.0.8.6/lib/rails/commands.rb:18:in `<top (required)>'
            from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
            from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
            from bin/rails:4:in `<main>'
    Edited by SaravanakumarSakthivel
  • Could you please add the step to deploy the service? Where we should place recalculate_stale_checksums.rb?

  • Developer

    I realise what I had overlooked here - you can either paste the contents of recalculate_stale_checksums.rb before running the snippet code or even better, put it on disk, and call it with gitlab-rails runner. It will need to be readable by the git user, then:

    gitlab-rails c
    [...]
    load '/var/opt/gitlab/recalculate_stale_checksums.rb'
    Edited by Tony Marsh
  • Developer

    @mkozono we've been trying to get this snippet to work on an instance running 18.2.7, but for some reason the GraphQL query is always returning empty. If we manually execute the query using graphql-explorer directly on the Secondary site, it does return the expected results.

    On the Primary rails console though, we're getting:

    irb(main):005> secondary_node.name
    => "secondary_name"
    irb(main):006> service = Geo::ChecksumRecalculationService.new(::Geo::PackageFileReplicator, secondary_geo_node: secondary_node)
    =>
    #<Geo::ChecksumRecalculationService:0x00007f9ccf9f4750
    ...
    irb(main):007> service.validate_secondary_node
    Using secondary site: secondary_name
    => true
    irb(main):008> ids = service.get_file_ids_with_checksum_mismatch.fetch(:ids)
    Querying secondary site for packageFileRegistries with sync failures...
    Error: Unexpected response structure. Missing packageFileRegistries data.
    Response: {"data"=>{"geoNode"=>nil}}
    => []
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment