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

Read only mode #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

elshadaghazade
Copy link

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 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)++;
}

Copy link
Contributor

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

Copy link
Author

@elshadaghazade elshadaghazade Nov 15, 2016

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;

Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants