Repository navigation
Fix select for update retry - #10102
Conversation
|
@zhangxu19830126 Thanks for your contributions! Here are review comments for file pkg/pb/plan/plan.pb.go: Here are review comments for file pkg/sql/colexec/lockop/lock_op.go: However, there are several issues with this pull request that need addressing:
Here are review comments for file pkg/sql/colexec/lockop/types.go: There are a few issues with this pull request that need addressing:
To optimize the changes made in the pull request, the author could consider providing more detailed comments and documentation to explain the purpose and usage of the modified code. Additionally, they could consider adding test cases to ensure that the new functionality works as expected and does not introduce any regressions. Here are review comments for file pkg/sql/compile/compile.go: However, the pull request lacks a detailed explanation of the problem that the changes aim to solve. It would be helpful to provide more information on the issue and its impact on the codebase. Additionally, the pull request does not include any tests to ensure that the changes do not introduce new issues. It would be best to include tests to validate the changes and ensure that they work as expected. Regarding the changes, it would be better to refactor the code to make it more readable and maintainable. For instance, the if-else block can be simplified by extracting the common code outside the block. This will make the code easier to read and reduce the chances of introducing bugs. Finally, the pull request should follow the project's guidelines for formatting, naming conventions, and documentation. This will ensure that the codebase remains consistent and easy to maintain. Here are review comments for file pkg/sql/compile/operator.go: However, there are a few issues with this pull request that need to be addressed:
To optimize the changes made in the pull request, the following suggestions can be considered:
Overall, while the change proposed in the pull request may be necessary, it is important to provide more context and testing to ensure that it is implemented correctly and does not introduce new issues. Here are review comments for file pkg/sql/compile/scopeRemoteRun.go: However, there are a few issues with the pull request that need addressing:
To address these issues, the pull request should be updated with a more descriptive title and a more detailed body that explains the issue being fixed and how it was discovered. Additionally, the changes made in the Here are review comments for file pkg/sql/plan/query_builder.go: The changes made in the pull request modify the One potential problem with the changes is that the Another potential issue is that the pull request does not include any tests or documentation. It is important to ensure that the changes are thoroughly tested and that any necessary documentation is updated to reflect the changes. To optimize the changes, it may be helpful to provide more detailed comments explaining the purpose and functionality of the new Here are review comments for file proto/pipeline.proto: The changes made in the pull request are focused on adding support for select for update in the lock operator. The changes involve adding a new boolean field "block" to the LockOp message in the pipeline.proto file. One potential problem with the changes is that they may not be optimized for performance. The addition of the "block" field may introduce additional overhead and slow down the lock operator. It would be helpful to have some performance benchmarks to ensure that the changes do not have a negative impact on performance. Another issue with the pull request is that it lacks sufficient testing. It would be helpful to have unit tests that cover the new functionality added by the changes. This would ensure that the changes work as intended and do not introduce any new bugs. To address these issues, the pull request could be updated to include more details about the changes made and how they address the issue. Additionally, performance benchmarks and unit tests could be added to ensure that the changes are optimized and do not introduce new bugs. Here are review comments for file proto/plan.proto:
To address these issues, the pull request author should provide more detailed information about the changes made and their purpose. They should also consider modifying the existing fields instead of adding a new one to avoid compatibility issues. Finally, tests and documentation should be added to ensure that the changes are properly tested and documented. |
Let the lock operator support select for update. For select for update, the query cannot be executed until all the locks on the query rows are completed. Because in case of a conflict, RC mode requires seeing the latest result and retrying. If the query is executed before all locks are completed, the client will receive the wrong data Approved by: @ouyuanning, @m-schen, @nnsgmsone
What type of PR is this?
Which issue(s) this PR fixes:
issue #5004
What this PR does / why we need it:
Let the lock operator support select for update. For select for update, the query cannot be executed until all the locks on the query rows are completed. Because in case of a conflict, RC mode requires seeing the latest result and retrying. If the query is executed before all locks are completed, the client will receive the wrong data