Skip to content

Commit 7cdd93f

Browse files
committed
fix ver
1 parent 482ec78 commit 7cdd93f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

example/cluster_02_create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
$mclq->addSqlDowngrade('DROP DATABASE IF EXISTS shara');
5252

5353

54-
if (!$cl->sendMigration($mclq))
54+
if (!$cl->sendMigration($mclq,true))
5555
{
5656
throw new Exception('sendMigration is bad , error='.$cl->getError());
5757
}

src/Cluster.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public function getError()
348348
return $this->error;
349349
}
350350

351-
public function sendMigration(Cluster\Migration $migration)
351+
public function sendMigration(Cluster\Migration $migration,$showDebug=false)
352352
{
353353
$node_hosts=$this->getClusterNodes($migration->getClusterName());
354354

@@ -359,21 +359,32 @@ public function sendMigration(Cluster\Migration $migration)
359359
foreach ($node_hosts as $node) {
360360
try {
361361
$this->client($node)->ping();
362+
363+
if ($showDebug)
364+
{
365+
echo "client($node)->ping() OK!\n";
366+
}
367+
362368
} catch (QueryException $E) {
363369
$this->error = "Can`t connect or ping ip/node : " . $node;
364370
return false;
365371
}
366372
}
367373

368374

369-
370375
// Выполняем запрос на каждый client(IP) , если хоть одни не отработал то делаем на каждый Down
371376
$need_undo=false;
372377
$undo_ip=[];
373378
foreach ($node_hosts as $node)
374379
{
375380
foreach ($sql_up as $s_u) {
376381
try {
382+
383+
if ($showDebug)
384+
{
385+
echo "client($node)->write(".substr($s_u,0,45).")....\n";
386+
}
387+
377388
if ($this->client($node)->write($s_u)->isError()) {
378389
$need_undo = true;
379390
$this->error = "Host $node result error";

0 commit comments

Comments
 (0)