Rushik Subba activity https://gitlab.com/srushik 2026-03-18T05:53:03Z tag:gitlab.com,2026-03-18:5215786323 Rushik Subba closed issue #591562: Create VulnerabilityRead Elastic Preloaders to key by vulnerability_occurrence_id at GitLab.org / GitLab 2026-03-18T05:53:03Z srushik Rushik Subba tag:gitlab.com,2026-03-17:5213059019 Rushik Subba commented on merge request !222790 at GitLab.org / GitLab 2026-03-17T13:57:57Z srushik Rushik Subba

We can make this atomic easily by just using the distributed semaphore abstraction

You mean using in_lock helper? Good idea, when I wrote this I had never used in_lock before. I'll give that a try. Thank you!

tag:gitlab.com,2026-03-17:5212645688 Rushik Subba commented on merge request !222790 at GitLab.org / GitLab 2026-03-17T12:35:32Z srushik Rushik Subba

Right. I tried making the find/create/update operation atomic, but failed in doing so.

tag:gitlab.com,2026-03-17:5212603075 Rushik Subba commented on merge request !222790 at GitLab.org / GitLab 2026-03-17T12:25:31Z srushik Rushik Subba

Yes, this is the reason why I created a single worker to handle all tracked context events, with concurrency handling. Are we seeing any issues?

tag:gitlab.com,2026-03-17:5211959343 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-17T10:03:43Z srushik Rushik Subba

Is vulnerability_reads.uuid always equal to vulnerabilities_findings.uuid

I believe so, uuid for related vulnerability-vulnerability_read-vulnerability_occurrence-security_finding are all same. This is also set during ingestion and is calculated using this service. There are some discussions around how it will change with multiple branch tracking, hence the comment from @schmil.monderer here.

For now we want to keep it similar to the old preloaders.

tag:gitlab.com,2026-03-17:5211922633 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-17T09:56:27Z srushik Rushik Subba

vulnerability_reads will always be associated with an vulnerability_occurrence. This is ensured during ingestion and the table is also backfilled.

https://console.postgres.ai/gitlab/gitlab-production-sec/sessions/49885/commands/148338

tag:gitlab.com,2026-03-17:5211315715 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-17T07:32:54Z srushik Rushik Subba

@dgruzd Can you do the Advanced Search Framework review on this MR please? We are adding separate pre-loaders for the new vulnerability_reads index. The pre-loaders are all the same with some minor changes to the query. These will be used in the new reference class being introduced here. The old pre-loaders will be cleaned up as part of #592421

tag:gitlab.com,2026-03-17:5211054846 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-17T05:52:47Z srushik Rushik Subba

@bala.kumar I've addressed your comments, can you please take a look again.

tag:gitlab.com,2026-03-16:5208237528 Rushik Subba pushed to project branch srushik/create_es_reference_class_for_vulnerability_reads_index at GitLab.org / GitLab 2026-03-16T13:08:10Z srushik Rushik Subba

Rushik Subba (e2ef59ed) at 16 Mar 13:08

Use reference class index method in type class

... and 3833 more commits

tag:gitlab.com,2026-03-16:5207723003 Rushik Subba commented on merge request !220047 at GitLab.org / GitLab 2026-03-16T11:12:49Z srushik Rushik Subba

suggestion: I think we can have a common CustomAttributePolicy parent class and inherit the rules from it in other classes? wdyt?

tag:gitlab.com,2026-03-16:5207398117 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-16T10:02:41Z srushik Rushik Subba

@bala.kumar I created new preloaders now which should isolate any risks with old index now.

@schmil.monderer Would appreciate another look from you 🙇

tag:gitlab.com,2026-03-16:5207357218 Rushik Subba pushed to project branch srushik/modify_es_vuln_preloaders_to_index_by_occurrence_id at GitLab.org / GitLab 2026-03-16T09:53:53Z srushik Rushik Subba

Rushik Subba (40578357) at 16 Mar 09:53

Add ES preloaders for vulnerability_reads index

... and 1036 more commits

tag:gitlab.com,2026-03-16:5207185471 Rushik Subba closed issue #593120: Follow-up from "Change vulnerability ES preloaders to use occurrence_id" at GitLab.org / GitLab 2026-03-16T09:16:14Z srushik Rushik Subba tag:gitlab.com,2026-03-16:5207151081 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-16T09:08:09Z srushik Rushik Subba

@bala.kumar I thought of this too, but if you look closely at this -

@records_map = {
  vulnerability_occurrence_id: @records.map(&:vulnerability_occurrence_id),
  project_id: @records.map(&:project_id).uniq,
  vulnerability_id: @records.map(&:vulnerability_id).uniq
}

We will be running map 3 times on each and every preloader class initialization, which isn't required. So I kept it so that each class has its own mapping and is done exactly once per class.

tag:gitlab.com,2026-03-16:5206905983 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-16T08:04:57Z srushik Rushik Subba

@bala.kumar Then I think creating new preloaders for the new index index and not touching the old index would be simpler. wdyt?

tag:gitlab.com,2026-03-13:5200921426 Rushik Subba commented on merge request !221673 at GitLab.org / GitLab 2026-03-13T11:26:31Z srushik Rushik Subba

@bwill I ran a query on postgres.ai to test whether we have reads associated with multiple tracked contexts for a given project -

select id,
    project_id,
    exists (
        select 1 from vulnerability_reads vr where vr.project_id = sptc.project_id and vr.security_project_tracked_context_id = sptc.id
    ) has_vulnerability_reads
from security_project_tracked_contexts sptc
where project_id in (
    select project_id from security_project_tracked_contexts group by project_id having count (*) > 1 limit 100
);
And it does seem to be the case

Screenshot_2026-03-13_at_4.52.35_PM

Now I'm wondering whether we should delete the data associated with duplicate contexts instead of migrating 🤔 @Quintasan

tag:gitlab.com,2026-03-13:5200224815 Rushik Subba commented on merge request !225631 at GitLab.org / GitLab 2026-03-13T08:40:47Z srushik Rushik Subba

Note: sbom_occurrences_vulnerabilities table is not backfilled with vulnerability_occurrence_id yet. So we first check if occurrences by occ id exist, if not we fallback to occurrences by vulnerability id.

tag:gitlab.com,2026-03-13:5200123226 Rushik Subba pushed to project branch srushik/idx_sbom_occurrences_vulnerabilities_on_vuln_occ_id at GitLab.org / GitLab 2026-03-13T08:12:17Z srushik Rushik Subba

Rushik Subba (6f0b1122) at 13 Mar 08:12

Add index on vuln_occ_id on sbom_occurrence_vulnerabilities

... and 653 more commits

tag:gitlab.com,2026-03-13:5200120983 Rushik Subba commented on merge request !226878 at GitLab.org / GitLab 2026-03-13T08:11:37Z srushik Rushik Subba

@Quintasan , would you be able to get to this today? This is blocking my other MR. If you are busy, I can pass it someone else.

tag:gitlab.com,2026-03-13:5199995055 Rushik Subba commented on merge request !226211 at GitLab.org / GitLab 2026-03-13T07:31:32Z srushik Rushik Subba

@julie_huang Thanks! database looks to me.

@abdwdd Can you do the database maintainer review on this MR?