fix: prevent circuit breaker activation and data loss during bulk imports
Storage-aware batching system prevents rate limiting issues on cloud storage (GCS, S3, R2, Azure). Replaces entity-by-entity creation with addMany()/relateMany() batch operations in ImportCoordinator. Separate read/write circuit breakers prevent read lockouts during write throttling. Each storage adapter auto-configures optimal batch sizes and delays. Fixes silent data loss and 30+ second lockouts on 1000+ row imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3c5f622d64
commit
14231554e1
12 changed files with 551 additions and 112 deletions
|
|
@ -16,6 +16,7 @@ import {
|
|||
} from '../../coreTypes.js'
|
||||
import {
|
||||
BaseStorage,
|
||||
StorageBatchConfig,
|
||||
SYSTEM_DIR,
|
||||
STATISTICS_KEY
|
||||
} from '../baseStorage.js'
|
||||
|
|
@ -119,6 +120,31 @@ export class FileSystemStorage extends BaseStorage {
|
|||
// Defer path operations until init() when path module is guaranteed to be loaded
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FileSystem-optimized batch configuration
|
||||
*
|
||||
* File system storage is I/O bound but not rate limited:
|
||||
* - Large batch sizes (500 items)
|
||||
* - No delays needed (0ms)
|
||||
* - Moderate concurrency (100 operations) - limited by I/O threads
|
||||
* - Parallel processing supported
|
||||
*
|
||||
* @returns FileSystem-optimized batch configuration
|
||||
* @since v4.11.0
|
||||
*/
|
||||
public getBatchConfig(): StorageBatchConfig {
|
||||
return {
|
||||
maxBatchSize: 500,
|
||||
batchDelayMs: 0,
|
||||
maxConcurrent: 100,
|
||||
supportsParallelWrites: true, // Filesystem handles parallel I/O
|
||||
rateLimit: {
|
||||
operationsPerSecond: 5000, // Depends on disk speed
|
||||
burstCapacity: 2000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the storage adapter
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue