ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qingping <15075...@qq.com>
Subject Re: (IF NOT EXISTS) in CREATE TABLE statement does not work
Date Tue, 27 Nov 2018 00:44:08 GMT
Start a single instance Ignite server node locally, then connect this Ignite
cluster and run the previous test code, run successfully; then connect the
original distributed three-node Ignite cluster again, the test code also
runs successfully, what is the reason? Will the Ignite client buffer some
information locally?View the service node logs of the distributed three-node
Ignite cluster and report no related errors.The test code that was not
displayed in the previous reply is as follows:		try		{		
Ignition.setClientMode(true);			IgniteConfiguration cfg = new
IgniteConfiguration();			cfg.setIgniteInstanceName("IgniteTest-Client");		
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();		
ipFinder.setAddresses(Arrays.asList("192.168.0.219", "192.168.0.220",
"192.168.0.221"));			TcpDiscoverySpi spi = new TcpDiscoverySpi();		
spi.setIpFinder(ipFinder);			cfg.setDiscoverySpi(spi);			try (Ignite ignite
= Ignition.start(cfg))			{			
Class.forName("org.apache.ignite.IgniteJdbcThinDriver");				try (Connection
conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/"))				{				
try (Statement stmt = conn.createStatement())					{					
stmt.executeUpdate("DROP TABLE IF EXISTS City");					
stmt.executeUpdate("DROP TABLE IF EXISTS Person");						// Create table
based on REPLICATED template.						stmt.executeUpdate("CREATE TABLE IF NOT
EXISTS City(id LONG PRIMARY KEY, name VARCHAR) "								+ "WITH
\"template=replicated\"");						// Create table based on PARTITIONED
template with one backup.						stmt.executeUpdate("CREATE TABLE IF NOT
EXISTS Person ( id LONG, name VARCHAR, city_id LONG,  PRIMARY KEY (id,
city_id)) "								+ "WITH \"backups=1, affinityKey=city_id\"");						//
Create an index on the City table.						stmt.executeUpdate("CREATE INDEX IF
NOT EXISTS idx_city_name ON City (name)");						// Create an index on the
Person table.						stmt.executeUpdate("CREATE INDEX IF NOT EXISTS
idx_person_name ON Person (name)");					}				}			}		}		catch (Exception ex)	
{			ex.printStackTrace();		}



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Mime
View raw message