[SERVER-75039] $out should be able to replace a time-series collection with a non time-series collection Created: 20/Mar/23  Updated: 01/May/23  Resolved: 01/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Gil Alon Assignee: Backlog - Query Integration
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-72687 Support for $out to Time-series colle... Closed
depends on SERVER-74061 Support $out for time-series on secon... Closed
Related
is related to SERVER-73823 Add support for mismatching timeserie... In Code Review
Assigned Teams:
Query Integration
Participants:

 Description   

Support was added in SERVER-72687 for $out to write to time-series collection. Therefore, $out can create time-series collection and will overwrite an existing time-series collection if one exists. However, we can extend this functionality, so $out can replace a non time-series collection if a time-series collection exists in the namespace. 

This was initially discussed in SERVER-74061. A few considerations made this ticket outside the scope of SERVER-74061

  1. We must find a way to rename a view (which is not allowed as of the time writing). This would mean we would either have to change the renameCollection() command, or we would have to drop the view first and then call renameCollection. However, we want to ensure both dropping the view and renaming collection succeed, and that they are done atomically.
  2. It is not obvious what collection options would be passed from creating a non time-series collection from a time-series collections. Usually, $out will forward all collection options to the target collection if the source collection exists. However, options have different meanings and different validations from a non time-series collection and a time-series collection. For example, time-series collections can't have temp nor clusteredIndex but non time-series collections can. Time-series collections can have expireAfterSeconds, but non time-series collections must have a clusteredIndex to have expireAfterSeconds. Additionally, what if a change happens to collection options like a new option is created, or an existing option changes how it is implemented in time-series? Would the $out stage need to be changed every time? If there are conflicting collection options how would we decide which to keep and which to remove for the target collection? An alternative solution would be to drop all the collection options and just create a collection from scratch, but that also changes $out current behavior.


 Comments   
Comment by Gil Alon [ 01/May/23 ]

Closing this as won't fix after conversation with Arun. This ticket would change the fundamental behavior of $out. $out always preserves the existing collection options if the target collection exists. This ticket would change those collection options for time-series collections. We decided not to add this special behavior just for time-series collections.

Comment by Gil Alon [ 28/Mar/23 ]

Note: we are reverting SERVER-72687 soon, since we want to get SERVER-74061 in with it and we don't think we'll be able to get SERVER-74061 in before 7.0, so this ticket should wait until we merge SERVER-72687 back in. [Update] SERVER-74061 is closed, so this ticket is now ready to be worked on.

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