-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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:delete consensus level #1844
fix:delete consensus level #1844
Conversation
if (g_pika_conf->consensus_level() != 0) { | ||
LogOffset last_log = master_slot->ConsensusLastIndex(); | ||
tmp_stream << db_name << " consensus last_log=" << last_log.ToString() << "\r\n"; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the given code patch, the following changes were made:
- The code block starting at line 1087 and ending at line 1091 was removed. This block checked if the consensus level was not equal to zero and then retrieved the last log index from the master slot using
ConsensusLastIndex()
function.
Code review observations:
- It appears that the functionality related to the consensus level and last log retrieval has been removed in this patch.
- If the removal of this code is intentional and does not affect the desired behavior of the program, then there may not be any bug risks associated with it.
Improvement suggestion:
- Without more context about the intention behind removing the code, it is difficult to provide specific improvement suggestions. However, it is generally important to carefully review the consequences of removing functionality from a codebase.
- If the removal of the consensus-related code was intended, considering adding comments or a code comment explaining the rationale behind removing it can be helpful for future reference and collaboration.
Please note that without further details, it is challenging to provide an in-depth code review. Additionally, reviewing an isolated code patch may not provide a complete understanding of the overall codebase and its dependencies.
} | ||
// level is always 0 | ||
*resp_ptr = std::move(cmd_ptr->res().message()); | ||
resp_num--; | ||
} | ||
|
||
// Initial permission status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review:
-
In the first code block, the lines
if (g_pika_conf->consensus_level() != 0 && c_ptr->is_write())
are commented out. It seems like this logic was removed. If it was intentional, then it's fine. Otherwise, if the check is still required, make sure to update the code accordingly. -
In the second code block, the lines
if (g_pika_conf->consensus_level() != 0 && c_ptr->is_write())
are also commented out. Again, ensure that this change is intentional and aligns with the desired behavior. -
In the third code block, the condition
g_pika_conf->consensus_level() == 0
is always true, and as a result, the code inside the if-block will always execute. This makes the comment misleading. If the intention is to check a different condition or perform different logic based on the consensus level, make sure to update the code accordingly.
Overall, without knowing the specific context and requirements of your application, it's difficult to provide detailed bug risks and improvement suggestions. However, do review the changes made to the code carefully, ensuring they align with the intended functionality. Also, consider updating comments to accurately reflect the code logic.
} | ||
// level is always 0 | ||
*resp_ptr = std::move(cmd_ptr->res().message()); | ||
resp_num--; | ||
} | ||
|
||
// Initial permission status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the provided code patch, here are some observations and suggestions for improvement:
-
Removed code: In the first change, lines 77-78 are removed. This removes an empty line, which seems to be a formatting change and does not affect functionality.
-
Consensus level check: In line 79, there is a check for
consensus_level() != 0
. It is assumed that this condition determines whether the consensus level is non-zero, implying some form of distributed or replicated system. The subsequent if-block modifies the stage of the command based on this condition. Without more context, it is not possible to determine if this change is correct or introduces a bug. -
ExecRedisCmd function: It appears that the function takes a Redis command input, executes it using
DoCmd
, and stores the result inresp_ptr
. The change made in lines 276-281 suggests that now the response is always set to the message obtained from the command execution (cmd_ptr->res().message()
), irrespective of the consensus level or command type. This might be intentional, but without further knowledge of the code and requirements, it's difficult to assess whether this change is appropriate.
In summary, besides the removal of an empty line, the main change is in how the response is handled in the ExecRedisCmd
function. It sets the response to the message obtained from the command execution, regardless of the consensus level or command type. Depending on your specific use case and requirements, this change may or may not be suitable.
CMakeLists.txt
Outdated
@@ -683,7 +681,6 @@ if (USE_PIKA_TOOLS) | |||
make PREFIX=${STAGED_INSTALL_PREFIX} -j${CPU_CORE} install | |||
) | |||
set(BZ2_LIBRARY ${INSTALL_LIBDIR}/libbz2.a) | |||
endif() | |||
|
|||
if(${OS_VERSION} MATCHES "CentOS") | |||
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR_64}/librocksdb.a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the provided code patch, here's a brief code review:
-
The section of code that starts with
option(USE_PIKA_TOOLS "compile pika-tools" OFF)
is commented out usingif (USE_PIKA_TOOLS)
. It appears to disable the compilation ofpika-tools
if the option is not enabled. If this is intentional, there is no bug risk in this specific change. -
The line
set(BZ2_LIBRARY ${INSTALL_LIBDIR}/libbz2.a)
is not dependent on theUSE_PIKA_TOOLS
option, so it should be moved outside theif (USE_PIKA_TOOLS)
block to ensure it is always executed when appropriate. -
Without further context, it is difficult to identify other potential bug risks or improvement suggestions. A more thorough code review would require understanding the purpose and structure of the entire codebase.
Consider providing additional information or specific areas of concern for a more comprehensive analysis.
CMakeLists.txt
Outdated
@@ -683,7 +683,6 @@ if (USE_PIKA_TOOLS) | |||
make PREFIX=${STAGED_INSTALL_PREFIX} -j${CPU_CORE} install | |||
) | |||
set(BZ2_LIBRARY ${INSTALL_LIBDIR}/libbz2.a) | |||
endif() | |||
|
|||
if(${OS_VERSION} MATCHES "CentOS") | |||
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR_64}/librocksdb.a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that there are some changes to the code patch. Here are some observations and suggestions based on the provided code:
-
The
@@ -625,7 +625,6 @@
and@@ -655,6 +654,7 @@
lines indicate changes in the code, but the actual code changes themselves are missing. It would be helpful to have the actual modified code snippets to perform a thorough review. -
The
option(USE_PIKA_TOOLS "compile pika-tools" OFF)
line sets an option to compilepika-tools
. Ensure that this option is being used appropriately throughout the codebase. -
The
ExternalProject_Add(hiredis ...)
section seems to be related to compiling thehiredis
library. Verify that all dependencies required for compilinghiredis
are correctly specified and installed. -
The
ExternalProject_Add(bz2 ...)
section seems to be related to compiling thebz2
library. Similarly, verify that all dependencies required for compilingbz2
are properly specified and installed. -
Check if the libraries (
HIREDIS_LIBRARY
,BZ2_LIBRARY
,ROCKSDB_LIBRARY
) are being used correctly in the subsequent code. Ensure that the paths are accurate and match the actual library locations.
Without the actual modified code, it is difficult to provide a detailed analysis of potential bug risks or improvement suggestions. It is advised to review the modified sections carefully, verify the dependencies, and ensure the correct usage of libraries in the code.
* Optimized code logic (#1834) * fix:delete consensus level (#1844) * delete_consensus_level * Update pika.conf (#1854) * fix:delete_consensus_level (#1852) * delete_consensus_level * fix:shutdown&&slaveof no one too slow (#1859) * fix_slow_shut_down * add go integrate test (#1792) * add go integrate test * add go integrate test * add go integrate test * add go integrate test * temp test * temp test * temp test * temp test * temp test * temp test * add test * temp test * temp test * add tcl * add tcl * reformat code * add tcl * reformat code * add tcl * reformat code * add tcl * fix setxx * fix setxx * add tcl * add tcl * fix: fix some compile error (#1861) Co-authored-by: wangshaoyi <wangshaoyi@meituan.com> * change-version * feat: add diskrecovery command (#1843) * Add diskrecovery command * Add diskrecovery command --------- Co-authored-by: chejinge <945997690@qq.com> Co-authored-by: Yuecai Liu <38887641+luky116@users.noreply.github.com> Co-authored-by: wangshao1 <30471730+wangshao1@users.noreply.github.com> Co-authored-by: wangshaoyi <wangshaoyi@meituan.com>
* delete_consensus_level
* delete_consensus_level
No description provided.