-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildtsi: Do not escape measurement names #9921
Conversation
4f39921
to
aac70ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to think on this a bit... I'm concerned it could be a breaking change because we call into ParseKeyBytes
from the Engine
and Index
when deleting/dropping series.
Since this change would alter the behaviour of ParseKeyBytes
, we might find that users are no longer able to delete certain series that they have stored.
For example, the TSI index might currently store series data under the cp\ u
measurement. When dropping the series cp\ u,server=a
series we currently would check if cp\ u,server=a
was the last series for the measurement cp\ u
in the index.
With this proposed change though, the index will look to see if cp\ u,server=a
is the last series for the cp u
measurement.
As a secondary point—I'm not sure how this change would affect the series writer in the importer
tool @tmgordeeva and @stuartcarnie worked on.
When `influx_inspect buildtsi` is used to create a new `tsi1` index, spaces in measurement names are escaped, so measurement "a b" is changed to "a\ b". This change modifies `models.ParseKeyBytes()` and `models.ParseName()` to unescape measurement names. `models.ParseKeyBytes()` returns unescaped tag keys, so this seems like the natural place to unescape measurement names. Also followed `scanMeasurement()` to see what other code could be problematic, and this should be everything (the result of one other use of `scanMeasurement()` is later escaped). Removed `tsdb.MeasurementFromSeriesKey()`. These methods are exported, so checked for side effects in other InfluxData repositories.
Identified any side effects of this change.
|
Spent some more time confirming each of the "FIXED" cases in my last comment, discovered a bug in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
When
influx_inspect buildtsi
is used to create a newtsi1
index, spaces in measurement names are escaped, so measurement "a b" is changed to "a\ b".This change modifies
models.ParseKeyBytes()
andmodels.ParseName()
to unescape measurement names.models.ParseKeyBytes()
returns unescaped tag keys, so this seems like the natural place to unescape measurement names.Also followed
scanMeasurement()
to see what other code could be problematic, and this should be everything (the result of one other use ofscanMeasurement()
is later escaped).Removed
tsdb.MeasurementFromSeriesKey()
. These methods are exported, so checked for side effects in other InfluxData repositories.After this change, existing TSI indexes that include backslashed measurements created by this bug will need to be rebuilt with
influx_inspect buildtsi
. This consolidates measurements "a b" and "a\ b" into just "a b".Fixes #9904