Merge branch 'develop' into firewall
This commit is contained in:
@ -470,11 +470,12 @@ static skygw_query_type_t resolve_query_type(
|
||||
* When force_data_modify_op_replication is TRUE, gateway distributes
|
||||
* all write operations to all nodes.
|
||||
*/
|
||||
#if defined(NOT_IN_USE)
|
||||
bool force_data_modify_op_replication;
|
||||
|
||||
force_data_modify_op_replication = FALSE;
|
||||
#endif /* NOT_IN_USE */
|
||||
ss_info_dassert(thd != NULL, ("thd is NULL\n"));
|
||||
|
||||
force_data_modify_op_replication = FALSE;
|
||||
lex = thd->lex;
|
||||
|
||||
/** SELECT ..INTO variable|OUTFILE|DUMPFILE */
|
||||
@ -584,13 +585,15 @@ static skygw_query_type_t resolve_query_type(
|
||||
if (is_log_table_write_query(lex->sql_command) ||
|
||||
is_update_query(lex->sql_command))
|
||||
{
|
||||
#if defined(NOT_IN_USE)
|
||||
if (thd->variables.sql_log_bin == 0 &&
|
||||
force_data_modify_op_replication)
|
||||
{
|
||||
/** Not replicated */
|
||||
type |= QUERY_TYPE_SESSION_WRITE;
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif /* NOT_IN_USE */
|
||||
{
|
||||
/** Written to binlog, that is, replicated except tmp tables */
|
||||
type |= QUERY_TYPE_WRITE; /*< to master */
|
||||
@ -1085,30 +1088,31 @@ char** skygw_get_table_names(GWBUF* querybuf,int* tblsize, bool fullnames)
|
||||
}
|
||||
|
||||
}
|
||||
if(tmp != NULL){
|
||||
char *catnm = NULL;
|
||||
|
||||
char *catnm = NULL;
|
||||
|
||||
if(fullnames)
|
||||
{
|
||||
if(tbl->db && strcmp(tbl->db,"skygw_virtual") != 0)
|
||||
{
|
||||
catnm = (char*)calloc(strlen(tbl->db) + strlen(tbl->table_name) + 2,sizeof(char));
|
||||
strcpy(catnm,tbl->db);
|
||||
strcat(catnm,".");
|
||||
strcat(catnm,tbl->table_name);
|
||||
}
|
||||
}
|
||||
if(fullnames)
|
||||
{
|
||||
if(tbl->db && strcmp(tbl->db,"skygw_virtual") != 0)
|
||||
{
|
||||
catnm = (char*)calloc(strlen(tbl->db) + strlen(tbl->table_name) + 2,sizeof(char));
|
||||
strcpy(catnm,tbl->db);
|
||||
strcat(catnm,".");
|
||||
strcat(catnm,tbl->table_name);
|
||||
}
|
||||
}
|
||||
|
||||
if(catnm)
|
||||
{
|
||||
tables[i++] = catnm;
|
||||
}
|
||||
else
|
||||
{
|
||||
tables[i++] = strdup(tbl->table_name);
|
||||
}
|
||||
if(catnm)
|
||||
{
|
||||
tables[i++] = catnm;
|
||||
}
|
||||
else
|
||||
{
|
||||
tables[i++] = strdup(tbl->table_name);
|
||||
}
|
||||
|
||||
tbl=tbl->next_local;
|
||||
tbl=tbl->next_local;
|
||||
}
|
||||
}
|
||||
lex->current_select = lex->current_select->next_select_in_list();
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ int main(int argc, char** argv)
|
||||
{
|
||||
fgets(readbuff,4092,infile);
|
||||
psize = strlen(readbuff);
|
||||
if(psize < 0 || psize > 4092){
|
||||
continue;
|
||||
}
|
||||
qbuff = gwbuf_alloc(psize + 7);
|
||||
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
|
||||
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
||||
|
@ -34,7 +34,7 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
int rd = 0,buffsz = getpagesize(),strsz = 0,ex_val = 0;
|
||||
char buffer[buffsz], *strbuff = (char*)calloc(buffsz,sizeof(char));
|
||||
char buffer[1024], *strbuff = (char*)calloc(buffsz,sizeof(char));
|
||||
FILE *input,*expected;
|
||||
|
||||
if(mysql_library_init(num_elements, server_options, server_groups))
|
||||
@ -45,25 +45,30 @@ int main(int argc, char** argv)
|
||||
|
||||
input = fopen(argv[1],"rb");
|
||||
expected = fopen(argv[2],"rb");
|
||||
memset(buffer,0,buffsz);
|
||||
while((rd = fread(buffer,sizeof(char),buffsz - 1,input))){
|
||||
|
||||
while((rd = fread(buffer,sizeof(char),1023,input))){
|
||||
|
||||
/**Fill the read buffer*/
|
||||
|
||||
if(strsz + rd >= buffsz){
|
||||
char* tmp = (char*)calloc((buffsz*2),sizeof(char));
|
||||
|
||||
char* tmp = realloc(strbuff,(buffsz*2)*sizeof(char));
|
||||
|
||||
if(!tmp){
|
||||
fprintf(stderr,"Error: Cannot allocate enough memory.");
|
||||
if(tmp == NULL){
|
||||
free(strbuff);
|
||||
fclose(input);
|
||||
fclose(expected);
|
||||
mysql_library_end();
|
||||
fprintf(stderr,"Error: Memory allocation failed.");
|
||||
return 1;
|
||||
}
|
||||
memcpy(tmp,strbuff,buffsz);
|
||||
free(strbuff);
|
||||
strbuff = tmp;
|
||||
buffsz *= 2;
|
||||
}
|
||||
|
||||
memcpy(strbuff+strsz,buffer,rd);
|
||||
strsz += rd;
|
||||
*(strbuff+strsz) = '\0';
|
||||
|
||||
char *tok,*nlptr;
|
||||
|
||||
@ -167,10 +172,10 @@ int main(int argc, char** argv)
|
||||
|
||||
gwbuf_free(buff);
|
||||
}
|
||||
memset(buffer,0,buffsz);
|
||||
}
|
||||
fclose(input);
|
||||
fclose(expected);
|
||||
mysql_library_end();
|
||||
free(strbuff);
|
||||
return ex_val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user