[SERVER-77003] Allow renames of time-series collection buckets Created: 10/May/23  Updated: 29/Oct/23  Resolved: 05/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc6, 6.0.9

Type: Task Priority: Major - P3
Reporter: Felipe Gasper Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
causes SERVER-78494 listCollections expects a renamed tim... Closed
Related
related to SERVER-77261 Server allows renaming a “normal” col... Open
is related to SERVER-75651 Exhaustively identify internal namesp... Open
is related to SERVER-68383 Allow DDL operations directly on buck... Closed
Assigned Teams:
Server Security
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0, v6.3, v6.0
Sprint: Execution Team 2023-05-29, Security 2023-06-12
Participants:
Linked BF Score: 124

 Description   

Mongosync maintains an internal mapping of source & destination collection UUIDs. Because we can’t update that mapping atomically with creating the collection, mongosync does the following:

  • Create the destination collection using a temporary name: mongosync.tmp.$srcUUID
  • Update mongosync’s UUID map.
  • Rename the destination collection (preserving its UUID).

The rationale is that, if mongosync goes down at any point in the above workflow, the failure is recoverable.

Time-series collections don’t presently seem to work with this workflow because they can’t be renamed—either the “aggregate” collection (view + bucket) or the internal bucket collection. (We can create & drop buckets directly, but not rename them.)

If I’m understanding everything about this properly, then, it would seem that mongosync requires some way to rename time-series collections—or at least their buckets—in order to support these collections.

For C2C’s purposes it should suffice to ensure the user has setUserWriteBlockMode authorization.



 Comments   
Comment by Githook User [ 13/Jul/23 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-77003 Allow renames of time-series collection buckets

(cherry picked from commit cb682808986eda96da8ad94433d5c6cc02434561)
Branch: v6.0
https://github.com/mongodb/mongo/commit/6a7ded52a454144d4a4a48b56d5db9b070908a32

Comment by Githook User [ 29/Jun/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: Revert "SERVER-77003 Allow renames of time-series collection buckets"

This reverts commit 721098ff45959f6e283636f4f5a8d2341e177f47.
Branch: v6.0
https://github.com/mongodb/mongo/commit/2ffc5b8e89ed4a7af49bbd1ed9aec502c8f0eae0

Comment by Githook User [ 21/Jun/23 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-77003 Allow renames of time-series collection buckets
Branch: v6.0
https://github.com/mongodb/mongo/commit/721098ff45959f6e283636f4f5a8d2341e177f47

Comment by Githook User [ 21/Jun/23 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-77003 Allow renames of time-series collection buckets
Branch: v7.0
https://github.com/mongodb/mongo/commit/cb682808986eda96da8ad94433d5c6cc02434561

Comment by Githook User [ 05/Jun/23 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-77003 Allow renames of time-series collection buckets
Branch: master
https://github.com/mongodb/mongo/commit/f820033ac85d79c3d5b1f673fd1f3e2adc19fdb2

Comment by Felipe Gasper [ 10/May/23 ]

Context:
Bucket collections can be created manually, with the relevant `timeseries` parameter:

> db.runCommand({create: "system.buckets.manual", timeseries: { metaField: "metadata", timeField: "timestamp" } })
 
> show tables
system.buckets.manual
 
> db.getCollectionInfos()
[
  {
    name: 'system.buckets.manual',
    type: 'collection',
    options: { timeseries: { timeField: 'timestamp', metaField: 'metadata' } },
    info: {
      readOnly: false,
      uuid: new UUID("14415910-9605-4fc7-8d44-b90ac1fd09e5")
    },
    idIndex: { v: 2, key: { _id: 1 }, name: '_id_' }
  }
]

… but renaming is forbidden, even when there’s no view.

The view can then also be created on its own, thus:

> db.createView("manual", "system.buckets.manual", [ { '$_internalUnpackBucket': { timeField: 'timestamp', metaField: 'metadata', bucketMaxSpanSeconds: 3600 } }])
{ ok: 1 }

Comment by Felipe Gasper [ 10/May/23 ]

SERVER-68383 may have meant to implement this, but it doesn’t seem to work.

Generated at Thu Feb 08 06:34:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.