Sasha
Services
Archiver Services
Overview
- The Sasha archiver is responsible for lifecycle management of archived metadata and files for WorkUnits and DFU data.
- It supports both scheduled background archiving and command-driven archive/backup/restore/list flows.
- In bare-metal mode, one combined server runs all archiver roles; in containerized mode, roles are split into dedicated servers.
Main Entry Points
- Server factory declarations:
dali/sasha/saarch.hppcreateSashaArchiverServer()(bare-metal combined server)createSashaWUArchiverServer()(containerized WU archiver)createSashaDFUWUArchiverServer()(containerized DFU WU archiver)createSashaDFURecoveryArchiverServer()(containerized DFU recovery archiver)createSashaCachedWURemoverServer()(containerized cached WU cleanup)
- Command dispatcher:
processArchiverCommand(ISashaCommand *cmd)indali/sasha/saarch.cpp - WU listing/query helper used by command actions:
WUiterate(ISashaCommand *cmd, const char *mask)
Runtime Topology
Bare-metal topology:
CSashaCombinedArchiverServercreates and runs:CWorkUnitArchiverCDFUWorkUnitArchiverCDFUrecoveryArchiverCCachedWorkUnitRemover
- The server loops every minute, checks each archiver schedule, then runs eligible archivers.
Containerized topology:
CSashaArchiverServeris a base single-role threaded server.- Specialized servers each own one archiver instance and one SDS subtree (
xpath):CSashaWUArchiverServer->WorkUnits/CSashaDFUWUArchiverServer->DFU/WorkUnits/CSashaDFURecoveryArchiverServer->DFU/RECOVERY/jobCSashaCachedWURemoverServer->CachedWorkUnits/
Core Archiver Framework
- Abstract scheduling/scanning logic is centralized in
CBranchArchiver. - Each concrete branch archiver supplies branch-specific behavior via
createBranchItem()and item implementation. CBranchArchiver::action()performs:- SDS branch scan (
branchxpath) - Per-item qualification (
qualifies()) for archive and optional backup (qualifiesBackup()) - Sort/prioritization using
compare() - Rate/duration control via
CSashaSchedule - Archive and backup execution loops
- SDS branch scan (
Branch Item Contract
IBranchItemdefines the per-record decision and execution interface:isempty()qualifies()qualifiesBackup()archive()backup()compare(IBranchItem &to)
- Concrete item implementations:
CWorkUnitArchiver::cWUBranchItemCDFUWorkUnitArchiver::cDFUWUBranchItemCDFUrecoveryArchiver::cDRBranchItem
WorkUnit Archiving Flow
Scheduler path:
CWorkUnitArchiverscansWorkUnits/*.- Each WU is wrapped by
cWUBranchItem. qualifies()gates by protection/time/cutoff and state eligibility.
Archive execution:
CWorkUnitArchiver::archive()callsdoArchiveWorkUnit().doArchiveWorkUnit():- Acquires the archive mutex before opening the WU, matching the restore lock order
- Opens WU via
IWorkUnitFactory - Optionally version-renames existing LDS files
- Builds an archive metadata snapshot (when publishing is enabled)
- Calls
IExtendedWUInterface::archiveWorkUnit() - Publishes the snapshot only after
archiveWorkUnit()succeeds; a publish failure is logged and does not undo the archive
Archive publishing (optional):
- Publisher interface:
dali/sasha/wuarchivepublisher.hpp
- Publisher interface:
DFU and Recovery Flows
- DFU WorkUnits:
- Archiver:
CDFUWorkUnitArchiver - Archive operation:
doArchiveDfuWorkUnit()writes XML toArchive/DFUWorkUnits/...
- Archiver:
- DFU Recovery:
- Archiver:
CDFUrecoveryArchiver - Archive operation writes XML to
Archive/DFUrecovery/...and removes original node (when enabled)
- Archiver:
- Cached WU cleanup:
CCachedWorkUnitRemoveroverridesaction()to prune older cached entries beyond configured limits.
Command-Driven Flow
processArchiverCommand()handles interactive/remote command actions:SCA_ARCHIVE,SCA_BACKUP,SCA_RESTORE- WU:
doArchiveWorkUnit()/doRestoreWorkUnit() - DFU:
doArchiveDfuWorkUnit()/doRestoreDfuWorkUnit()
- WU:
SCA_LIST,SCA_GET,SCA_WORKUNIT_SERVICES_GET,SCA_LISTDT- Delegates to
WUiterate()
- Delegates to
- Results are appended to command IDs for compatibility with existing consumers.
Synchronization and Error Handling
- The shared
CriticalSection(archivingSect) serializes DFU WorkUnit archive/restore operations within the process and is used for WorkUnit archive/restore synchronization. - Each server thread catches
IException, logs viaEXCLOG, and requests server stop on unrecoverable errors. - WorkUnit archive failures mark SDS metadata (
@archiveError,@archiveErrorDate) for retry logic.
Configuration Concepts
- Scheduling/limits are read per archiver branch from config (
interval,at,limit,cutoff, optionalbackup). - WU archiver-specific options include
keepResultFilesandretryinterval. - Archive publishing is provided by a separate publisher abstraction.
Practical File Map
- Archiver interfaces and factories:
dali/sasha/saarch.hpp - Main implementation and orchestration:
dali/sasha/saarch.cpp - Command model:
dali/sasha/sacmd.hpp,dali/sasha/sacmd.cpp - Archive publisher interface:
dali/sasha/wuarchivepublisher.hpp - Archive publisher factory:
dali/sasha/wuarchivepublisher.cpp
Debug Plane Housekeeping Server
Overview
- This is a maintenance service that automatically manages files and directories on the debug plane using a configured retention period.
- This is required to control the disc space used by post-mortem and other files on the debug plane.
- This service is designed to execute on a schedule; a single log entry for a summary of any deleted (or failed to be deleted) files or deleted directories will be generated.
Installation and Configuration
- In containerized mode, the Helm chart deploys the service by default; runtime defaults are shown below.
For example
values.yaml:attribute description default required disabled When true, Helm omits this service's deployment.false optional interval Minimum interval between debug plane housekeeping expiry checking (in hours, 0 disables). 24 optional at Optional cron schedule for checking expired files and directories. Unset; interval only optional expiryDays Default number of days passed that debug plane files or directories are deleted. 14 optional
User Guide
How it works in steps
- Helm omits the service deployment if
disabledistrue. - The service reads
expiryDaysandintervalfrom its component configuration. - If either value is 0, the service does not start.
- The debug plane location is read from the component configuration.
- The service
Threadis started. - A loop of the following is started until the service is stopped:
- A one minute wait is imposed.
- If the schedule using
atandintervalindicates that the housekeeping is required then:- Any exceptions from the following are caught and logged.
- The debug plane directory list is read.
- The list of files and directories in the debug plane are processed:
- If the file or directory's modified date is over
expiryDaysold then:- The file or directory is deleted.
- A counter for each file or directory is maintained.
- If the file or directory's modified date is over
- A log entry is made giving the total number of files and directories deleted.
- Any exceptions from the following are caught and logged.
Inputs and Outputs
- The component configuration as per Installation and Configuration is the input for this service.
- The outputs are any logs generated for errors and deletion statistics.
Error Handling
- Known exceptions are handled to prevent service interruption.
Limitations and Considerations
- The service ensures it only runs in containerized environments.
Future Possible Enhancements
- A bare metal implementation.
- Logging freed up disc space statistics.