Skip to content
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

fix: State add flush and fix migration bug #1039

Merged
merged 2 commits into from
Jul 1, 2023
Merged

fix: State add flush and fix migration bug #1039

merged 2 commits into from
Jul 1, 2023

Conversation

yevgenypats
Copy link
Member

@yevgenypats yevgenypats commented Jul 1, 2023

This fixes a bug in state backend where table weren't created.

I also tested it with cloudquery/cloudquery#11855 which seems to work with minor modifications (will open a PR shortly to the CLI PR)

@@ -158,5 +160,5 @@ func (c *Client) GetKey(_ context.Context, key string) (string, error) {
if val, ok := c.mem[key]; ok {
return val, nil
}
return "", fmt.Errorf("key not found")
return "", nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to return "" if not found but we can later on make this an option which the user can decide if they want to use "" or NotFoundErr

@@ -14,6 +14,7 @@ import (
type Client interface {
SetKey(ctx context.Context, key string, value string) error
GetKey(ctx context.Context, key string) (string, error)
Flush(ctx context.Context) error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's flush for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not flushing the content every Set otherwise data is not written back. It is already implemented on the state implementation but just wasn't exposed

@yevgenypats yevgenypats requested a review from disq July 1, 2023 16:44
@yevgenypats yevgenypats merged commit 8c10291 into main Jul 1, 2023
@yevgenypats yevgenypats deleted the fix/state branch July 1, 2023 16:45
kodiakhq bot pushed a commit that referenced this pull request Jul 1, 2023
🤖 I have created a release *beep* *boop*
---


## [4.4.1-rc1](v4.4.0-rc1...v4.4.1-rc1) (2023-07-01)


### Bug Fixes

* **deps:** Update github.com/apache/arrow/go/v13 digest to 5a06b2e ([#1032](#1032)) ([d369262](d369262))
* **deps:** Update golang.org/x/exp digest to 97b1e66 ([#1033](#1033)) ([791e60a](791e60a))
* **deps:** Update google.golang.org/genproto/googleapis/rpc digest to 9506855 ([#1034](#1034)) ([6999d11](6999d11))
* **deps:** Update module github.com/goccy/go-json to v0.10.2 ([#1035](#1035)) ([521eb13](521eb13))
* **deps:** Update module github.com/klauspost/compress to v1.16.6 ([#1036](#1036)) ([76bfc85](76bfc85))
* **serve:** Confusing message ([#1031](#1031)) ([ee873c9](ee873c9))
* State add flush and fix migration bug ([#1039](#1039)) ([8c10291](8c10291))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants