Documentation
¶
Overview ¶
Package transfer holds the helpers shared by data export and import, such as the catalog names of selectors. Their settings live in the config subpackage.
Index ¶
- Constants
- Variables
- func CatalogByName(name string) (commonv1.Catalog, bool)
- func CatalogName(c commonv1.Catalog) string
- func ImportListener(nodeID string, write bus.MessageListener) bus.MessageListener
- func ImportRowListener(nodeID string, write bus.MessageListener) bus.MessageListener
- func MergeRange(minDst, maxDst *int64, minSrc, maxSrc int64)
- func NextBackoff(d time.Duration) time.Duration
- func NormalizeStage(stage string) string
- func SleepCtx(ctx context.Context, d time.Duration) error
- func UniqueSorted(values []string) []string
Constants ¶
const ( // ImportErrorDomain is the ErrorInfo domain of every ImportService failure detail. ImportErrorDomain = "banyandb.transfer.import" // ImportReasonNodeFailed means a target node failed after the batch may have been partly // written to other nodes, so the client must not resend it. ImportReasonNodeFailed = "NODE_FAILED" // ImportReasonMessageTooLarge means a frame exceeded the liaison's receive message size. ImportReasonMessageTooLarge = "MESSAGE_TOO_LARGE" // ImportReasonRowInvalid means a row of the batch failed validation; nothing was written. ImportReasonRowInvalid = "ROW_INVALID" // ImportReasonSchemaNotFound means the group or the resource a row names does not exist. ImportReasonSchemaNotFound = "SCHEMA_NOT_FOUND" // ImportReasonNotWritten means the liaison refused before writing anything, on a failure // that may pass, such as a schema read; the client may resend the batch. ImportReasonNotWritten = "NOT_WRITTEN" // ImportRateBusy prefixes the message of a STATUS_RATE_LIMITED reply of a data node whose // import rate limit cannot admit a batch in time; the batch was not written and may be resent. // It is for people reading the message only: the reply is told apart by its status. ImportRateBusy = "import rate limit: " // ImportMetadataBatchSeq is the metadata key of the failed batch's batch_seq. ImportMetadataBatchSeq = "batch_seq" // ImportMetadataNode is the metadata key of the failed node's id. ImportMetadataNode = "node" // ImportMetadataRow is the metadata key of the failed row's index in its batch. ImportMetadataRow = "row" )
The google.rpc.ErrorInfo detail an ImportRows stream ends with describes its failure with these domain, reasons and metadata keys.
const DefaultStageName = "hot"
DefaultStageName is the name the CLI and manifest give the engine's unnamed default tier.
Variables ¶
var ( RetryBase = time.Second RetryMax = 30 * time.Second )
RetryBase and RetryMax bound the doubling back-off every transfer retry waits with: opening an export or import stream, retried within --send-retry-timeout, and re-pushing a native payload to the nodes that failed it, retried a fixed number of times. Tests shorten them.
Functions ¶
func CatalogByName ¶
CatalogByName maps a selector catalog name (stream, measure, trace, property) to its catalog.
func CatalogName ¶
CatalogName is the inverse of the selector catalog names, for rendering.
func ImportListener ¶
func ImportListener(nodeID string, write bus.MessageListener) bus.MessageListener
ImportListener returns the listener of an import topic. It reads the frames of an ImportWrite batch, admits their rows at the rate its init frame asks for, and hands the rows to write, the listener of the catalog's write topic, in one batch message. Every import topic of the data node nodeID shares one rate. A batch the node cannot admit in time is answered STATUS_RATE_LIMITED before any row is written. What write fails to store, which it only logs for a regular write, it records in the context it is given: the rows not stored are written again (see writeRows), and what still fails is answered as an error.
func ImportRowListener ¶
func ImportRowListener(nodeID string, write bus.MessageListener) bus.MessageListener
ImportRowListener is ImportListener for a write listener that takes one request per message: it hands the rows over one at a time, in order; a row that fails is written again, with the rows after it.
func MergeRange ¶
MergeRange widens [minDst, maxDst] by a source range. A source without a minimum (0) has no flushed timestamps and is skipped, so a 0 minDst always means no source was merged yet and the result does not depend on the merge order.
func NextBackoff ¶
NextBackoff doubles a back-off, capped at RetryMax.
func NormalizeStage ¶
NormalizeStage maps the engine's empty default tier to DefaultStageName.
func SleepCtx ¶
SleepCtx waits for d, returning nil when it elapses or context.Cause(ctx) when ctx ends first.
func UniqueSorted ¶
UniqueSorted returns the distinct values in ascending order, or nil for no values.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cluster connects the data transfer commands to a cluster through its liaisons: the connection preflight, the group listing and the dry-run Plan call of an export.
|
Package cluster connects the data transfer commands to a cluster through its liaisons: the connection preflight, the group listing and the dry-run Plan call of an export. |
|
Package config declares the settings of the data transfer commands and resolves them from flags, plan.yaml, BYDBCTL_* environment variables and defaults.
|
Package config declares the settings of the data transfer commands and resolves them from flags, plan.yaml, BYDBCTL_* environment variables and defaults. |
|
Package exitcode defines the process exit codes of data export and import and maps errors to them.
|
Package exitcode defines the process exit codes of data export and import and maps errors to them. |
|
Package exporter is the client-side orchestration of data export: the connection preflight against the liaisons, the dry-run Plan and its report, the export session library (create, list, heartbeat, release), and RunExport, which writes the schema, drives one Export stream per data node, dealt round robin over the liaisons, verifies and persists every file and seals manifest.json.
|
Package exporter is the client-side orchestration of data export: the connection preflight against the liaisons, the dry-run Plan and its report, the export session library (create, list, heartbeat, release), and RunExport, which writes the schema, drives one Export stream per data node, dealt round robin over the liaisons, verifies and persists every file and seals manifest.json. |
|
format
|
|
|
artifactpath
Package artifactpath names the files of an export artifact, whatever its format: the path components a CSV or native artifact derives from schema names.
|
Package artifactpath names the files of an export artifact, whatever its format: the path components a CSV or native artifact derives from schema names. |
|
bnc
Package bnc implements the .bnc native container of data export: the engine files of one shard or one segment index directory packed back to back, byte for byte, followed by a footer that names them.
|
Package bnc implements the .bnc native container of data export: the engine files of one shard or one segment index directory packed back to back, byte for byte, followed by a footer that names them. |
|
csvfmt
Package csvfmt defines the CSV export format: the group-level column layout derived from schema protos, the cell value encoding with its `\N` and `\B` sentinels, and a rolling writer that splits one CSV stream into size-bounded files.
|
Package csvfmt defines the CSV export format: the group-level column layout derived from schema protos, the cell value encoding with its `\N` and `\B` sentinels, and a rolling writer that splits one CSV stream into size-bounded files. |
|
manifest
Package manifest defines manifest.json, the index of an export artifact, together with the node directory naming rule.
|
Package manifest defines manifest.json, the index of an export artifact, together with the node directory naming rule. |
|
nativefmt
Package nativefmt is the contract between the files of a native artifact and the chunked sync protocol the data nodes receive them over: which files of a payload are sent, under which name a data node expects each of them, and how a part's metadata file becomes the part description the receiver places the part with.
|
Package nativefmt is the contract between the files of a native artifact and the chunked sync protocol the data nodes receive them over: which files of a payload are sent, under which name a data node expects each of them, and how a part's metadata file becomes the part description the receiver places the part with. |
|
Package importer imports a CSV or native artifact written by data export into a cluster: it checks the artifact, compares its schema with the target, decides which units and sources to push and renders that decision.
|
Package importer imports a CSV or native artifact written by data export into a cluster: it checks the artifact, compares its schema with the target, decides which units and sources to push and renders that decision. |
|
Package output renders what the data export and import commands print: tables, YAML and JSON, counts, sizes and times, and the live progress of a transfer on a terminal.
|
Package output renders what the data export and import commands print: tables, YAML and JSON, counts, sizes and times, and the live progress of a transfer on a terminal. |
|
Package ratelimit paces data transfer streams: the byte rate a process relays and the byte and row rates a data node admits imported rows at.
|
Package ratelimit paces data transfer streams: the byte rate a process relays and the byte and row rates a data node admits imported rows at. |
|
Package resume holds what the resumable export and import share: the process lock, the atomic progress-file and side-file writers and the persister goroutine that owns the progress file, the binding digests and their differences, the resume summary and the operator's confirmation.
|
Package resume holds what the resumable export and import share: the process lock, the atomic progress-file and side-file writers and the persister goroutine that owns the progress file, the binding digests and their differences, the resume summary and the operator's confirmation. |
|
Package rowdiff compares two CSV artifacts as sets of logical rows: A is a source export and B the re-export of the cluster A was imported into.
|
Package rowdiff compares two CSV artifacts as sets of logical rows: A is a source export and B the re-export of the cluster A was imported into. |
|
Package schemasync exports the schema of the selected groups through the liaison's registry services into the artifact's schema/<kind>.jsonl files.
|
Package schemasync exports the schema of the selected groups through the liaison's registry services into the artifact's schema/<kind>.jsonl files. |