Navigation Menu

Skip to content

Commit

Permalink
logical_select: fix a bug that wrong cache is used
Browse files Browse the repository at this point in the history
If there is only "drilldowns[LABEL].table" difference between 2
queries, latter query uses wrong cache.
  • Loading branch information
kou committed Feb 19, 2018
1 parent 36f5d7f commit e296c85
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/sharding/logical_select.rb
Expand Up @@ -92,6 +92,7 @@ def cache_key(input)
labeled_drilldowns = LabeledDrilldowns.parse(input).sort_by(&:label)
labeled_drilldowns.each do |drilldown|
key << "#{drilldown.label}\0"
key << "#{drilldown.table}\0"
key << "#{drilldown.keys.join(',')}\0"
key << "#{drilldown.output_columns}\0"
key << "#{drilldown.offset}\0"
Expand Down
Expand Up @@ -154,6 +154,17 @@ logical_select Logs --shard_key timestamp --limit 0 --output_columns _id
}
]
]
#>logical_select --drilldowns[action].keys "_key" --drilldowns[action].table "restart" --drilldowns[restart].filter "_key @ 'Restart'" --drilldowns[restart].keys "action" --drilldowns[restart].output_columns "_key" --drilldowns[restart].stage "initial" --drilldowns[start].filter "_key @ 'Start'" --drilldowns[start].keys "action" --drilldowns[start].output_columns "_key" --drilldowns[start].stage "initial" --limit "0" --logical_table "Logs" --output_columns "_id" --shard_key "timestamp"
#:000000000000000 select(2)[Logs_20150203]
#:000000000000000 select(3)[Logs_20150204]
#:000000000000000 select(4)[Logs_20150205]
#:000000000000000 filter(1)
#:000000000000000 filter(2)
#:000000000000000 output(0)
#:000000000000000 output.drilldowns(1)
#:000000000000000 output.drilldowns(1)
#:000000000000000 output.drilldowns(2)
#<000000000000000 rc=0
logical_select Logs --shard_key timestamp --limit 0 --output_columns _id --drilldowns[action].table start --drilldowns[action].keys _key --drilldowns[restart].stage initial --drilldowns[restart].keys 'action' --drilldowns[restart].filter "_key @ 'Restart'" --drilldowns[restart].output_columns _key --drilldowns[start].stage initial --drilldowns[start].keys 'action' --drilldowns[start].filter "_key @ 'Start'" --drilldowns[start].output_columns _key
[
[
Expand Down Expand Up @@ -231,3 +242,14 @@ logical_select Logs --shard_key timestamp --limit 0 --output_columns _id
}
]
]
#>logical_select --drilldowns[action].keys "_key" --drilldowns[action].table "start" --drilldowns[restart].filter "_key @ 'Restart'" --drilldowns[restart].keys "action" --drilldowns[restart].output_columns "_key" --drilldowns[restart].stage "initial" --drilldowns[start].filter "_key @ 'Start'" --drilldowns[start].keys "action" --drilldowns[start].output_columns "_key" --drilldowns[start].stage "initial" --limit "0" --logical_table "Logs" --output_columns "_id" --shard_key "timestamp"
#:000000000000000 select(2)[Logs_20150203]
#:000000000000000 select(3)[Logs_20150204]
#:000000000000000 select(4)[Logs_20150205]
#:000000000000000 filter(2)
#:000000000000000 filter(1)
#:000000000000000 output(0)
#:000000000000000 output.drilldowns(2)
#:000000000000000 output.drilldowns(1)
#:000000000000000 output.drilldowns(2)
#<000000000000000 rc=0
Expand Up @@ -74,6 +74,9 @@ load --table Logs_20150205
}
]

#@sleep 1

#@collect-query-log true
logical_select Logs \
--shard_key timestamp \
--limit 0 \
Expand Down Expand Up @@ -103,3 +106,4 @@ logical_select Logs \
--drilldowns[start].keys 'action' \
--drilldowns[start].filter "_key @ 'Start'" \
--drilldowns[start].output_columns _key
#@collect-query-log false

0 comments on commit e296c85

Please sign in to comment.