Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-562

Cannot execute DELETE query in CUBRID SHARD via PHP API

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: PHP 9.1.0.0003
    • Fix Version/s: PHP 9.1.0 0004
    • Component/s: PHP Driver
    • Labels:
      None
    • Environment:

      Ubuntu 12.0.4 x64
      CUBRID SHARD 9.1.0.1005 x64
      MySQL 5.1.69 as a backend database for CUBRID SHARD
      PHP 5.3.3
      CUBRID PHP 9.1.0.0003

      Description

      I can successfully execute SELECT and INSERT commands while DELETE command fails with the following error in sharding environment:

      {code}
      $ php ThreeEmptyShards.php
      Connected!
      Executing: DELETE FROM tbl_posts /*+ shard_id(0) */
      PHP Warning: Error: CAS, -10100, Unknown error message in /home/vagrant/php/ThreeEmptyShards.php on line 11
      Execute failed: Unknown error message{code}

      The PHP code used is:

      {code}
      <?php
      include_once('shard_connection.php');

      $start_time = microtime(true);

      for ($i = 0; $i < $shards_count; ++$i) {
      $sql = "DELETE FROM tbl_posts /*+ shard_id(" . $i . ") */";

      echo "Executing: " . $sql . "\n";

      if (!cubrid_execute($conn, $sql)) { die("Execute failed: " . cubrid_error_msg()); }
      }

      $end_time = microtime(true);

      echo $shards_count . " shards were emptied in " . ($end_time - $start_time) . " ms.";

      cubrid_disconnect($conn);

      echo "Connection is closed.\n";
      ?>{code}

      shard_connection.php is:

      {code}
      <?php
      include_once('shard_conf.php');

      $conn = cubrid_connect($host, $port, $db_name, $username, $password);

      if (!$conn) {
      die('Connect Error (' . cubrid_error_code() . ')' . cubrid_error_msg());
      }

      echo"Connected!\n";{code}

      shard_conf.php is:

      {code}
      <?php
      $host = "10.11.12.14";
      $port = 45011;
      $db_name = "sharddb";
      $username = "shard";
      $password = "shard123";
      $shards_count = 2;
      $totalRecordsToInsert = 5000;

      date_default_timezone_set('Asia/Seoul');{code}

        Activity

        Hide
        cn15163 杨伟为[Astro] added a comment -

        Fixed. It's caused by cci_prepare_and_execute, since it's not implemented in shard environment.

        Show
        cn15163 杨伟为[Astro] added a comment - Fixed. It's caused by cci_prepare_and_execute, since it's not implemented in shard environment.
        Hide
        kadishmal Esen Sagynov added a comment -

        Oh, I'm very happy! When will you release this patch?

        Show
        kadishmal Esen Sagynov added a comment - Oh, I'm very happy! When will you release this patch?
        Hide
        ryin005 Ray Yin added a comment -

        Added a case to test delete query function in shard environment

        [php@NC-PL-QA011 _14_issues]$ svn ci --username ray -m "[APIS-562] Add a case to test delete query function in shard environment"
        Adding         _14_issues/bug_apis_562
        Adding         _14_issues/bug_apis_562/cases
        Adding         _14_issues/bug_apis_562/cases/bug_apis_562.phpt
        Adding         _14_issues/bug_apis_562/cases/bug_apis_562.sh
        Adding         _14_issues/bug_apis_562/cases/conf
        Adding         _14_issues/bug_apis_562/cases/conf/shard_connection.txt
        Adding         _14_issues/bug_apis_562/cases/conf/shard_key.txt
        Transmitting file data ....
        Committed revision 1983.
        

        Case url: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_14_issues/bug_apis_562/

        Show
        ryin005 Ray Yin added a comment - Added a case to test delete query function in shard environment [php@NC-PL-QA011 _14_issues]$ svn ci --username ray -m "[APIS-562] Add a case to test delete query function in shard environment" Adding _14_issues/bug_apis_562 Adding _14_issues/bug_apis_562/cases Adding _14_issues/bug_apis_562/cases/bug_apis_562.phpt Adding _14_issues/bug_apis_562/cases/bug_apis_562.sh Adding _14_issues/bug_apis_562/cases/conf Adding _14_issues/bug_apis_562/cases/conf/shard_connection.txt Adding _14_issues/bug_apis_562/cases/conf/shard_key.txt Transmitting file data .... Committed revision 1983. Case url: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_14_issues/bug_apis_562/
        Hide
        ryin005 Ray Yin added a comment - - edited

        Test OS: Linux 32/64
        CUBRID Server: CUBRID 9.1 (9.1.0.0212)
        PHP Version: PHP 5.4.15
        CUBRID-PHP: 9.1.0.0004 svn: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/
        Test Tool: PHP Tester (PHPT)

        Test Result: Pass

        Notes: since there is an error to build cubrid shard environment on Windows according to CUBRIDSUS-11614 http://bts4.nhncorp.com/nhnbts/browse/CUBRIDSUS-11614, this issue wouldn't be tested on Windows platform

        Show
        ryin005 Ray Yin added a comment - - edited Test OS: Linux 32/64 CUBRID Server: CUBRID 9.1 (9.1.0.0212) PHP Version: PHP 5.4.15 CUBRID-PHP: 9.1.0.0004 svn: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/ Test Tool: PHP Tester (PHPT) Test Result: Pass Notes: since there is an error to build cubrid shard environment on Windows according to CUBRIDSUS-11614 http://bts4.nhncorp.com/nhnbts/browse/CUBRIDSUS-11614 , this issue wouldn't be tested on Windows platform

          People

          • Assignee:
            cn15163 杨伟为[Astro]
            Reporter:
            kadishmal Esen Sagynov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: