mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2026-10-12 09:24:52 -05:00
439 lines
17 KiB
Markdown
439 lines
17 KiB
Markdown
# NoSQLBench Architectural Planning - Consolidated Analysis
|
|
|
|
## Status Overview (Updated 2025-09-29)
|
|
|
|
**Current Branch**: `jshook/refactorings1`
|
|
**Overall Progress**: Phase 1 Step 1 Complete, Step 2 Starting
|
|
|
|
| Phase | Status | Branch | Progress |
|
|
|-------|--------|--------|----------|
|
|
| **Phase 1: Core Consolidation** | 🔄 In Progress | refactorings1 | ████░░░░░░ 40% |
|
|
| └─ Step 1.1: Activity Consolidation | ✅ Complete | refactorings1 | ██████████ 100% |
|
|
| └─ Step 1.2: ActivityConfig Migration | ⚪ Not Started | refactorings1 | ░░░░░░░░░░ 0% |
|
|
| └─ Step 1.3: Lifecycle/Error Handling | ⚪ Not Started | refactorings1 | ░░░░░░░░░░ 0% |
|
|
| **Phase 2: Operation Pipeline** | ⚪ Not Started | - | ░░░░░░░░░░ 0% |
|
|
| **Phase 3: Enhancements** | ⚪ Not Started | - | ░░░░░░░░░░ 0% |
|
|
| **Phase 4: Polish** | ⚪ Not Started | - | ░░░░░░░░░░ 0% |
|
|
|
|
**Legend**: ✅ Complete | 🔄 In Progress | ⚪ Not Started
|
|
|
|
**Note**: The `jshook/nb523` branch serves as a reference implementation showing the intended architectural changes. This `refactorings1` branch will apply those changes incrementally in a cleaner, more systematic way.
|
|
|
|
---
|
|
|
|
## Executive Summary
|
|
|
|
This document consolidates the analysis from three perspectives of the nb523 branch refactoring:
|
|
1. **nb523-branch-analysis.md** - Design intentions and commit analysis
|
|
2. **refactorings.md** - Detailed implementation steps with code examples
|
|
3. **branch_changes.md** - Net architectural changes and impact analysis
|
|
|
|
The refactoring represents a fundamental simplification of NoSQLBench's architecture, focusing on consolidation, standardization, and improved developer experience.
|
|
|
|
## Common Themes Across All Documents
|
|
|
|
### 1. Activity Class Hierarchy Consolidation
|
|
**Status**: ✅ Complete on jshook/refactorings1 branch
|
|
**Unanimous Agreement:**
|
|
- Elimination of `SimpleActivity`, `StandardActivity`, and `Activity` interface
|
|
- Creation of single unified `Activity` class
|
|
- Location: `io.nosqlbench.engine.api.activityapi.core.Activity`
|
|
- Result: ~1,300 lines net removed from codebase (767 line unified Activity class)
|
|
|
|
**Key Benefits Identified:**
|
|
- Reduced cognitive load for developers
|
|
- Clearer inheritance structure
|
|
- Single source of truth for activity behavior
|
|
- Simplified maintenance
|
|
|
|
### 2. Configuration System Modernization
|
|
**Status**: ⚪ To be implemented on refactorings1 (reference impl in nb523)
|
|
**Planned Changes:**
|
|
- Removal of `ActivityDef` (272 lines)
|
|
- Introduction of `ActivityConfig` extending `NBConfiguration` (113 lines)
|
|
- Implementation of `NBConfigurable` and `NBReconfigurable` interfaces
|
|
- Standardized configuration validation
|
|
|
|
**Implementation Details:**
|
|
- Type-safe parameter access
|
|
- Built-in validation framework
|
|
- Dynamic reconfiguration support
|
|
- Backward compatibility through NBConfiguration
|
|
|
|
**Reference**: See `jshook/nb523` branch for example implementation approach
|
|
|
|
### 3. Operation Synthesis Pipeline Enhancement
|
|
**Status**: ⚪ Not started (planned in original nb523 analysis)
|
|
**Shared Components:**
|
|
- `OpResolution` - Central coordinator for operation synthesis (167 lines planned)
|
|
- `OpResolverBank` - Managing multiple operation resolvers (76 lines planned)
|
|
- `AdapterResolver` - Driver adapter lifecycle management (67 lines planned)
|
|
- `DispenserResolver` - Creating operation dispensers (40 lines planned)
|
|
- `ParsedOpResolver` - Template to parsed operation conversion (44 lines planned)
|
|
|
|
**Common Goals:**
|
|
- Better separation of concerns
|
|
- Circular dependency detection
|
|
- Lazy initialization
|
|
- Improved error reporting
|
|
|
|
### 4. Lifecycle and State Management
|
|
**Agreed Improvements:**
|
|
- Clear state transitions
|
|
- Better thread safety
|
|
- Lifecycle state validation
|
|
- Improved error handling during state changes
|
|
|
|
### 5. Code Organization and Documentation
|
|
**Universal Changes:**
|
|
- Addition of style configurations (IntelliJ, EditorConfig)
|
|
- License header updates
|
|
- Improved inline documentation
|
|
- Visual architecture diagrams (scaffold.svg/png)
|
|
|
|
## Themes Present in Two Documents
|
|
|
|
### Present in nb523-branch-analysis.md and branch_changes.md:
|
|
1. **ActivityWiring Class Introduction**
|
|
- Centralizes component wiring
|
|
- Manages dispensers for motors, inputs, actions, outputs, filters
|
|
- 89 lines of focused responsibility
|
|
|
|
2. **ActivityMetrics Separation**
|
|
- Extracted from main activity class
|
|
- 176 lines of dedicated metrics management
|
|
- Better metric categorization
|
|
|
|
3. **FieldVerifier System**
|
|
- 260 lines of validation logic
|
|
- Type checking and constraint validation
|
|
- Enhanced error reporting
|
|
|
|
### Present in refactorings.md and branch_changes.md:
|
|
1. **Motor System Updates**
|
|
- CoreMotor extends NBBaseComponent
|
|
- Implements NBReconfigurable
|
|
- Simplified constructor
|
|
- Better sync/async separation
|
|
|
|
2. **Diagnostics Class Addition**
|
|
- 59 lines for diagnostic capabilities
|
|
- Activity introspection
|
|
- Enhanced debugging
|
|
|
|
### Present in nb523-branch-analysis.md and refactorings.md:
|
|
1. **Dry-Run Capability Enhancement**
|
|
- Operation preview without execution
|
|
- Better testing and validation
|
|
- Developer-friendly debugging
|
|
|
|
2. **Space API Alignment**
|
|
- Consistent interface across adapters
|
|
- Better lifecycle management
|
|
- Standardized configuration
|
|
|
|
## Unique Details by Document
|
|
|
|
### Unique to nb523-branch-analysis.md:
|
|
1. **Commit-by-Commit Analysis**
|
|
- Specific commit hashes and progression
|
|
- 30+ commits tracked
|
|
- Intermediate state documentation
|
|
|
|
2. **Technical Debt Metrics**
|
|
- ~1,900 lines of code removed
|
|
- Observer pattern elimination details
|
|
|
|
3. **Risk Assessment**
|
|
- Breaking change identification
|
|
- Compatibility concerns
|
|
- Performance validation needs
|
|
|
|
### Unique to refactorings.md:
|
|
1. **Atomic Implementation Steps**
|
|
- Line-by-line code changes
|
|
- Specific file paths and line numbers
|
|
- Test commands for each step
|
|
|
|
2. **Extensive Code Examples**
|
|
- Complete class implementations
|
|
- Before/after comparisons
|
|
- Test case examples
|
|
|
|
3. **Implementation Tools:**
|
|
- OpCache implementation for performance
|
|
- SpaceCache manager
|
|
- LifecycleStateMachine
|
|
- ConfigurationValidator utility
|
|
- Field resolver strategies
|
|
- Operation pooling mechanisms
|
|
|
|
4. **Rollback Procedures**
|
|
- Quick rollback commands
|
|
- Partial rollback strategies
|
|
- Phase-by-phase reversal
|
|
|
|
5. **5-Week Implementation Timeline**
|
|
- Week-by-week breakdown
|
|
- Detailed checklists
|
|
- Success criteria
|
|
|
|
### Unique to branch_changes.md:
|
|
1. **File Statistics**
|
|
- Exact line counts for additions/removals
|
|
- File path changes and reorganization
|
|
- 202 files modified, 6780+ insertions, 3961 deletions
|
|
|
|
2. **Impact Analysis**
|
|
- Effects on activity development
|
|
- Adapter development implications
|
|
- Testing improvements
|
|
|
|
3. **Migration Strategy Phases**
|
|
- High-level phase organization
|
|
- Dependency order
|
|
- Validation steps
|
|
|
|
## Current Implementation Status
|
|
|
|
### Completed Work (jshook/refactorings1 branch)
|
|
This branch extends main with the following completed refactoring work:
|
|
|
|
#### Priority 1: Activity Class Consolidation ✅
|
|
- **Status**: COMPLETE
|
|
- **Location**: `nb-engine/nb-engine-core/src/main/java/io/nosqlbench/engine/api/activityapi/core/Activity.java`
|
|
- **Details**:
|
|
- Unified Activity class (767 lines) combines all SimpleActivity and StandardActivity functionality
|
|
- Removed legacy types: `SimpleActivity`, `StandardActivity`, `StandardActivityType`
|
|
- Updated all callers: `ActivityLoader`, `ActivityExecutor`, `CoreMotor`, async helpers, tests
|
|
- Full `mvn verify` completed without regressions
|
|
- Benefits: reduced duplication, clearer instantiation, smaller adapter surface area
|
|
- **Reference**: See `ACTIVITY_REFACTORING_PLAN.md` for detailed step tracking
|
|
|
|
### Reference Implementation (jshook/nb523 branch)
|
|
This branch demonstrates the intended architectural changes and serves as a reference:
|
|
|
|
#### Reference: Configuration System Migration
|
|
- **Status**: Reference implementation exists on jshook/nb523
|
|
- **Key Patterns Demonstrated**:
|
|
- ActivityDef → ActivityConfig migration approach (commit 97e7b16d7)
|
|
- ActivityConfig extends NBConfiguration
|
|
- Implements NBConfigurable and NBReconfigurable interfaces
|
|
- Type-safe parameter access with built-in validation
|
|
- **Application to refactorings1**:
|
|
- Will be implemented fresh on refactorings1 branch
|
|
- Using nb523 as architectural reference
|
|
- Applying patterns incrementally with verification at each step
|
|
|
|
### Not Yet Started on refactorings1
|
|
|
|
#### Priority 2: Operation Pipeline (Should Have)
|
|
**Dependencies**: Requires Phase 1 completion
|
|
1. OpResolution implementation
|
|
2. Resolver components (OpResolverBank, AdapterResolver, DispenserResolver, ParsedOpResolver)
|
|
3. ActivityWiring setup
|
|
4. Metrics separation (ActivityMetrics extraction)
|
|
|
|
#### Priority 3: Enhancements (Nice to Have)
|
|
**Dependencies**: Requires Phase 2 completion
|
|
1. Operation caching (OpCache)
|
|
2. Space API alignment
|
|
3. Dry-run capabilities
|
|
4. Advanced diagnostics
|
|
5. Performance optimizations
|
|
|
|
#### Priority 4: Polish (Can Proceed in Parallel)
|
|
**Dependencies**: Can proceed once Phase 1 is complete
|
|
1. Visual documentation
|
|
2. Migration guides
|
|
3. Style configurations
|
|
4. Cleanup and deprecation removal
|
|
|
|
## Branch Relationship
|
|
```
|
|
main (8e85019fe)
|
|
├── jshook/refactorings1 (current working branch)
|
|
│ └── Activity consolidation complete
|
|
│ └── Next: Apply ActivityConfig migration fresh
|
|
│
|
|
└── jshook/nb523 (reference implementation, not to be merged)
|
|
└── Shows complete architectural vision
|
|
└── Used as pattern reference for incremental changes
|
|
```
|
|
|
|
**Strategy**:
|
|
1. Use nb523 as architectural reference
|
|
2. Apply changes incrementally on refactorings1
|
|
3. Verify at each step before proceeding
|
|
4. Build cleanly from completed Activity consolidation
|
|
|
|
## Key Implementation Decisions
|
|
|
|
### Agreed Upon Approaches:
|
|
1. **Single Activity Class:** ✅ Unanimous agreement on consolidation - COMPLETE
|
|
2. **NBConfiguration Base:** 🔄 Standard configuration approach - IN PROGRESS
|
|
3. **Resolver Pattern:** ⚪ For operation synthesis pipeline - PLANNED
|
|
4. **Component Separation:** ⚪ Metrics, wiring, lifecycle as separate concerns - PLANNED
|
|
5. **Lazy Initialization:** ⚪ For performance optimization - PLANNED
|
|
|
|
### Areas Requiring Further Discussion:
|
|
1. **Backward Compatibility:** How much to preserve vs. clean break
|
|
- Current approach: Breaking changes acceptable with clear migration path
|
|
2. **Performance Benchmarks:** Specific metrics to track
|
|
- Verify no regressions via `mvn verify` and existing test suite
|
|
3. **Testing Strategy:** Unit vs. integration test balance
|
|
- Approach: Comprehensive test coverage maintained at each phase
|
|
|
|
## Success Metrics
|
|
|
|
### Quantitative (Measured at Each Phase):
|
|
- **Code reduction**: ✅ Phase 1: ~1,300 lines removed (target: 1,500+ total)
|
|
- **Test coverage**: ✅ Phase 1: Maintained (all tests pass)
|
|
- **Performance**: ✅ Phase 1: No regression in operation throughput
|
|
- **Build time**: ✅ Phase 1: Acceptable
|
|
|
|
### Qualitative (Ongoing Assessment):
|
|
- ✅ Developer experience improvement (single Activity class)
|
|
- 🔄 Clearer architecture documentation (in progress)
|
|
- 🔄 Simplified onboarding for new contributors (improved with consolidation)
|
|
- ⚪ Better error messages and debugging (planned for Phase 1.3)
|
|
|
|
## Risk Mitigation
|
|
|
|
### High Risk Items:
|
|
1. **Breaking Changes**
|
|
- Mitigation: Comprehensive migration guide
|
|
- Fallback: Compatibility layer if needed
|
|
|
|
2. **Performance Regression**
|
|
- Mitigation: Benchmark before/after each phase
|
|
- Fallback: Revert specific optimizations
|
|
|
|
3. **Adapter Compatibility**
|
|
- Mitigation: Test with all adapters early
|
|
- Fallback: Adapter-specific compatibility fixes
|
|
|
|
### Medium Risk Items:
|
|
1. **Pattern Translation from nb523**
|
|
- Risk: Reference implementation may not directly apply
|
|
- Mitigation: Understand patterns first, then apply incrementally
|
|
- Status: Will be addressed during Phase 1.2
|
|
|
|
2. **Testing Gaps**
|
|
- Mitigation: Test-driven development, full `mvn verify` at each phase
|
|
- Fallback: Extended testing before proceeding to next phase
|
|
|
|
## Implementation Roadmap
|
|
|
|
### Phase 1: Core Consolidation ✅ MOSTLY COMPLETE
|
|
**Goal**: Unify activity hierarchy and standardize configuration
|
|
**Verification**: All tests pass, no runtime regressions, cleaner adapter API
|
|
|
|
#### Step 1.1: Activity Class Consolidation ✅ COMPLETE
|
|
- [x] Activity class consolidation (jshook/refactorings1)
|
|
- [x] Create unified Activity class (767 lines)
|
|
- [x] Remove SimpleActivity, StandardActivity, StandardActivityType
|
|
- [x] Update ActivityLoader, ActivityExecutor, CoreMotor
|
|
- [x] Update all test classes
|
|
- [x] Verify with full test suite (`mvn verify`)
|
|
- **Verification**: Tests pass, ~1,300 net lines removed
|
|
|
|
#### Step 1.2: Configuration System Migration ⚪ NOT STARTED
|
|
- [ ] ActivityDef → ActivityConfig migration (fresh implementation on refactorings1)
|
|
- [ ] Create ActivityConfig class extending NBConfiguration (reference: nb523 commit 97e7b16d7)
|
|
- [ ] Update Activity class to use ActivityConfig instead of ActivityDef
|
|
- [ ] Update core components to use NBConfigurable pattern
|
|
- [ ] Update ActivityLoader and related components
|
|
- [ ] Update all ActivityDef references across codebase
|
|
- [ ] Update adapter implementations
|
|
- [ ] Remove ActivityDef class
|
|
- [ ] Run full test suite
|
|
- **Verification**: All adapters build, tests pass, configuration validated
|
|
- **Reference**: See jshook/nb523 for implementation patterns
|
|
|
|
#### Step 1.3: Lifecycle and Error Handling (Future)
|
|
- [ ] Basic lifecycle management improvements
|
|
- [ ] Core error handling enhancements
|
|
- **Verification**: State transitions validated, error paths tested
|
|
|
|
### Phase 2: Operation Pipeline - NOT STARTED
|
|
**Goal**: Refactor operation synthesis for clarity and extensibility
|
|
**Dependencies**: Phase 1 must be complete
|
|
**Verification**: Operation resolution is deterministic, circular dependencies detected
|
|
|
|
- [ ] OpResolution implementation
|
|
- [ ] Resolver components (OpResolverBank, AdapterResolver, DispenserResolver, ParsedOpResolver)
|
|
- [ ] ActivityWiring setup
|
|
- [ ] Metrics separation (ActivityMetrics extraction)
|
|
- **Verification**: All existing workloads run unchanged, metrics maintained
|
|
|
|
### Phase 3: Enhancements - NOT STARTED
|
|
**Goal**: Add performance and developer experience improvements
|
|
**Dependencies**: Phase 2 must be complete
|
|
**Verification**: No performance regressions, enhanced capabilities verified
|
|
|
|
- [ ] Operation caching (OpCache)
|
|
- [ ] Space API alignment improvements
|
|
- [ ] Dry-run capabilities enhancement
|
|
- [ ] Advanced diagnostics
|
|
- [ ] Performance optimizations
|
|
- **Verification**: Benchmark comparisons, diagnostic output validated
|
|
|
|
### Phase 4: Polish - NOT STARTED
|
|
**Goal**: Improve documentation and developer onboarding
|
|
**Dependencies**: Can proceed once Phase 1 is complete
|
|
**Verification**: Documentation accurate, migration path clear
|
|
|
|
- [ ] Visual documentation updates
|
|
- [ ] Migration guides for users
|
|
- [ ] Style configurations finalization
|
|
- [ ] Cleanup and deprecation removal
|
|
- **Verification**: Documentation review, community feedback
|
|
|
|
## Summary of Current State
|
|
|
|
**What's Complete**:
|
|
- ✅ Activity hierarchy consolidation (jshook/refactorings1)
|
|
- Single unified Activity class replacing SimpleActivity, StandardActivity, and interface
|
|
- 767 lines of consolidated functionality
|
|
- All tests passing with `mvn verify`
|
|
- ~1,300 net lines removed from codebase
|
|
|
|
**What's Next**:
|
|
- ⚪ ActivityDef → ActivityConfig migration (to be implemented on refactorings1)
|
|
- Reference implementation exists on nb523 branch (commit 97e7b16d7)
|
|
- Will be applied fresh on refactorings1 using nb523 as architectural guide
|
|
- Incremental approach with verification at each step
|
|
|
|
**What's Not Started**:
|
|
- Operation pipeline refactoring (OpResolution, resolvers, wiring)
|
|
- Metrics separation (ActivityMetrics extraction)
|
|
- Advanced features (caching, diagnostics, dry-run enhancements)
|
|
- Documentation and polish
|
|
|
|
**Branch Strategy**:
|
|
- `main`: Stable production branch (commit 8e85019fe)
|
|
- `jshook/refactorings1`: Current working branch with Activity consolidation complete
|
|
- `jshook/nb523`: Reference implementation showing architectural target (not to be merged)
|
|
|
|
**Immediate Actions Needed**:
|
|
1. Implement ActivityConfig on refactorings1 (using nb523 as reference)
|
|
2. Migrate Activity class from ActivityDef to ActivityConfig
|
|
3. Update all callers incrementally with verification
|
|
4. Complete ActivityDef removal across all adapters
|
|
5. Run full test suite at each major step
|
|
6. Proceed with remaining Phase 1 work, then Phase 2
|
|
|
|
## Conclusion
|
|
|
|
The refactoring represents a fundamental simplification of NoSQLBench's architecture. Phase 1 Step 1 (Activity consolidation) is complete on the `refactorings1` branch. The `nb523` branch provides a reference implementation of the complete architectural vision, which will be applied incrementally on `refactorings1` with proper verification at each step.
|
|
|
|
The detailed implementation steps in refactorings.md, combined with the impact analysis from branch_changes.md and the design rationale from nb523-branch-analysis.md, provide a comprehensive blueprint for executing this architectural transformation successfully.
|
|
|
|
**Key Success Factors**:
|
|
1. **Incremental approach**: Apply changes in small, verifiable steps
|
|
2. **Reference-driven**: Use nb523 as architectural guide, not merge source
|
|
3. **Test-driven**: Run `mvn verify` at each major milestone
|
|
4. **Dependency-aware**: Complete each phase before proceeding to next
|
|
5. **Flexibility**: Adjust implementation details based on findings while maintaining architectural goals
|