case class Protocol extends Action with TableFeatureSupport with Product with Serializable
Used to block older clients from reading or writing the log when backwards incompatible changes are made to the protocol. Readers and writers are responsible for checking that they meet the minimum versions before performing any other operations.
This action allows us to explicitly block older clients in the case of a breaking change to the protocol. Absent a protocol change, Clients MUST silently ignore messages and fields that they do not understand.
Note: Please initialize this class using the companion object's apply method, which will
assign correct values (Set() vs None) to readerFeatures and writerFeatures.
- Alphabetic
- By Inheritance
- Protocol
- Serializable
- Product
- Equals
- TableFeatureSupport
- Action
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def canDowngradeTo(to: Protocol, droppedFeatureName: String): Boolean
Determine whether this protocol can be safely downgraded to a new protocol
to.Determine whether this protocol can be safely downgraded to a new protocol
to. This includes the following:- The current protocol needs to support at least writer features. This is because protocol downgrade is only supported with table features.
- The protocol version can only be downgraded when there are no non-legacy table features.
- We can only remove one feature at a time.
- When downgrading protocol versions, the resulting versions must support exactly the same set of legacy features supported by the current protocol.
Note, this not an exhaustive list of downgrade rules. Rather, we check the most important downgrade invariants. We also perform checks during feature removal at AlterTableDropFeatureDeltaCommand.
- Definition Classes
- TableFeatureSupport
- def canTransitionTo(to: Protocol, op: Operation): Boolean
True if this protocol can be upgraded or downgraded to the 'to' protocol.
True if this protocol can be upgraded or downgraded to the 'to' protocol.
- Definition Classes
- TableFeatureSupport
- def canUpgradeTo(to: Protocol): Boolean
Determine whether this protocol can be safely upgraded to a new protocol
to.Determine whether this protocol can be safely upgraded to a new protocol
to. This means:- this protocol has reader protocol version less than or equals to
to. - this protocol has writer protocol version less than or equals to
to. - all features supported by this protocol are supported by
to.
Examples regarding feature status:
- from
[appendOnly]to[appendOnly]=> allowed - from
[appendOnly, changeDataFeed]to[appendOnly]=> not allowed - from
[appendOnly]to[appendOnly, changeDataFeed]=> allowed
- Definition Classes
- TableFeatureSupport
- this protocol has reader protocol version less than or equals to
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def downgradeProtocolVersionsIfNeeded: Protocol
If the current protocol does not contain any non-legacy table features and the remaining set of legacy table features exactly matches a legacy protocol version, it downgrades the protocol to the minimum reader/writer versions required to support the protocol's legacy features.
If the current protocol does not contain any non-legacy table features and the remaining set of legacy table features exactly matches a legacy protocol version, it downgrades the protocol to the minimum reader/writer versions required to support the protocol's legacy features.
Note, when a table is initialized with table features (3, 7), by default there are no legacy features. After we remove the last native feature we downgrade the protocol to (1, 1).
- Definition Classes
- TableFeatureSupport
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- lazy val implicitlyAndExplicitlySupportedFeatures: Set[TableFeature]
Get all features that are supported by this protocol, implicitly and explicitly.
Get all features that are supported by this protocol, implicitly and explicitly. When the protocol supports table features, this method returns the same set of features as readerAndWriterFeatureNames; when the protocol does not support table features, this method becomes equivalent to implicitlySupportedFeatures.
- Definition Classes
- TableFeatureSupport
- Annotations
- @JsonIgnore()
- lazy val implicitlySupportedFeatures: Set[TableFeature]
Get all features that are implicitly supported by this protocol, for example,
Protocol(1,2)implicitly supportsappendOnlyandinvariants.Get all features that are implicitly supported by this protocol, for example,
Protocol(1,2)implicitly supportsappendOnlyandinvariants. When this protocol is capable of requiring writer features, no feature can be implicitly supported.- Definition Classes
- TableFeatureSupport
- Annotations
- @JsonIgnore()
- def isFeatureSupported(feature: TableFeature): Boolean
Check if a
featureis supported by this protocol.Check if a
featureis supported by this protocol. This means either (a) the protocol does not support table features and implicitly supports the feature, or (b) the protocol supports table features and references the feature.- Definition Classes
- TableFeatureSupport
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def json: String
- Definition Classes
- Action
- def merge(others: Protocol*): Protocol
Merge this protocol with multiple
protocolsto have the highest reader and writer versions plus all explicitly and implicitly supported features.Merge this protocol with multiple
protocolsto have the highest reader and writer versions plus all explicitly and implicitly supported features.- Definition Classes
- TableFeatureSupport
- val minReaderVersion: Int
- val minWriterVersion: Int
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- lazy val readerAndWriterFeatureNames: Set[String]
Get a set of all feature names in this protocol's
readerFeaturesandwriterFeaturesfield.Get a set of all feature names in this protocol's
readerFeaturesandwriterFeaturesfield. Returns an empty set when this protocol supports none of reader and writer features.- Definition Classes
- TableFeatureSupport
- Annotations
- @JsonIgnore()
- lazy val readerAndWriterFeatures: Seq[TableFeature]
Same as above but returns a sequence of TableFeature instead of a set of feature names.
Same as above but returns a sequence of TableFeature instead of a set of feature names.
- Definition Classes
- TableFeatureSupport
- Annotations
- @JsonIgnore()
- def readerFeatureNames: Set[String]
Get all feature names in this protocol's
readerFeaturesfield.Get all feature names in this protocol's
readerFeaturesfield. Returns an empty set when this protocol does not support reader features.- Definition Classes
- TableFeatureSupport
- val readerFeatures: Option[Set[String]]
- def removeFeature(targetFeature: TableFeature): Protocol
Remove feature wrapper for removing either Reader/Writer or Writer features.
Remove feature wrapper for removing either Reader/Writer or Writer features. We assume the feature exists in the protocol. There is a relevant validation at AlterTableDropFeatureDeltaCommand. We also require targetFeature is removable.
When the feature to remove is the last explicit table feature of the table we also remove the TableFeatures feature and downgrade the protocol.
- Definition Classes
- TableFeatureSupport
- lazy val simpleString: String
Return a reader-friendly string representation of this Protocol.
Return a reader-friendly string representation of this Protocol.
Returns the protocol versions and referenced features when the protocol does support table features, such as
3,7,{},{appendOnly}and2,7,None,{appendOnly}. Otherwise returns only the protocol version such as2,6.- Annotations
- @JsonIgnore()
- def supportsReaderFeatures: Boolean
Check if this protocol is capable of adding features into its
readerFeaturesfield.Check if this protocol is capable of adding features into its
readerFeaturesfield.- Definition Classes
- TableFeatureSupport
- def supportsWriterFeatures: Boolean
Check if this protocol is capable of adding features into its
writerFeaturesfield.Check if this protocol is capable of adding features into its
writerFeaturesfield.- Definition Classes
- TableFeatureSupport
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Protocol → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withFeature(feature: TableFeature): Protocol
Get a new Protocol object that has
featuresupported.Get a new Protocol object that has
featuresupported. Writer-only features will be added towriterFeaturesfield, and reader-writer features will be added toreaderFeaturesandwriterFeaturesfields.If
featureis already implicitly supported in the current protocol's legacy reader or writer protocol version, the new protocol will not modify the original protocol version, i.e., the feature will not be explicitly added to the protocol'sreaderFeaturesorwriterFeatures. This is to avoid unnecessary protocol upgrade for feature that it already supports.- Definition Classes
- TableFeatureSupport
- def withFeatures(features: Iterable[TableFeature]): Protocol
Get a new Protocol object with multiple features supported.
Get a new Protocol object with multiple features supported.
See the documentation of withFeature for more information.
- Definition Classes
- TableFeatureSupport
- def wrap: SingleAction
- def writerFeatureNames: Set[String]
Get a set of all feature names in this protocol's
writerFeaturesfield.Get a set of all feature names in this protocol's
writerFeaturesfield. Returns an empty set when this protocol does not support writer features.- Definition Classes
- TableFeatureSupport
- val writerFeatures: Option[Set[String]]