cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benyi Wang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8281) CQLSSTableWriter close does not work
Date Sat, 27 Dec 2014 20:50:13 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-8281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259482#comment-14259482
] 

Benyi Wang commented on CASSANDRA-8281:
---------------------------------------

I believe the root cause of this problem is QueryProcessor, who creates a thread, but never
shutdowns it.

{code}
private static final ScheduledExecutorService evictionCheckTimer=Executors.newScheduledThreadPool(1);
{code}

I used cassandra-all-2.1.2.jar from maven central. If you run the above example code with
{{Config.setClientMode(true)}} In debug mode in eclipse, you will see the thread created by
QueryProcessor keeps running after the program exits main().

{code}
package org.apache.cassandra.hadoop.cql3;

import org.apache.cassandra.config.Config;
import org.apache.cassandra.io.sstable.CQLSSTableWriter;

public class TWriter2 {

	public static void main(String[] args) {
		String schema = "create table mgindex.test (x int primary key, y int)";
		String insert = "insert into mgindex.test (x,y) values(?,?)";

		Config.setClientMode(true);
		
		CQLSSTableWriter w = CQLSSTableWriter.builder()
				.inDirectory("/tmp/mgindex/test").forTable(schema)
				.using(insert).build();
		try {
			w.addRow(1, 1);
			w.close();
		} catch (Exception e) {
			System.out.println(e);
		}

	}
}
{code}

If you run the similar code in a JUnit test, you won't see this problem. I believe the thread
is terminated by the test runner.

> CQLSSTableWriter close does not work
> ------------------------------------
>
>                 Key: CASSANDRA-8281
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8281
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>         Environment: Cassandra 2.1.1
>            Reporter: Xu Zhongxing
>            Assignee: Benjamin Lerer
>         Attachments: CASSANDRA-8281.txt
>
>
> I called CQLSSTableWriter.close(). But the program still cannot exit. But the same code
works fine on Cassandra 2.0.10.
> It seems that CQLSSTableWriter cannot be closed, and blocks the program from exit.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message