Closed GoogleCodeExporter closed 9 years ago
It would be helpful if you could reproduce this with a simpler message -
ideally showing what *created* that data first (to prove that it started with a
QTGId value).
Original comment by jonathan.skeet
on 22 Oct 2014 at 10:14
The message was generated and logged in production environment. The same
message object was converted into a log item string like so (C#) :
- var logItem = message.ToString().Replace("\n", " ") // the human readable
format
- var buffer = message.ToByteArray();
var logItem = Convert.ToBase64String(buffer); // the base-64 format
However, deserialization from the base-64 format yielded a message with an
empty QTGId
Original comment by jko...@liquidcapital.com
on 22 Oct 2014 at 10:23
The value 1073 is stored in field 20 in the data - which is meant to be a
BondProduct. Likewise there's a string value ("RXZ14_Comdty") in field 21,
which is meant to be QTGId.
If you change the proto so that QTGId is field 20, and QTGName is field 21,
then it works fine.
My strong suspicion is that someone changed your proto file after you'd already
serialized the data, and renumbered the fields. You should never do that,
because it causes precisely this kind of problem.
Original comment by jonathan.skeet
on 22 Oct 2014 at 10:48
Thanks, that would explain the problem.
Original comment by jko...@liquidcapital.com
on 22 Oct 2014 at 10:51
Fyi, there was indeed a change in the ProductDefinitions.proto file
--- required int32 QTGId = 20;
--- required string QTGName = 21;
+++ required int32 QTGId = 21;
+++ required string QTGName = 22;
Original comment by jko...@liquidcapital.com
on 22 Oct 2014 at 10:57
In that case, I'm afraid the answer is "don't do that". The fields are keyed by
number, so if you change the numbers after storing data, you *will* experience
problems. The code is working as intended.
If you haven't stored anything with the *new* version of the proto, you can
just go back to the old version and all should be well. If you've got a mixture
of data stored with the new version and data stored with the old version,
you've got a bit of a data cleaning exercise to go through.
Original comment by jonathan.skeet
on 22 Oct 2014 at 11:43
Original issue reported on code.google.com by
jko...@liquidcapital.com
on 22 Oct 2014 at 10:12Attachments: