Incrementing a variable whose initial value is zero or undefined with a seven or more digit increment returns the correct string value
Final Release Note
Using $INCREMENT(), ydb_incr_s(), or ydb_incr_st() to increment a variable whose initial value is zero or undefined with an increment of seven digits or more returns the correct string value. Previously, while the numeric value of the result was correct, the string value was the empty string (""
). Depending on how the result was used, it could have been wrong. [#480 (closed)]
Description
While working on wrapping ydb_incr_st I found that when I have an initial value of '0' and I use ydb_incr_st to increment with a number that is 7 digits or more I have errors. If the varname used is a global variable it ydb_incr_st will return nothing and there is nothing in the value of the node. I have attached bug.c that demonstrates this.
(A similar problem with local variable names in my python wrapper is if the varname is a local variable ydb_incr_st returns the correct value but the contents on the next get are garbled (unable to decode the result with 'ascii' or 'utf-8'). Python can't decode it. I can't reproduce this with c though.)
Now if the varname has as it's value something other than '0' everything's fine. Also if there is an 'E' in the number everything is fine (including the meaningless 'E0').
Draft Release Note
The M $INCREMENT() function and the Simple API ydb_incr_s() and the Simple Threaded API ydb_incr_st() functions correctly increment a variable that is either 0 or undefined when the increment value is a (literal in the case of M) value that is 7 significant digits or more. Previously this operation returned a broken value whose binary value was correct but whose string representation was the NULL string so depending on how the value was used, the result may be unexpected.