- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
          [Failure store] Remove ::* selector
          #121900
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            gmarouli
  merged 9 commits into
  elastic:main
from
gmarouli:failure-store/remove-star-selector
  
      
      
   
  Feb 12, 2025 
      
    
  
     Merged
                    Changes from 6 commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      07f629e
              
                Remove `::*` selector
              
              
                gmarouli 9141e64
              
                Fix invalid selector message.
              
              
                gmarouli 2408bac
              
                Fixing details
              
              
                gmarouli a5d6fce
              
                Merge branch 'main' into failure-store/remove-star-selector
              
              
                gmarouli 0fb2f93
              
                Remove todos
              
              
                gmarouli e4d03a2
              
                Merge branch 'main' into failure-store/remove-star-selector
              
              
                gmarouli e4754ca
              
                Merge branch 'main' into failure-store/remove-star-selector
              
              
                gmarouli 0d71d48
              
                Merge branch 'main' into failure-store/remove-star-selector
              
              
                gmarouli acf7db6
              
                Merge branch 'main' into failure-store/remove-star-selector
              
              
                gmarouli File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -9,6 +9,7 @@ | |
| 
     | 
||
| package org.elasticsearch.action.support; | ||
| 
     | 
||
| import org.elasticsearch.TransportVersions; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.common.io.stream.Writeable; | ||
| 
        
          
        
         | 
    @@ -23,14 +24,11 @@ | |
| * We define as index components the two different sets of indices a data stream could consist of: | ||
| * - DATA: represents the backing indices | ||
| * - FAILURES: represent the failing indices | ||
| * - ALL: represents all available in this expression components, meaning if it's a data stream both backing and failure indices and if it's | ||
| * an index only the index itself. | ||
| * Note: An index is its own DATA component, but it cannot have a FAILURE component. | ||
| */ | ||
| public enum IndexComponentSelector implements Writeable { | ||
| DATA("data", (byte) 0), | ||
| FAILURES("failures", (byte) 1), | ||
| ALL_APPLICABLE("*", (byte) 2); | ||
| FAILURES("failures", (byte) 1); | ||
| 
     | 
||
| private final String key; | ||
| private final byte id; | ||
| 
          
            
          
           | 
    @@ -75,7 +73,13 @@ public static IndexComponentSelector getByKey(String key) { | |
| } | ||
| 
     | 
||
| public static IndexComponentSelector read(StreamInput in) throws IOException { | ||
| return getById(in.readByte()); | ||
| byte id = in.readByte(); | ||
| if (in.getTransportVersion().onOrAfter(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR)) { | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More versions will be added here when it gets backported.  | 
||
| return getById(id); | ||
| } else { | ||
| // Legacy value ::*, converted to ::data | ||
| return id == 2 ? DATA : getById(id); | ||
| } | ||
| } | ||
| 
     | 
||
| // Visible for testing | ||
| 
        
          
        
         | 
    @@ -95,10 +99,10 @@ public void writeTo(StreamOutput out) throws IOException { | |
| } | ||
| 
     | 
||
| public boolean shouldIncludeData() { | ||
| return this == ALL_APPLICABLE || this == DATA; | ||
| return this == DATA; | ||
| } | ||
| 
     | 
||
| public boolean shouldIncludeFailures() { | ||
| return this == ALL_APPLICABLE || this == FAILURES; | ||
| return this == FAILURES; | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unlikely scenario but could we ever end up in a place where a new selector added here could collide with the old
::*value in a mixed cluster?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.... Interesting thought. Thinking out loud because this is a tough cookie.
If we implement this the way it's now and backport it back to
8.18and8.x.We can remove this backwards compatibility code from
9.x; because you always have to go through the8.lastversion.8.lastwill never propagate this selector because it matches it to::dataand this selector is never persisted anywhere, I think. Furthermore, there is no CCR or CCS supported yet. Right?This means that if we ever introduced
::*in9+we could distinguish the two. Right?