Counter node loses count on upgrade

When you setup persistent context, then flow and globals (that you set either by a function or change node) are persisted to a JSON file in your .node-red directory.

Unless we look at the source or it explicitly states so, difficult to say.

If you want to be certain, make your own counter.
2BtEU3dNM9

[{"id":"d1e7267c.8a21e8","type":"function","z":"89aa4a33.4c3098","name":"counter","func":"var count = context.get(\"count\") || 0;\n\nif(msg.topic == \"reset\" || msg.reset == true) {\n    count = 0;\n} else if (msg.topic == \"set\") {\n    count = msg.payload;\n} else if (msg.topic == \"decrement\" || msg.topic == \"dec\") {\n    count--;\n} else {\n    //assume increment\n    count++;\n}\ncontext.set(\"count\", count); //store it\nnode.status({ text: count });\n\nmsg._count = count; //pass current count in msg._count\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":725,"y":380,"wires":[[]],"icon":"node-red-dashboard/ui_numeric.png","l":false},{"id":"ce9c22d4.90a37","type":"inject","z":"89aa4a33.4c3098","name":"reset","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"reset","payload":"","payloadType":"str","x":570,"y":380,"wires":[["d1e7267c.8a21e8"]]},{"id":"e2bda53.5e40558","type":"inject","z":"89aa4a33.4c3098","name":"inc","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":570,"y":420,"wires":[["d1e7267c.8a21e8"]]},{"id":"6cf4ceb6.efbac","type":"inject","z":"89aa4a33.4c3098","name":"dec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"dec","payload":"","payloadType":"str","x":570,"y":460,"wires":[["d1e7267c.8a21e8"]]},{"id":"a129a75c.b0e598","type":"inject","z":"89aa4a33.4c3098","name":"set 100","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"100","payloadType":"num","x":570,"y":340,"wires":[["d1e7267c.8a21e8"]]}]