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

Fix the issue where the CHARSET cannot be retrieved in OceanBase. #881

Open
wants to merge 4 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/pt-archiver
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ sub parse {

my ($keys, $clustered_key) = $self->get_keys($ddl, $opts, \%is_nullable);

my ($charset) = $ddl =~ m/DEFAULT CHARSET=(\w+)/;
my ($charset) = $ddl =~ m/DEFAULT CHARSET\s*=\s*(\w+)/;

return {
name => $name,
Expand Down
7 changes: 6 additions & 1 deletion bin/pt-online-schema-change
Original file line number Diff line number Diff line change
Expand Up @@ -4025,7 +4025,12 @@ sub set_dbh {

my $sql = 'SELECT @@server_id /*!50038 , @@hostname*/, CONNECTION_ID() as connection_id';
PTDEBUG && _d($dbh, $sql);
my ($server_id, $hostname, $connection_id) = $dbh->selectrow_array($sql);
# my ($server_id, $hostname, $connection_id) = $dbh->selectrow_array($sql);
# 因为OB的server_id是在binlog执行的, CONNECTION_ID()是在observer执行的,ODP无法在一个SQL语句中同时拿到这两个变量
# 所以需要分开拿这些变量
my $server_id = $dbh->selectrow_array('SELECT @@server_id');
my $hostname = $dbh->selectrow_array('SELECT @@hostname');
my $connection_id = $dbh->selectrow_array('SELECT CONNECTION_ID() as connection_id');
PTDEBUG && _d($dbh, 'hostname:', $hostname, $server_id);

if ( $self->{dbh} && $self->{dbh} == $dbh && $self->{dbh_set} && $self->{dbh_set} == $connection_id) {
Expand Down