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

#1018 Migration: Append_GetRange #1095

Merged
merged 31 commits into from
Oct 21, 2024

Conversation

bhima2001
Copy link
Contributor

@bhima2001 bhima2001 commented Oct 14, 2024

migrated GETRANGE from eval.go to store_eval.go, modified all the test cases. This pr closes #1018

  • Migrated the evalXXX function with the latest definition
  • Update or add unit tests for the new implementation.
  • All unit tests pass successfully.
  • Ensure all integration tests pass successfully.
  • Ensure integration tests are added for the migrated command on multi-threaded resp server.
  • Move Integration tests for the respective commands under the RESP integration tests directory from Async directory
  • Please validate that the documentation for the respective commands is up to date. If not then consider adding them.

@benjaminmishra
Copy link
Contributor

LGTM

@bhima2001
Copy link
Contributor Author

I need to migrate APPEND too.

@soumya-codes
Copy link
Contributor

soumya-codes commented Oct 15, 2024

@bhima2001 lets ensure that the corresponding integration tests are migrated as well. cc @AshwinKul28

I have added the checklist to the PR description. Please fill the same.
Please let me or Ashwin know if you have any doubts/concern.

@soumya-codes soumya-codes added the migration -- command Migrates current eval to a refactored eval for all protocols functionality label Oct 15, 2024
@JyotinderSingh
Copy link
Collaborator

Please fix the merge conflicts

@bhima2001
Copy link
Contributor Author

bhima2001 commented Oct 17, 2024

@JyotinderSingh @benjaminmishra I am not able to identify the reason for why the integration tests are failing. can you please nudge into the right direction. Thanks.

@benjaminmishra
Copy link
Contributor

@bhima2001 I can see at least one test failing may be more. Can I pull you branch to check it out ?

@bhima2001
Copy link
Contributor Author

You are talking about this test case right "FAIL: TestGetSet/GETSET_error_when_key_exists_but_does_not_hold_a_string_value". But this testcase is not failing when i testing it individually/

Copy link
Contributor

@lucifercr07 lucifercr07 left a comment

Choose a reason for hiding this comment

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

LGTM, minor comment.

integration_tests/commands/async/getrange_test.go Outdated Show resolved Hide resolved
@soumya-codes soumya-codes self-requested a review October 18, 2024 13:43
@bhima2001
Copy link
Contributor Author

Hey, @soumya-codes I have added docs for both "GETRANGE" and "APPEND" commands using the mentioned format. Please let me know if any further changes need to be made.

Copy link
Contributor

@apoorvyadav1111 apoorvyadav1111 left a comment

Choose a reason for hiding this comment

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

Hi @bhima2001 , Thanks for the changes, Please consider my review comments.

docs/src/content/docs/commands/APPEND.md Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
integration_tests/commands/http/append_test.go Outdated Show resolved Hide resolved
integration_tests/commands/http/append_test.go Outdated Show resolved Hide resolved
integration_tests/commands/http/getrange_test.go Outdated Show resolved Hide resolved

key := args[0]
obj := store.Get(key)
if obj == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like we will return "" even if the start and end values are invalid. This is a deviation from the expected behavior for GETRANGE. Could you please check on this and add this test case in integration and unit tests. Thanks

Copy link
Contributor Author

@bhima2001 bhima2001 Oct 20, 2024

Choose a reason for hiding this comment

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

@apoorvyadav1111 If the start and end are invalid then we throw the following error "ERR value is not an integer or out of range". The above mention case is when an object with the given key is not present in the store

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but even in that case, we must not return a result but an error

}
case object.ObjEncodingInt:
str = strconv.FormatInt(obj.Value.(int64), 10)
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

getrange works for other data type such as bytearray as well, please check and update code accordingly. Please add test cases in integration tests and unit tests. Thanks

storedValue, _ = strconv.ParseInt(value, 10, 64)
case object.ObjEncodingEmbStr, object.ObjEncodingRaw:
storedValue = value
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

append can also work with other data types such as byte array, please check for others

case object.ObjEncodingEmbStr, object.ObjEncodingRaw:
// If the encoding is a string, retrieve the string value for concatenation
currentValueStr = obj.Value.(string)
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

internal/eval/store_eval.go Show resolved Hide resolved
@apoorvyadav1111
Copy link
Contributor

Hi @bhima2001 , please resolve the conversations that have been addressed and let me know if its ready for review.

Copy link
Contributor

@lucifercr07 lucifercr07 left a comment

Choose a reason for hiding this comment

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

LGTM, Minor doc changes suggested.

docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
@bhima2001
Copy link
Contributor Author

@apoorvyadav1111 I would suggest to create a new issue for functionality changes for getrange and assign it to me. Because there are a lot of changes in this PR already and resolving merge conflicts everyday is getting more and more difficult. I would love to pick the code changes issue.
Thanks.

@apoorvyadav1111
Copy link
Contributor

Hi @bhima2001, please create an issue with the functionalities we discussed and I will assign that to you. Please close that issue on priority. This PR is ready to merge once all comments from @lucifercr07 are addressed.

Thanks for taking this humongous task and closing it.

Copy link
Contributor

@apoorvyadav1111 apoorvyadav1111 left a comment

Choose a reason for hiding this comment

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

Please rebase your PR. Changes are approved but cannot merge until conflicts

Copy link
Contributor

@apoorvyadav1111 apoorvyadav1111 left a comment

Choose a reason for hiding this comment

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

Hi @bhima2001 , Thank you these changes and addressing all the comments Approving the PR with an additional commit to fix some typos + addressing review from @lucifercr07 .

For Reviewer's Checklist for Migration label PR/Issues

  • moved code from eval.go to store_eval.go
  • updated cmd meta in eval, worker & server
  • moved tests from async to resp
  • added/updated tests in http and websocket
  • added/updated unit tests in eval folder
  • audited documentation and updated as per new standards
  • no changes in legacy async code / eval.go file
  • rebased with master
  • verified the code in local

Thanks

docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
docs/src/content/docs/commands/GETRANGE.MD Outdated Show resolved Hide resolved
@apoorvyadav1111 apoorvyadav1111 changed the title Migration: Append_GetRange #1018 Migration: Append_GetRange Oct 21, 2024
@apoorvyadav1111 apoorvyadav1111 merged commit 26e7e02 into DiceDB:master Oct 21, 2024
2 checks passed
KanniShashankh pushed a commit to KanniShashankh/dice that referenced this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration -- command Migrates current eval to a refactored eval for all protocols functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command Migration: ('APPEND', 'GETRANGE')
6 participants