package kv
- Alphabetic
- Public
- Protected
Type Members
- class ErrorHandler extends KeyValueWriteErrorHandler
Error handler that will receive any errors encountered by the Couchbase Spark Connector while trying to write Key-Value DataFrame operations.
Error handler that will receive any errors encountered by the Couchbase Spark Connector while trying to write Key-Value DataFrame operations.
Error handling is very application-dependent and users are encouraged to copy this code into their own application and adapt to their needs. It should be seen as an example.
It is recommended that users prefer using KeyValueOptions.ErrorBucket instead, which will write errors to a specified collection on the Couchbase cluster. This is a much simpler and more versatile form of error handling, as Apache Spark's architecture means this ErrorHandler class does have some caveats that limit its usefulness:
Where this executes ------------------- It's very important to note that this will execute on the Sparker executor (worker), and not inside the driver application. When doing initial testing with
.master("local[*]")these are one and the same. But when deploying the application to a Spark cluster, the workers are usually separate nodes. Many things that will work fine in local testing - like maintaining a list of received errors and processing them in the application - will not work on a real Spark cluster. The ErrorHandler in the application will never execute.The critical point: There is no way for the application to programmatically get access to the values that are passed to this handler. To over-simplify what Spark does - it will run your application, and also copy your application to the executors and run it there. Each copy of that application will have their own independent copy of this ErrorHandler, running on separate JVM processes, generally on different nodes. The Spark Connector will be running key-value operations on the Spark executors, and sending failures to the copies of ErrorHandler that execute there.
So ErrorHandler logs any failures and also appends them to a JSONL file, and it's crucial to understand that all of this logic will execute on the Spark executor (worker). So logging will appear in the Spark executor logs, and the file will be created on the Spark executor. It will be up to the application to find and copy these files from the Spark executors later. Per above, users may find KeyValueOptions.ErrorBucket a simpler solution - the application can simply fetch any errors from Couchbase after the job.
- class ErrorQueueManager extends Logging
- case class Get(id: String) extends KeyValueOperation with Product with Serializable
- class GetRDD extends RDD[GetResult] with Logging
- case class Insert[T](id: String, content: T) extends KeyValueOperation with Product with Serializable
- class InsertRDD[T] extends RDD[MutationResult] with Logging
- class KeyValueContinuousStream extends KeyValueDataStream with ContinuousStream
- class KeyValueDataStream extends SparkDataStream with Logging
- class KeyValueErrorDocumentHandler extends Logging with Serializable
- case class KeyValueInputPartition(schema: StructType, partitionOffset: KeyValuePartitionOffset, conf: CouchbaseConfig, config: KeyValueStreamConfig) extends InputPartition with Product with Serializable
- class KeyValueMicroBatchStream extends KeyValueDataStream with MicroBatchStream
- case class KeyValueOffset(offsets: List[PartitionOffset]) extends Offset with Product with Serializable
- sealed abstract class KeyValueOperation extends AnyRef
- class KeyValuePartition extends Partition
- case class KeyValuePartitionOffset(streamStartOffsets: Map[Int, KeyValueStreamOffset], streamEndOffsets: Option[Map[Int, KeyValueStreamOffset]]) extends PartitionOffset with Product with Serializable
Holds the offset information for an individual vbucket.
- class KeyValuePartitionReader extends ContinuousPartitionReader[InternalRow] with Logging
The KeyValuePartitionReader is responsible for actually streaming the mutations from a number of vbuckets.
- class KeyValueScan extends Scan
- class KeyValueScanBuilder extends ScanBuilder
- class KeyValueSourceInitialOffsetWriter extends HDFSMetadataLog[Map[Int, KeyValueStreamOffset]]
- case class KeyValueStreamConfig(streamFrom: StreamFrom, numInputPartitions: Int, bucket: String, scope: Option[String], collections: Seq[String], streamContent: Boolean, streamXattrs: Boolean, flowControlBufferSize: Option[Int], persistencePollingInterval: Option[String], connectionIdentifier: Option[String]) extends Product with Serializable
- case class KeyValueStreamOffset(vbuuid: Long, seqno: Long, snapshotStartSeqno: Long, snapshotEndSeqno: Long, collectionsManifestUid: Long) extends Product with Serializable
- class KeyValueTable extends SupportsRead
- class KeyValueTableProvider extends Logging with TableProvider with DataSourceRegister with CreatableRelationProvider
- case class KeyValueWriteConfig(bucket: String, scope: Option[String], collection: Option[String], idFieldName: String, casFieldName: Option[String], durability: Option[String], timeout: Option[String], connectionIdentifier: Option[String], errorHandler: Option[String], errorBucket: Option[String], errorScope: Option[String], errorCollection: Option[String], writeMode: Option[String]) extends Product with Serializable
- trait KeyValueWriteErrorHandler extends Serializable
Trait for handling errors during Couchbase KeyValue write operations.
Trait for handling errors during Couchbase KeyValue write operations.
This allows applications to define custom error handling behavior for all write operations instead of having operations fail the entire job.
Error handlers are processed asynchronously through a background queue system, so blocking operations are permitted. Each operation will block the queue until it completes.
See ExampleErrorHandler.
- case class KeyValueWriteErrorInfo(bucket: String, scope: String, collection: String, documentId: String, throwable: Option[Throwable]) extends Product with Serializable
Case class containing error information for KeyValue write operations.
Case class containing error information for KeyValue write operations.
- bucket
The bucket name where the error occurred
- scope
The scope name where the error occurred
- collection
The collection name where the error occurred
- documentId
The document ID that failed to write
- throwable
The original exception that occurred, or None if the exception could not be returned (which may be because it's not serializable)
- case class LookupIn(id: String, specs: Seq[LookupInSpec]) extends KeyValueOperation with Product with Serializable
- class LookupInRDD extends RDD[LookupInResult] with Logging
- case class MutateIn(id: String, specs: Seq[MutateInSpec], cas: Long = 0) extends KeyValueOperation with Product with Serializable
- class MutateInRDD extends RDD[MutateInResult] with Logging
- class RelationPartitionWriter extends ForeachPartitionFunction[String] with Logging
- case class Remove(id: String, cas: Long = 0) extends KeyValueOperation with Product with Serializable
- class RemoveRDD extends RDD[MutationResult] with Logging
- case class Replace[T](id: String, content: T, cas: Long = 0) extends KeyValueOperation with Product with Serializable
- class ReplaceRDD[T] extends RDD[MutationResult] with Logging
- case class Upsert[T](id: String, content: T) extends KeyValueOperation with Product with Serializable
- class UpsertRDD[T] extends RDD[MutationResult] with Logging
Value Members
- object DCPShared
- object KeyValueOperationRunner extends Logging
- object KeyValueOptions
Helper object to provide type-safe keys and values for Spark SQL query options.
- object KeyValuePartition extends Serializable
- object KeyValueStreamOffset extends Serializable
- object StreamFromVariants extends Enumeration