Skip Menu |

This queue is for tickets about the DBD-Cassandra CPAN distribution.

Report information
The Basics
Id: 107158
Status: resolved
Priority: 0/
Queue: DBD-Cassandra

People
Owner: TVDW [...] cpan.org
Requestors: vytdau [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DBI st handle 0x1d57af8 cleared whilst still active.
Date: Fri, 18 Sep 2015 09:31:38 +0100
To: bug-DBD-Cassandra [...] rt.cpan.org
From: Vytautas D <vytdau [...] gmail.com>
Not sure if I am missing something here, but I am always getting following error: DBI st handle 0x1d57af8 cleared whilst still active. dbih_clearcom (sth 0x1d57af8, com 0x1d678f0, imp DBD::Cassandra::st): FLAGS 0x180115: COMSET Active Warn PrintError PrintWarn PARENT DBI::db=HASH(0x1d57630) KIDS 0 (0 Active) NUM_OF_FIELDS 0 NUM_OF_PARAMS 2 following code always triggers it: #!/usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI->connect("dbi:Cassandra::host=127.0.0.1;compression=lz4;consistency=quorum", undef, undef, { RaiseError => 1 }); my $keyspace= "cassandra_tests"; # Start fresh $dbh->do("drop keyspace if exists $keyspace"); $dbh->do("create keyspace $keyspace with replication={'class': 'SimpleStrategy', 'replication_factor': 5}"); $dbh->do("create table $keyspace.login ( username text, address text, end timestamp, changed timeuuid static, PRIMARY KEY ( username, address ) )" ); $dbh->disconnect; sleep(5); # let the change propagate my $dbh2 = DBI->connect("dbi:Cassandra::host=127.0.0.1;compression=lz4;consistency=quorum", undef, undef, { RaiseError => 0 }); my $sth = $dbh2->prepare("BEGIN BATCH INSERT INTO $keyspace.login (username, changed) VALUES (?, now()) IF NOT EXISTS UPDATE $keyspace.login SET end='2015-09-15' WHERE username=? AND address='1.1.1.1' APPLY BATCH;", ); $sth->execute( "1-alice-1", "1-alice-1" ); $dbh2->disconnect; Thank you, Vytas Dauksa
On Fri Sep 18 04:32:01 2015, vytdau@gmail.com wrote: Show quoted text
> Not sure if I am missing something here, but I am always getting > following error: > DBI st handle 0x1d57af8 cleared whilst still active. > dbih_clearcom (sth 0x1d57af8, com 0x1d678f0, imp > DBD::Cassandra::st): > FLAGS 0x180115: COMSET Active Warn PrintError PrintWarn > PARENT DBI::db=HASH(0x1d57630) > KIDS 0 (0 Active) > NUM_OF_FIELDS 0 > NUM_OF_PARAMS 2 > > following code always triggers it: > #!/usr/bin/perl > > use strict; use warnings; > > use DBI; > > my $dbh = DBI-
> >connect("dbi:Cassandra::host=127.0.0.1;compression=lz4;consistency=quorum",
> undef, undef, { RaiseError => 1 }); > > my $keyspace= "cassandra_tests"; > > # Start fresh > $dbh->do("drop keyspace if exists $keyspace"); > $dbh->do("create keyspace $keyspace with replication={'class': > 'SimpleStrategy', 'replication_factor': 5}"); > > $dbh->do("create table $keyspace.login ( > username text, > address text, > end timestamp, > changed timeuuid static, > PRIMARY KEY ( username, address ) > )" > ); > > $dbh->disconnect; > > sleep(5); # let the change propagate > > my $dbh2 = DBI-
> >connect("dbi:Cassandra::host=127.0.0.1;compression=lz4;consistency=quorum",
> undef, undef, { RaiseError => 0 }); > > my $sth = $dbh2->prepare("BEGIN BATCH > INSERT INTO $keyspace.login (username, changed) > VALUES (?, now()) > IF NOT EXISTS > UPDATE $keyspace.login > SET end='2015-09-15' > WHERE username=? AND address='1.1.1.1' > APPLY BATCH;", > ); > > $sth->execute( "1-alice-1", "1-alice-1" ); > > $dbh2->disconnect; > > > Thank you, > Vytas Dauksa
Thanks for the report. I was able to reproduce this and the issue is now fixed: https://github.com/TvdW/perl-DBD-Cassandra/commit/deab81821a8f4f00f44cad45dcbf5c3bce2de5c7 Interestingly, Cassandra returns a non-empty result set for the batch you're doing, and DBI throws a warning because you don't read every row in the result set, and you don't call "$sth->finish" (which you shouldn't have to). After the patch, handles with meaningless data in the buffer will no longer warn.