How to design long running workflows?

Hi Team,

I am designing an Tenant lifecycle workflow where each tenant has a dedicated workflow upon creation.

Several use cases for the Tenant like extending the timelines, backing up the data and delete or force delete after a dedicated wait are handled using external signals to this lifecycle workflow.

I have set of tenants created and its submits a lifecycle and if there are workflow code changes in the future the old set of lifecycle does not work and getting the below error,

Caused by: io.temporal.internal.replay.NonDeterminisicWorkflowError: Unknown CommandId{commandTarget=TIMER, commandEventId=17}. The possible causes are a nondeterministic workflow definition code or an incompatible change in the workflow definition.
at io.temporal.internal.replay.CommandHelper.getCommand(CommandHelper.java:698)
at io.temporal.internal.replay.CommandHelper.handleTimerStarted(CommandHelper.java:379)
at io.temporal.internal.replay.ReplayWorkflowExecutor.processEvent(ReplayWorkflowExecutor.java:248)
at io.temporal.internal.replay.ReplayWorkflowExecutor.handleWorkflowTaskImpl(ReplayWorkflowExecutor.java:474)
at io.temporal.internal.replay.ReplayWorkflowExecutor.handleWorkflowTask(ReplayWorkflowExecutor.java:403)
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithEmbeddedQuery(ReplayWorkflowTaskHandler.java:168)
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskImpl(ReplayWorkflowTaskHandler.java:145)
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:104)
at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:301)
at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:273)
at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:73)

How should i go about handling the older lifecycle workflows? As the newly added business logic is applicable for the older tenants as well and it has lots of states which i dont want to discard by submitting a new workflow. Please advise.

Duplicate of Unexpected error causing Out of Memory while running lifecycle workflows