Skip to content
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

Make max frame length configurable #1358

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ object DefaultConnectionFactory extends CassandraConnectionFactory {
.withInt(MultipleRetryPolicy.MaxRetryCount, conf.queryRetryCount)
.withDuration(DseDriverOption.CONTINUOUS_PAGING_TIMEOUT_FIRST_PAGE, Duration.ofMillis(conf.readTimeoutMillis))
.withDuration(DseDriverOption.CONTINUOUS_PAGING_TIMEOUT_OTHER_PAGES, Duration.ofMillis(conf.readTimeoutMillis))
.withInt(PROTOCOL_MAX_FRAME_LENGTH, conf.maxFrameLengthInMB * 1024 * 1024)
}

// compression option cannot be set to NONE (default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ case class CassandraConnectorConf(
connectionFactory: CassandraConnectionFactory = DefaultConnectionFactory,
quietPeriodBeforeCloseMillis: Int = CassandraConnectorConf.QuietPeriodBeforeCloseParam.default,
timeoutBeforeCloseMillis: Int = CassandraConnectorConf.TimeoutBeforeCloseParam.default,
resolveContactPoints: Boolean = CassandraConnectorConf.ResolveContactPoints.default
resolveContactPoints: Boolean = CassandraConnectorConf.ResolveContactPoints.default,
maxFrameLengthInMB: Int = CassandraConnectorConf.MaxFrameLengthInMB.default,
) {

override def hashCode: Int = HashCodeBuilder.reflectionHashCode(this, false)
Expand Down Expand Up @@ -332,6 +333,12 @@ object CassandraConnectorConf extends Logging {
default = DefaultCassandraSSLConf.keyStoreType,
description = """Key store type""")

val MaxFrameLengthInMB = ConfigParameter[Int](
name = "spark.cassandra.protocol.max-frame-length-mb",
section = ReferenceSection,
default = 256,
description = """The maximum length, in MB, of the frames supported by the driver. """)

private def maybeResolveHostAndPort(hostAndPort: String, defaultPort: Int,
resolveContactPoints: Boolean): Option[InetSocketAddress] = {
val (hostName, port) = if (hostAndPort.contains(":")) {
Expand Down Expand Up @@ -429,6 +436,8 @@ object CassandraConnectorConf extends Logging {

val connectionFactory = CassandraConnectionFactory.fromSparkConf(conf)

val maxFrameLengthInMB = conf.getInt(MaxFrameLengthInMB.name, MaxFrameLengthInMB.default)

CassandraConnectorConf(
contactInfo = getContactInfoFromSparkConf(conf),
localDC = localDC,
Expand All @@ -444,7 +453,8 @@ object CassandraConnectorConf extends Logging {
connectionFactory = connectionFactory,
quietPeriodBeforeCloseMillis = quietPeriodBeforeClose,
timeoutBeforeCloseMillis = timeoutBeforeClose,
resolveContactPoints = resolveContactPoints
resolveContactPoints = resolveContactPoints,
maxFrameLengthInMB = maxFrameLengthInMB
)
}

Expand Down