Only reset PTME on rate change #716
@ -20,7 +20,11 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
- Important bugfixes for PTME. See `q7s-package` CHANGELOG.
|
- Important bugfixes for PTME. See `q7s-package` CHANGELOG.
|
||||||
|
|
||||||
# [v5.2.0] to be released
|
# [v5.2.0] 2023-06-29
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Empty dumps (no TM in time range) will now correctly be completed immediately
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
@ -45,13 +45,19 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
|||||||
} else {
|
} else {
|
||||||
Command_t execCmd;
|
Command_t execCmd;
|
||||||
// Handle TC requests, for example deletion or retrieval requests.
|
// Handle TC requests, for example deletion or retrieval requests.
|
||||||
|
// TODO: Not really clean here.. would be better if the executed command is returns as an
|
||||||
|
// enumeration.
|
||||||
result = store.handleCommandQueue(ipcStore, execCmd);
|
result = store.handleCommandQueue(ipcStore, execCmd);
|
||||||
if (result == returnvalue::OK) {
|
|
||||||
if (execCmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
|
if (execCmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
|
||||||
|
if (result == PersistentTmStore::DUMP_DONE) {
|
||||||
|
dumpDoneHandler(store, dumpContext);
|
||||||
|
} else if (result == returnvalue::OK) {
|
||||||
cancelDumpCd.resetTimer();
|
cancelDumpCd.resetTimer();
|
||||||
tmSinkBusyCd.resetTimer();
|
tmSinkBusyCd.resetTimer();
|
||||||
dumpContext.reset();
|
dumpContext.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (execCmd != CommandMessageIF::CMD_NONE) {
|
||||||
tcRequestReceived = true;
|
tcRequestReceived = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,21 +125,13 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
|
|||||||
DumpContext& dumpContext, bool& dumpPerformed) {
|
DumpContext& dumpContext, bool& dumpPerformed) {
|
||||||
size_t dumpedLen = 0;
|
size_t dumpedLen = 0;
|
||||||
|
|
||||||
auto dumpDoneHandler = [&]() {
|
|
||||||
uint32_t startTime;
|
|
||||||
uint32_t endTime;
|
|
||||||
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
|
|
||||||
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
|
|
||||||
dumpContext.dumpedBytes);
|
|
||||||
dumpContext.reset();
|
|
||||||
};
|
|
||||||
// Dump the next packet into the PTME.
|
// Dump the next packet into the PTME.
|
||||||
dumpContext.ptmeBusyCounter = 0;
|
dumpContext.ptmeBusyCounter = 0;
|
||||||
tmSinkBusyCd.resetTimer();
|
tmSinkBusyCd.resetTimer();
|
||||||
ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped);
|
ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped);
|
||||||
if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
|
if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
|
||||||
// This can happen if a file is corrupted and the next file swap completes the dump.
|
// This can happen if a file is corrupted and the next file swap completes the dump.
|
||||||
dumpDoneHandler();
|
dumpDoneHandler(store, dumpContext);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
} else if (result != returnvalue::OK) {
|
} else if (result != returnvalue::OK) {
|
||||||
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
|
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
|
||||||
@ -157,7 +155,7 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == PersistentTmStore::DUMP_DONE) {
|
if (result == PersistentTmStore::DUMP_DONE) {
|
||||||
dumpDoneHandler();
|
dumpDoneHandler(store, dumpContext);
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -198,6 +196,14 @@ ReturnValue_t TmStoreTaskBase::connectModeTreeParent(HasModeTreeChildrenIF& pare
|
|||||||
return modetree::connectModeTreeParent(parent, *this, nullptr, modeHelper);
|
return modetree::connectModeTreeParent(parent, *this, nullptr, modeHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TmStoreTaskBase::dumpDoneHandler(PersistentTmStore& store, DumpContext& dumpContext) {
|
||||||
|
uint32_t startTime;
|
||||||
|
uint32_t endTime;
|
||||||
|
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
|
||||||
|
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets, dumpContext.dumpedBytes);
|
||||||
|
dumpContext.reset();
|
||||||
|
}
|
||||||
|
|
||||||
ModeTreeChildIF& TmStoreTaskBase::getModeTreeChildIF() { return *this; }
|
ModeTreeChildIF& TmStoreTaskBase::getModeTreeChildIF() { return *this; }
|
||||||
|
|
||||||
void TmStoreTaskBase::readCommandQueue(void) {
|
void TmStoreTaskBase::readCommandQueue(void) {
|
||||||
|
@ -96,6 +96,8 @@ class TmStoreTaskBase : public SystemObject,
|
|||||||
|
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t* msToReachTheMode) override;
|
uint32_t* msToReachTheMode) override;
|
||||||
|
void dumpDoneHandler(PersistentTmStore& store, DumpContext& dumpContext);
|
||||||
|
|
||||||
void announceMode(bool recursive) override;
|
void announceMode(bool recursive) override;
|
||||||
object_id_t getObjectId() const override;
|
object_id_t getObjectId() const override;
|
||||||
const HasHealthIF* getOptHealthIF() const override;
|
const HasHealthIF* getOptHealthIF() const override;
|
||||||
|
@ -128,6 +128,7 @@ ReturnValue_t PersistentTmStore::assignAndOrCreateMostRecentFile() {
|
|||||||
|
|
||||||
ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore,
|
ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore,
|
||||||
Command_t& execCmd) {
|
Command_t& execCmd) {
|
||||||
|
execCmd = CommandMessageIF::CMD_NONE;
|
||||||
CommandMessage cmdMessage;
|
CommandMessage cmdMessage;
|
||||||
ReturnValue_t result = tcQueue->receiveMessage(&cmdMessage);
|
ReturnValue_t result = tcQueue->receiveMessage(&cmdMessage);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
@ -162,9 +163,9 @@ ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore,
|
|||||||
result = startDumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
result = startDumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
||||||
if (result == BUSY_DUMPING) {
|
if (result == BUSY_DUMPING) {
|
||||||
triggerEvent(persTmStore::BUSY_DUMPING_EVENT);
|
triggerEvent(persTmStore::BUSY_DUMPING_EVENT);
|
||||||
} else {
|
return result;
|
||||||
execCmd = cmd;
|
|
||||||
}
|
}
|
||||||
|
execCmd = cmd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -359,7 +360,10 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fileHasSwapped) {
|
ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fileHasSwapped) {
|
||||||
if (state == State::IDLE or dumpParams.pendingPacketDump) {
|
if (state == State::IDLE) {
|
||||||
|
return DUMP_DONE;
|
||||||
|
}
|
||||||
|
if (dumpParams.pendingPacketDump) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
fileHasSwapped = false;
|
fileHasSwapped = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user