Skip to content
代码片段 群组 项目
该项目从 https://gitlab.com/gitlab-org/gitlab.git 镜像。 拉取镜像更新于
  1. 6月 22, 2023
  2. 5月 31, 2023
    • Kamil Trzciński's avatar
      Cells: Store databases and gitlab schema configuration in YAML · f027557f
      Kamil Trzciński 创作于
      The purpose of this change is to provide a better and more structured
      way to define `gitlab_schemas` and `database_connections`.
      
      This helps to define applied behavior for connections,
      and what schemas the connection holds, and how those
      are configured (load balancing, etc.).
      
      - Each DB and schema is named, and contains description.
      - Remove code duplication in `gitlab_schema` EE specs
      - Make `Database.db_config_names` to require passing `gitlab_schema`
        to ensure that we return configs only having this schema
      - Ensure that database connection order is the same
        as in `config/database.yml`
      
      Changelog: added
      f027557f
  3. 5月 18, 2023
    • Simon Tomlinson's avatar
      Fix migration specs leaving rows after running · 3d21e79f
      Simon Tomlinson 创作于
      Rather than using transactional tests, migration testing migrates the
      database up after each test, and manually cleans each table.
      
      This could pollute rows into the postgres_async_foreign_key_validations
      table during a test run, since migrating up happened after cleaning all
      tables.
      
      Instead, clean tables after migrating to delete these rows.
      3d21e79f
  4. 3月 27, 2023
  5. 3月 21, 2023
  6. 2月 06, 2023
    • Dylan Griffith's avatar
      Add MainClusterwide::ApplicationRecord and new connection · 20c78598
      Dylan Griffith 创作于
      Adds a new `main_clusterwide` connection option that can be configured
      in `config/database.yml`. This connection is part of the
      [Pods](https://gitlab.com/groups/gitlab-org/-/epics/7582) initiative
      (soon to be renamed to "Silos").
      
      This connection won't be configured in production or even GDK any time
      soon and as such we've opted to have these code paths untested in CI.
      Trying to test this new connection in CI would mean having a separate
      `config/database.yml` that ran all RSpec tests again which is just too
      expensive for this early stage of the project.
      
      The `main_clusterwide` connection will eventually be used to have a
      shared Postgres database that is used by many separate GitLab pods
      (silos/instances). We need to share some data like settings, users,
      licenses across all these pods while separating pod-specific data like
      projects, notes, merge_requests . This allows us to horizontally scale
      most of the data but still users can login and access data in any pod.
      
      When this connection is not configured then the `main` connection will
      be used (as before) so this change should be a no-op for anyone that
      doesn't explicitly go in and add `main_clusterwide` to their
      `config/database.yml`.
      
      There is a lot more detail on the architecture at
      https://docs.gitlab.com/ee/architecture/blueprints/pods/ but the main
      point is that this connection is for "shared" stuff and we're starting
      with `application_settings` and `licenses` as these are the simplest
      tables to decouple.
      
      Changelog: other
      20c78598
  7. 1月 27, 2023
  8. 10月 27, 2022
  9. 10月 23, 2022
  10. 10月 20, 2022
    • Omar Qunsul's avatar
      Ensure schemas are up-to-date after migration tests complete · 673e6eca
      Omar Qunsul 创作于
      If a CI migration leaves the database behind the current database
      schema, we need to ensure that the schema is brought up-to-date after
      the migrations run to prevent other tests from starting from an
      inconsistent state.
      
      This commit consolidates the database cleanup for multiple databases
      by ensuring:
      
      1. After a migration context is complete, either recreate the
      databases (if the number of columns approaches the max) or migrate all
      the schemas back to the latest and drop all data from both databases.
      
      2. After a migration example runs, delete any leftover data for that
      specific database.  If a CI migration leaves the database behind the
      current database schema, we need to ensure that the schema is brought
      up-to-date after the migrations run to prevent putting other tests in
      an inconsistent state.
      
      Related MR:
      https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100233
      
      Closes https://gitlab.com/gitlab-org/gitlab/-/issues/377796
      
      
      
      Changelog: fixed
      Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
      673e6eca
  11. 10月 19, 2022
  12. 10月 15, 2022
    • Omar Qunsul's avatar
      Ensure schemas are up-to-date after migration tests complete · a93da703
      Omar Qunsul 创作于
      If a CI migration leaves the database behind the current database
      schema, we need to ensure that the schema is brought up-to-date after
      the migrations run to prevent other tests from starting from an
      inconsistent state.
      
      This commit consolidates the database cleanup for multiple databases
      by ensuring:
      
      1. After a migration context is complete, either recreate the
      databases (if the number of columns approaches the max) or migrate all
      the schemas back to the latest and drop all data from both databases.
      
      2. After a migration example runs, delete any leftover data for that
      specific database.  If a CI migration leaves the database behind the
      current database schema, we need to ensure that the schema is brought
      up-to-date after the migrations run to prevent putting other tests in
      an inconsistent state.
      
      Related MR:
      https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100233
      
      Closes https://gitlab.com/gitlab-org/gitlab/-/issues/377796
      
      Changelog: fixed
      a93da703
  13. 9月 29, 2022
    • Stan Hu's avatar
      Ensure PostgreSQL versions are memoized at start of tests · 3a83e8e2
      Stan Hu 创作于
      Some GitLab classes, such as `Gitlab::Database::AsWithMaterialized`,
      need to check the PostgreSQL version to determine whether certain
      keywords can be used. We have some specs that specify exact query
      types or check for N+1 queries that might be thrown off by an extra
      `SELECT VERSION()` call. To ensure this doesn't happen, retrieve the
      version at the beginning of the test.
      
      Note that the initializer `config/initializers/1_postgresql_only.rb`
      already attempts to check the PostgreSQL version, but the result isn't
      memoized properly for callers that use
      `ApplicationRecord.database.version`.
      
      This came up in
      https://gitlab.com/gitlab-org/gitlab/-/merge_requests/99097#note_1118427731.
      
      Changelog: changed
      3a83e8e2
  14. 7月 20, 2022
  15. 11月 22, 2021
  16. 11月 19, 2021
    • pbair's avatar
      Only mock ci connections in single db mode · 6eeb7b3e
      pbair 创作于
      Change `mock_ci_connection` to only setup a mocked
      `Ci::ApplicationRecord` connection when running in a single database
      mode. When running with multiple databases, we can use the actual
      `Ci::ApplicationRecord` connection.
      6eeb7b3e
  17. 11月 17, 2021
  18. 11月 10, 2021
  19. 9月 23, 2021
  20. 9月 15, 2021
加载中