Skip to content

Refactor excessively long functions #1727

Description

@kaikulimu

Top 10 longest functions in BlazingMQ in number of lines (C++ only):

  ┌─────┬───────┬──────────────────────────────────────────────────┬────────────────────────────────────────────┐
  │  #  │ Lines │                     Function                     │                  Location                  │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 1   │ 1670  │ FileStore::recoverMessages                       │ mqbs/mqbs_filestore.cpp:1119               │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 2   │ 773   │ FileStore::openInRecoveryMode                    │ mqbs/mqbs_filestore.cpp:345                │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 3   │ 654   │ StorageUtil::recoveredQueuesCb                   │ mqbc/mqbc_storageutil.cpp:1555             │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 4   │ 612   │ RecoveryManager::processStorageSyncRequest       │ mqbblp/mqbblp_recoverymanager.cpp:3718     │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 5   │ 474   │ RecoveryManager::onStorageSyncResponseDispatched │ mqbblp/mqbblp_recoverymanager.cpp:892      │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 6   │ 440   │ FileStore::writeJournalRecord                    │ mqbs/mqbs_filestore.cpp:4740               │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 7   │ 439   │ RecoveryManager::processPartitionSyncDataRequest │ mqbblp/mqbblp_recoverymanager.cpp:4483     │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 8   │ 383   │ RecoveryManager::openRecoveryFileSet             │ mqbc/mqbc_recoverymanager.cpp:941          │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 9   │ 371   │ IncoreClusterStateLedger::applyImpl              │ mqbc/mqbc_incoreclusterstateledger.cpp:900 │
  ├─────┼───────┼──────────────────────────────────────────────────┼────────────────────────────────────────────┤
  │ 10  │ 325   │ FileStore::rolloverImpl                          │ mqbs/mqbs_filestore.cpp:2815               │
  └─────┴───────┴──────────────────────────────────────────────────┴────────────────────────────────────────────┘

Long functions are likely overloaded and should be refactored into smaller ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions