-
Notifications
You must be signed in to change notification settings - Fork 47
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
Read only mode #12
base: master
Are you sure you want to change the base?
Read only mode #12
Conversation
I added --read-only option. If the value of this option is 1 then query parser chooses only select statements from slow log file. Updated percona_playback/query_log/query_log.cc
I removed duplicate contitions from the line 149, because I understand that on this line parser catches only set timestamp commands. But I kept the condition at line 164 because it is important for read-only mode filtering.
@@ -137,13 +141,16 @@ void* ParseQueryLogFunc::operator() (void*) { | |||
tmp_entry.reset(new QueryLogEntry()); | |||
(*this->nr_entries)++; | |||
} | |||
|
|||
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.
Remove trailing spaces on this line
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.
You are right sir. It is fault of IDE and my careless. I removed all trailing spaces which you commented. You can see on the commit with title "Update query_log.cc 15.11.2016"
|
||
return 0; | ||
} | ||
|
||
virtual void run(percona_playback_run_result &result) | ||
{ | ||
FILE* input_file; | ||
|
||
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.
Remove trailing spaces
@@ -156,7 +161,8 @@ void* ParseQueryLogFunc::operator() (void*) { | |||
next_len= len; | |||
break; | |||
} | |||
tmp_entry->add_query_line(std::string(line)); | |||
if((is_ro_mode && (strncmp("select", line, strlen("select")) == 0 || strncmp("SELECT", line, strlen("SELECT")) == 0)) || !is_ro_mode) |
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.
Why not use strnicmp() here instead of two compares? why do we need to do two strlen() calls for a static string?
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.
I corrected this mistake on the commit with title "Update query_log.cc 15.11.2016"
I added --read-only option. If the value of this option is 1 then query parser chooses only select statements from slow log file.
Updated percona_playback/query_log/query_log.cc