mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
lib/storage: properly unmarshal SearchQuery (#7277)
Some checks are pending
build / Build (push) Waiting to run
CodeQL Go / Analyze (push) Waiting to run
main / lint (push) Waiting to run
main / test (test-full) (push) Blocked by required conditions
main / test (test-full-386) (push) Blocked by required conditions
main / test (test-pure) (push) Blocked by required conditions
Some checks are pending
build / Build (push) Waiting to run
CodeQL Go / Analyze (push) Waiting to run
main / lint (push) Waiting to run
main / test (test-full) (push) Blocked by required conditions
main / test (test-full-386) (push) Blocked by required conditions
main / test (test-pure) (push) Blocked by required conditions
After adding multitenant query feature at v1.104.0, searchQuery wasn't properly unmarshalled at bottom vmselect in multi-level cluster setup. It resulted into empty query responses. This commit adds fallback to Unmarshal method of SearchQuery to fill TenantTokens. It allows to properly execute search requests at vmselect side. Related issue: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7270 --------- Signed-off-by: f41gh7 <nik@victoriametrics.com> Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
This commit is contained in:
parent
066ed48c95
commit
135e3ced8c
@ -28,6 +28,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
|
||||
|
||||
* BUGFIX: [vmgateway](https://docs.victoriametrics.com/vmgateway/): fix possible panic during parsing of a token without `vm_access` claim. This issue was introduced in v1.104.0.
|
||||
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix error messages rendering from overflowing the screen with long messages. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7207).
|
||||
* BUGFIX: `vmselect` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): properly process response in [multi-level cluster setup](https://docs.victoriametrics.com/cluster-victoriametrics/#multi-level-cluster-setup). Before, vmselect could return no data in multi-level setup. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7270) for details. The issue was introduced in [v1.104.0](https://docs.victoriametrics.com/changelog/#v11040).
|
||||
|
||||
## [v1.104.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.104.0)
|
||||
|
||||
|
@ -277,6 +277,11 @@ type SearchQuery struct {
|
||||
AccountID uint32
|
||||
ProjectID uint32
|
||||
|
||||
// TenantTokens and IsMultiTenant is artificial fields
|
||||
// they're only exist at runtime and cannot be transferred
|
||||
// via network calls for keeping communication protocol compatibility
|
||||
// TODO:@f41gh7 introduce breaking change to the protocol later
|
||||
// and use TenantTokens instead of AccountID and ProjectID
|
||||
TenantTokens []TenantToken
|
||||
IsMultiTenant bool
|
||||
|
||||
@ -505,6 +510,7 @@ func (sq *SearchQuery) Unmarshal(src []byte) ([]byte, error) {
|
||||
sq.ProjectID = encoding.UnmarshalUint32(src)
|
||||
src = src[4:]
|
||||
|
||||
sq.TenantTokens = []TenantToken{{AccountID: sq.AccountID, ProjectID: sq.ProjectID}}
|
||||
minTs, nSize := encoding.UnmarshalVarInt64(src)
|
||||
if nSize <= 0 {
|
||||
return src, fmt.Errorf("cannot unmarshal MinTimestamp from varint")
|
||||
|
Loading…
Reference in New Issue
Block a user