Skip to content

Commit

Permalink
[202012] Fix fast-reboot issue where cold restart is performed due to…
Browse files Browse the repository at this point in the history
… missing FAST_REBOOT system flag (#16669)

### Why I did it

Fast reboot is failing on 202012 after PR #15685 was cherrypicked to 202012 as part of #16225

The master branch change is good, but the cherry pick to 202012 is bad.
Change was needed on master as the code added here was not effective (as it was unreachable) and not required (as fast-reboot on master uses warm-reboot infra of db dump and reconc).

However, this code was still being used in 202012, and should not have been removed. The DB flag needs to be set to allow services do fast recovery. In the latest 202012 images, fast reboot fails as syncd does cold restart:

Good case on 202012 (before PR 16225)
```
Sep 14 13:25:55.435266 str3-s6100-acs-6 NOTICE syncd#syncd: :- Syncd: command line:  
	EnableDiagShell=YES EnableTempView=YES DisableExitSleep=NO EnableUnittests=NO EnableConsistencyCheck=NO 
	EnableSyncMode=YES RedisCommunicationMode=redis_async EnableSaiBulkSuport=NO 
	StartType=fast               <----------------------
	ProfileMapFile=/etc/sai.d/sai.profile GlobalContext=0 ContextConfig= BreakConfig=/tmp/break_before_make_objects
```

Bad case on 202012 (after PR 16225)
```
Sep 22 22:00:19.619381 str-s6100-acs-2 NOTICE syncd#syncd: :- Syncd: command line:  
	EnableDiagShell=YES EnableTempView=YES DisableExitSleep=NO EnableUnittests=NO EnableConsistencyCheck=NO 
	EnableSyncMode=YES RedisCommunicationMode=redis_async EnableSaiBulkSuport=NO 
	StartType=cold               <----------------------
	ProfileMapFile=/etc/sai.d/sai.profile GlobalContext=0 ContextConfig= BreakConfig=/tmp/break_before_make_objects
```
##### Work item tracking
- Microsoft ADO **(number only)**: 25227065

#### How I did it

Set system flag for fast reboot during boot up path

#### How to verify it

Change restores the state as it was before PR 16225, and fast-reboot worked before 16225

Tested locally w/ the change by replacing database.sh on the device.
  • Loading branch information
vaibhavhd authored Sep 25, 2023
1 parent 0e48244 commit 2042f44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ function postStartAction()
$SONIC_CFGGEN -j /etc/sonic/config_db$DEV.json --write-to-db
fi
fi
if [[ "$BOOT_TYPE" == "fast" ]]; then
# set the key to expire in 3 minutes
$SONIC_DB_CLI STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180"
fi
fi

if [ -e /tmp/pending_config_migration ] || [ -e /tmp/pending_config_initialization ]; then
Expand Down

0 comments on commit 2042f44

Please sign in to comment.