Skip to content

Conversation

@mp911de
Copy link
Member

@mp911de mp911de commented Dec 12, 2019

This PR migrates Spring Data Cassandra to the Datastax 4.x driver.

Breaking changes:

Removal of types (without replacement):

  • PoolingOptionsFactoryBean
  • SocketOptionsFactoryBean
  • CassandraClusterFactoryBean
  • CassandraClusterParser
  • CassandraCqlClusterFactoryBean
  • CassandraCqlClusterParser
  • CassandraCqlSessionParser
  • AbstractClusterConfiguration
  • GuavaListenableFutureAdapter
  • ClusterBuilderConfigurer (use SessionBuilderConfigurer instead
  • XML cql namespace (http://www.springframework.org/schema/cql, use http://www.springframework.org/schema/data/cassandra instead)
  • XML cassandra:cluster (endpoint properties merged to cassandra:session)
  • XML cql:template, use cassandra:cql-template instead

Deprecation:

  • CassandraCqlSessionFactoryBean, use CqlSessionFactoryBean instead.
  • CassandraSessionFactoryBean, use CqlSessionFactoryBean instead.
  • AbstractCqlTemplateConfiguration, use AbstractSessionConfiguration instead.
  • CodecRegistryTupleTypeFactory, use SimpleTupleTypeFactory instead.
  • Spring Data's CqlIdentifier, use the driver CqlIdentifier instead.
  • forceQuote attributes as quoting is no longer required. CqlIdentifier properly escapes reserved keywords and takes care of case-sensitivity.
  • fetchSize on QueryOptions and …CqlTemplate types was deprecated, use pageSize instead
  • Schema creation via CqlSessionFactoryBean (cassandra:session) is deprecated. Keyspace creation via CqlSessionFactoryBean (cassandra:session) is not affected.

New Configuration API:

  • CqlSessionFactoryBean
  • InitializeKeyspaceBeanDefinitionParser
  • SessionFactoryFactoryBean including schema creation via KeyspacePopulator
  • XML cassandra:cluster (endpoint properties merged to cassandra:session)
  • XML cassandra:initialize-keyspace namespace support
  • XML cassandra:session-factory with cassandra:script support
  • KeyspacePopulator and SessionFactoryInitializer to initialize a keyspace

Other types of changes:

  • Driver's Name constant class was removed. @CassandraType switched to CassandraSimpleTypeHolder.Name.
  • Driver's ConsistentyLevel constant class was removed and reintroduced as DefaultConsistencyLevel. @Consistency was adapted to DefaultConsistencyLevel.
  • RetryPolicy on QueryOptions and …CqlTemplate types was removed without replacement.
  • Drivers's PagingState type was removed. Paging state now uses ByteBuffer.
  • SimpleUserTypeResolver accepts CqlSession instead of Cluster.
  • SimpleTupleTypeFactory was migrated to enum. SimpleTupleTypeFactory.INSTANCE no longer requires a Cluster/CqlSession context.
  • Introduction of StatementBuilder to functionally

Configuration summary

Driver 4 merges Cluster and Session objects into a single CqlSession object, therefore all Cluster-related API was removed. The Configuration was revised in large parts by removing most configuration items that were moved into DriverConfigLoader that is mostly file-based. This means that SocketOptions, AddressTranslator and many more options are configured now through other means.

XML and Java-based config are adapted.

Keyspace creation is now tied to the CqlSessionFactoryBean and schema creation (types, tables, indexes) are controlled by SessionFactoryFactoryBean.

Changes to Session

The driver now uses CqlSession instead of Session. SessionFactory, …CqlTemplate, and …CassandraTemplate and all related types are migrated accordingly.

Further information:

TODO:

@mp911de mp911de changed the title Migrate to Cassandra Driver 4.x DATACASS-656 - Migrate to Cassandra Driver 4.x Dec 12, 2019
mp911de added 27 commits January 7, 2020 15:46
…oryBean to CassandraCqlSessionFactoryBean.
…oryBean to CassandraCqlSessionFactoryBean.
Use consistently -ref.
We now provide SessionFactoryFactoryBean as factory bean and initializer for a SessionFactory. <cassandra:session-factory>	<cassandra:script	location="my/scripts/schema.cql"/> </cassandra:session-factory>
We now provide a utility class to build CQL statements using a fluent functional declaration.
AsyncResultStream can forward-stream over a AsyncResultStream by fetching subsequent pages and applying either a Consumer or Collector for non-blocking processing of asynchronously fetched results.
…Size and timeout. Use renamed Statement options by introducing new pageSize(…) and timeout(…) methods. Deprecated existing methods. Also, deprecate retryPolicy method in preparation for execution profiles.
Cassandra Driver 4 uses LocalDateTime as type for TIMESTAMP. We want to allow also usage of plain old Date to ease migration.
Forced quoting is now deprecated as we're using CqlIdentifier which is able to determine whether an identifier requires quoting.
Move to Driver's CqlIdentifier in Javadoc.
Collection-type terms cannot properly render tuple values or UDT values so we're translating these to proper CQL using nested term collections.
Fix references to CqlSession.
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
…oryBean to CassandraCqlSessionFactoryBean. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Use consistently -ref. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
We now provide SessionFactoryFactoryBean as factory bean and initializer for a SessionFactory. <cassandra:session-factory>	<cassandra:script	location="my/scripts/schema.cql"/> </cassandra:session-factory> Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
We now provide a utility class to build CQL statements using a fluent functional declaration. AsyncResultStream can forward-stream over a AsyncResultStream by fetching subsequent pages and applying either a Consumer or Collector for non-blocking processing of asynchronously fetched results. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
…Size and timeout. Use renamed Statement options by introducing new pageSize(…) and timeout(…) methods. Deprecated existing methods. Also, deprecate retryPolicy method in preparation for execution profiles. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
mp911de added a commit that referenced this pull request Jan 8, 2020
Cassandra Driver 4 uses LocalDateTime as type for TIMESTAMP. We want to allow also usage of plain old Date to ease migration. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Forced quoting is now deprecated as we're using CqlIdentifier which is able to determine whether an identifier requires quoting. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Move to Driver's CqlIdentifier in Javadoc. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Collection-type terms cannot properly render tuple values or UDT values so we're translating these to proper CQL using nested term collections. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Update license header years to 2020. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
CassandraType is a better place for the name enumeration as it provides the necessary context how Cassandra primitives are used than CassandraSimpleTypeHolder. Original pull request: #167.
mp911de added a commit that referenced this pull request Jan 8, 2020
Fix references to CqlSession. Typos. Original pull request: #167.
@mp911de
Copy link
Member Author

mp911de commented Jan 8, 2020

That's merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant