403Webshell
Server IP : 104.21.38.3  /  Your IP : 162.158.107.2
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/mysql-test/suite/group_replication/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/suite/group_replication/t/gr_basic_crud_on_doc.test
##############################################################################
## WL#9053 : Group Replication: Push Group Replication Plugin to mysql-trunk
##
## This test checks the basic functionality(CRUD operations on doc) of group
## replication plugin along with mysqlx plugin.
##
## NOTE : All the queries through mysqlx plugin is passed using mysqlxtest.
##
## Steps involved in this test :
## 0. This test requires 3 servers.
## 1. Start 3 servers loaded with both mysqlx and group replication plugin.
## 2. Start group replication on server1 as bootstrap server for the group.
## 3. Start group replication on other two servers as non bootstrap server.
## 4. Wait until all three servers come online.
## 5. Perform ddl and dml operations on all the three servers.
##     a) server1 : Create Collection "characters" and perform CRUD on it.
##     b) server2 : Perform CRUD operation on "characters"
##     c) server3 : Perform CRUD operation on "characters"
## 6. Print the Collection onto result file so that it can be verified.
## 7. Stop group replication on all the servers.
##############################################################################

--source include/have_mysqlx_plugin.inc
--source ../inc/have_group_replication_plugin_base.inc

--let plugins= MYSQLXPLUGIN,GROUP_REPLICATION
--source include/check_plugin_dir.inc

## This initial setup starts three servers with all the prerequisites required
## for GR to start

--source ../inc/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source ../inc/group_replication.inc

## Install Mysqlx plugin on all servers and fetch the mysqlx_port to the local
## variables

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source ../inc/start_and_bootstrap_group_replication.inc
--replace_regex /\.dll/.so/
--eval INSTALL PLUGIN mysqlx SONAME '$MYSQLXPLUGIN'
--let $mysqlx_port1= `Select @@Global.mysqlx_port`

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--replace_regex /\.dll/.so/
--eval INSTALL PLUGIN mysqlx SONAME '$MYSQLXPLUGIN'
--let $mysqlx_port2= `Select @@Global.mysqlx_port`

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--replace_regex /\.dll/.so/
--eval INSTALL PLUGIN mysqlx SONAME '$MYSQLXPLUGIN'
--let $mysqlx_port3= `Select @@Global.mysqlx_port`

## Temp file for performing crud operation on collection "characters" from
## server1

--write_file $MYSQL_TMP_DIR/crud_on_server1.tmp
Mysqlx.Sql.StmtExecute {
  stmt: "list_objects"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "test"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: ""
      }
    }
  }
  namespace: "xplugin"
}
-->recvresult
Mysqlx.Sql.StmtExecute {
  stmt: "create_collection"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "test"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "characters"
      }
    }
  }
  namespace: "xplugin"
}
-->recvresult

Mysqlx.Crud.Insert {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "6c706242055ae611fd36b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "John Snow"
              }
            }
          }
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Insert {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "ac1fc3b0055ae611fd36b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Rob Stark"
              }
            }
          }
        }
      }
    }
  }
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "4261c3b0055ae611fd36b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Arya Stark"
              }
            }
          }
        }
      }
    }
  }
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "6e62c3b0055ae611fd36b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Brandon Stark"
              }
            }
          }
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Update {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  criteria {
    type: OPERATOR
    operator {
      name: "=="
      param {
        type: IDENT
        identifier {
          document_path {
            type: MEMBER
            value: "name"
          }
        }
      }
      param {
        type: LITERAL
        literal {
          type: V_OCTETS
          v_octets {
            value: "John Snow"
          }
        }
      }
    }
  }
  operation {
    source {
      document_path {
        type: MEMBER
        value: "House"
      }
    }
    operation: ITEM_SET
    value {
      type: LITERAL
      literal {
        type: V_STRING
        v_string {
          value: "Targaryen"
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Find {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
}
-->recvresult
EOF

--exec $MYSQLXTEST -u root --port=$mysqlx_port1 --file=$MYSQL_TMP_DIR/crud_on_server1.tmp 2>&1

## Wait for synchronization between the nodes.

--source include/rpl_sync.inc

## Temp file for performing crud operation on collection "characters" from server2
--write_file $MYSQL_TMP_DIR/crud_on_server2.tmp
Mysqlx.Crud.Update {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  criteria {
    type: OPERATOR
    operator {
      name: "&&"
      param {
        type: OPERATOR
        operator {
          name: "=="
          param {
            type: IDENT
            identifier {
              document_path {
                type: MEMBER
                value: "House"
              }
            }
          }
          param {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Targaryen"
              }
            }
          }
        }
      }
      param {
        type: OPERATOR
        operator {
          name: "=="
          param {
            type: IDENT
            identifier {
              document_path {
                type: MEMBER
                value: "name"
              }
            }
          }
          param {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "John Snow"
              }
            }
          }
        }
      }
    }
  }
  operation {
    source {
      document_path {
        type: MEMBER
        value: "House"
      }
    }
    operation: ARRAY_APPEND
    value {
      type: LITERAL
      literal {
        type: V_STRING
        v_string {
          value: "Stark"
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Insert {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark "
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "1616f2480b5ae611c319b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Sansa Stark"
              }
            }
          }
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Delete {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  criteria {
    type: OPERATOR
    operator {
      name: "like"
      param {
        type: IDENT
        identifier {
          document_path {
            type: MEMBER
            value: "name"
          }
        }
      }
      param {
        type: LITERAL
        literal {
          type: V_OCTETS
          v_octets {
            value: "Robb%"
          }
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Find {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
}
-->recvresult
EOF
--exec $MYSQLXTEST -u root --port=$mysqlx_port2 --file=$MYSQL_TMP_DIR/crud_on_server2.tmp 2>&1

## Wait for synchronization between the nodes.

--source include/rpl_sync.inc

## Temp file for performing crud operation on collection "characters" from server3
--write_file $MYSQL_TMP_DIR/crud_on_server3.tmp

Mysqlx.Crud.Insert {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "8cd5d2d90e5ae611e325b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Benjen Stark"
              }
            }
          }
        }
      }
    }
  }
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "House"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Stark"
              }
            }
          }
        }
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "b2d7d2d90e5ae611e325b86b23c1b9b9"
              }
            }
          }
        }
        fld {
          key: "name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Ned Stark"
              }
            }
          }
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Update {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  criteria {
    type: OPERATOR
    operator {
      name: "=="
      param {
        type: IDENT
        identifier {
          document_path {
            type: MEMBER
            value: "name"
          }
        }
      }
      param {
        type: LITERAL
        literal {
          type: V_OCTETS
          v_octets {
            value: "Arya Stark"
          }
        }
      }
    }
  }
  operation {
    source {
      document_path {
        type: MEMBER
        value: "name"
      }
    }
    operation: ITEM_SET
    value {
      type: LITERAL
      literal {
        type: V_STRING
        v_string {
          value: "A girl has NoName"
        }
      }
    }
  }
}
-->recvresult

Mysqlx.Crud.Delete {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
  limit {
    row_count: 3
  }
}
-->recvresult

Mysqlx.Crud.Find {
  collection {
    name: "characters"
    schema: "test"
  }
  data_model: DOCUMENT
}
-->recvresult
Mysqlx.Sql.StmtExecute {
  stmt: "drop_collection"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "test"
      }
    }
  }
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "characters"
      }
    }
  }
  namespace: "xplugin"
}
-->recvresult
EOF
--exec $MYSQLXTEST -u root --port=$mysqlx_port3 --file=$MYSQL_TMP_DIR/crud_on_server3.tmp 2>&1

--echo Waiting for servers to come online

## Cannot use diff_tables.inc because of the following warning.
## Warning 1235 This version of MySQL doesn't yet support 'sorting of
## non-scalar JSON values'

## Wait for synchronization between the nodes.

--source include/rpl_sync.inc

--echo Stopping Gr on all the servers

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $group_replication_member_state= OFFLINE
--source ../inc/gr_wait_for_member_state.inc
UNINSTALL PLUGIN mysqlx;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $group_replication_member_state= OFFLINE
--source ../inc/gr_wait_for_member_state.inc
UNINSTALL PLUGIN mysqlx;

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $group_replication_member_state= OFFLINE
--source ../inc/gr_wait_for_member_state.inc
UNINSTALL PLUGIN mysqlx;

--remove_file $MYSQL_TMP_DIR/crud_on_server1.tmp
--remove_file $MYSQL_TMP_DIR/crud_on_server2.tmp
--remove_file $MYSQL_TMP_DIR/crud_on_server3.tmp
--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit