镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Schema migration deletes internal indexes created at startup #10837

Closed

Description

@Moumouls

New Issue Checklist

Issue Description

At startup, performInitialization creates internal indexes, then updateSchemaWithIndexes() copies them into _SCHEMA. DefinedSchemas then deletes every index that is absent from the local schema and absent from isProtectedIndex. keepUnknownIndexes is false by default.

username_1, email_1, case_insensitive_username, case_insensitive_email, name_1 (_Role) and reqId_1 (_Idempotency) are protected. Indexes added later are not:

  • _User / _email_verify_token
  • _User / _perishable_token
  • _User / _auth_data_<provider>_id
  • _Idempotency / ttl

Two instances that boot at the same time (Cloud Run, several containers) both try to drop the same index. The first drop succeeds. The second receives MongoServerError: index not found with name [_email_verify_token] (Mongo code 27, IndexNotFound). In production, after 3 retries, Parse Server calls process.exit(1). Retries do not recover: getAllClasses() serves the cached schema, which still contains the index.

With a single instance, boot succeeds and the index is then destroyed. Email verification and password reset queries scan _User.

Steps to reproduce

  1. Run Parse Server with a schema migration (schema.definitions) that includes _User and does not list the internal indexes above. Leave keepUnknownIndexes unset.
  2. Start the server so performInitialization creates _email_verify_token and updateSchemaWithIndexes() stores it in _SCHEMA.
  3. Start a second instance at the same time, or restart once so the migration sees the index in the cloud schema.
  4. Observe the migration drop _email_verify_token. The second concurrent drop fails with Mongo code 27.

Actual Outcome

The migration deletes internal indexes created at startup. A concurrent boot fails with MongoServerError: index not found with name [_email_verify_token] (code 27). After 3 retries the process exits in production. Email verification and password reset queries no longer use those indexes.

Expected Outcome

Internal indexes created at startup stay in place. Dropping an index that another instance already dropped is treated as success.

Environment

Server

  • Parse Server version: 9.10.1-alpha.15 (still present on alpha as of 27 October 2026, 9.10.7)
  • Operating system: Linux
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud Run

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: MongoDB
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): n/a
  • SDK version: n/a

Logs

MongoServerError: index not found with name [_email_verify_token]

Mongo error code 27 (IndexNotFound).

Activity

  1. parse-github-assistant commented on Oct 27, 2026

    @parse-github-assistant

    🚀 Thanks for opening this issue!

    ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

  2. parseplatformorg commented on Nov 3, 2026

    @parseplatformorg
    Contributor

    🎉 This change has been released in version 9.11.0-alpha.2

  3. parseplatformorg commented on Nov 3, 2026

    @parseplatformorg
    Contributor

    🎉 This change has been released in version 9.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions