From e411abbc7c1db550b0062b067bea20010ee8bcac Mon Sep 17 00:00:00 2001 From: Tommy Brunn Date: Mon, 2 May 2022 12:07:12 +0200 Subject: [PATCH 1/4] Make JavaCompatiblePartitioner new default The JavaCompatiblePartitioner is renamed DefaultPartitioner. The old DefaultPartitioner becomes LegacyPartitioner. --- docs/Producing.md | 24 +++++++----- .../{defaultJava => default}/Test.java | 0 src/producer/partitioners/default/index.js | 2 +- src/producer/partitioners/default/murmur2.js | 38 ++++++++++--------- .../partitioners/default/murmur2.spec.js | 38 ++++++++++--------- .../partitioners/defaultJava/index.js | 4 -- .../partitioners/defaultJava/murmur2.spec.js | 38 ------------------- src/producer/partitioners/index.js | 4 +- src/producer/partitioners/legacy/index.js | 4 ++ .../{default => legacy}/index.spec.js | 2 +- .../{defaultJava => legacy}/murmur2.js | 38 +++++++++---------- .../partitioners/legacy/murmur2.spec.js | 36 ++++++++++++++++++ .../{default => legacy}/partitioner.js | 0 .../{default => legacy}/randomBytes.js | 0 .../{default => legacy}/randomBytes.spec.js | 0 types/index.d.ts | 6 +-- 16 files changed, 119 insertions(+), 115 deletions(-) rename src/producer/partitioners/{defaultJava => default}/Test.java (100%) delete mode 100644 src/producer/partitioners/defaultJava/index.js delete mode 100644 src/producer/partitioners/defaultJava/murmur2.spec.js create mode 100644 src/producer/partitioners/legacy/index.js rename src/producer/partitioners/{default => legacy}/index.spec.js (98%) rename src/producer/partitioners/{defaultJava => legacy}/murmur2.js (55%) create mode 100644 src/producer/partitioners/legacy/murmur2.spec.js rename src/producer/partitioners/{default => legacy}/partitioner.js (100%) rename src/producer/partitioners/{default => legacy}/randomBytes.js (100%) rename src/producer/partitioners/{default => legacy}/randomBytes.spec.js (100%) diff --git a/docs/Producing.md b/docs/Producing.md index bb9a9b47a..a72897053 100644 --- a/docs/Producing.md +++ b/docs/Producing.md @@ -213,16 +213,20 @@ kafka.producer({ createPartitioner: MyPartitioner }) ### Default Partitioners -KafkaJS ships with 2 partitioners: `DefaultPartitioner` and `JavaCompatiblePartitioner`. - -The `JavaCompatiblePartitioner` should be compatible with the default partitioner that ships with the Java Kafka client. This can be important to meet the [co-partitioning requirement](https://docs.confluent.io/current/ksql/docs/developer-guide/partition-data.html#co-partitioning-requirements) when joining multiple topics. - -Use the `JavaCompatiblePartitioner` by importing it and providing it to the Producer constructor: - -```javascript -const { Partitioners } = require('kafkajs') -kafka.producer({ createPartitioner: Partitioners.JavaCompatiblePartitioner }) -``` +KafkaJS ships with 2 partitioners: `DefaultPartitioner` and `LegacyPartitioner`. + +The `DefaultPartitioner` should be compatible with the default partitioner that ships with the Java Kafka client. This can be important to meet the [co-partitioning requirement](https://docs.confluent.io/current/ksql/docs/developer-guide/partition-data.html#co-partitioning-requirements) when joining multiple topics. + +> 🚨 **Important** 🚨 +> +> **The `LegacyPartitioner` was the default until v2.0.0. If you are upgrading from a version +older and want to retain the previous partitioning behavior, use the `LegacyPartitioner` +by importing it and providing it to the Producer constructor:** +> +> ```javascript +> const { Partitioners } = require('kafkajs') +> kafka.producer({ createPartitioner: Partitioners.LegacyPartitioner }) +> ``` ## Retry diff --git a/src/producer/partitioners/defaultJava/Test.java b/src/producer/partitioners/default/Test.java similarity index 100% rename from src/producer/partitioners/defaultJava/Test.java rename to src/producer/partitioners/default/Test.java diff --git a/src/producer/partitioners/default/index.js b/src/producer/partitioners/default/index.js index d441fd6ab..cbdc4f073 100644 --- a/src/producer/partitioners/default/index.js +++ b/src/producer/partitioners/default/index.js @@ -1,4 +1,4 @@ const murmur2 = require('./murmur2') -const createDefaultPartitioner = require('./partitioner') +const createDefaultPartitioner = require('../legacy/partitioner') module.exports = createDefaultPartitioner(murmur2) diff --git a/src/producer/partitioners/default/murmur2.js b/src/producer/partitioners/default/murmur2.js index 3b5661e21..02e531d5c 100644 --- a/src/producer/partitioners/default/murmur2.js +++ b/src/producer/partitioners/default/murmur2.js @@ -1,22 +1,23 @@ /* eslint-disable */ +const Long = require('../../../utils/long') // Based on the kafka client 0.10.2 murmur2 implementation // https://github.com/apache/kafka/blob/0.10.2/clients/src/main/java/org/apache/kafka/common/utils/Utils.java#L364 -const SEED = 0x9747b28c +const SEED = Long.fromValue(0x9747b28c) // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. -const M = 0x5bd1e995 -const R = 24 +const M = Long.fromValue(0x5bd1e995) +const R = Long.fromValue(24) module.exports = key => { const data = Buffer.isBuffer(key) ? key : Buffer.from(String(key)) const length = data.length // Initialize the hash to a random value - let h = SEED ^ length - let length4 = length / 4 + let h = Long.fromValue(SEED.xor(length)) + let length4 = Math.floor(length / 4) for (let i = 0; i < length4; i++) { const i4 = i * 4 @@ -25,27 +26,28 @@ module.exports = key => { ((data[i4 + 1] & 0xff) << 8) + ((data[i4 + 2] & 0xff) << 16) + ((data[i4 + 3] & 0xff) << 24) - k *= M - k ^= k >>> R - k *= M - h *= M - h ^= k + k = Long.fromValue(k) + k = k.multiply(M) + k = k.xor(k.toInt() >>> R) + k = Long.fromValue(k).multiply(M) + h = h.multiply(M) + h = h.xor(k) } // Handle the last few bytes of the input array switch (length % 4) { case 3: - h ^= (data[(length & ~3) + 2] & 0xff) << 16 + h = h.xor((data[(length & ~3) + 2] & 0xff) << 16) case 2: - h ^= (data[(length & ~3) + 1] & 0xff) << 8 + h = h.xor((data[(length & ~3) + 1] & 0xff) << 8) case 1: - h ^= data[length & ~3] & 0xff - h *= M + h = h.xor(data[length & ~3] & 0xff) + h = h.multiply(M) } - h ^= h >>> 13 - h *= M - h ^= h >>> 15 + h = h.xor(h.toInt() >>> 13) + h = h.multiply(M) + h = h.xor(h.toInt() >>> 15) - return h + return h.toInt() } diff --git a/src/producer/partitioners/default/murmur2.spec.js b/src/producer/partitioners/default/murmur2.spec.js index 2a681578c..6723b9607 100644 --- a/src/producer/partitioners/default/murmur2.spec.js +++ b/src/producer/partitioners/default/murmur2.spec.js @@ -8,29 +8,31 @@ describe('Producer > Partitioner > Default > murmur2', () => { }) test('it handles numeric input', () => { - expect(murmur2(0)).toEqual(272173970) + expect(murmur2(0)).toEqual(971027396) }) test('it handles buffer input', () => { - expect(murmur2(Buffer.from('1'))).toEqual(1311020360) + expect(murmur2(Buffer.from('1'))).toEqual(-1993445489) }) }) +// Generated with src/producer/partitioners/defaultJava/Test.java const testData = { - '0': 272173970, - '1': 1311020360, - '128': 2053105854, - '2187': -2081355488, - '16384': 204404061, - '78125': -677491393, - '279936': -622460209, - '823543': 651276451, - '2097152': 944683677, - '4782969': -892695770, - '10000000': -1778616326, - '19487171': -518311627, - '35831808': 556972389, - '62748517': -233806557, - '105413504': -109398538, - '170859375': 102939717, + '0': 971027396, + '1': -1993445489, + '128': -326012175, + '2187': -1508407203, + '16384': -325739742, + '78125': -1654490814, + '279936': 1462227128, + '823543': -2014198330, + '2097152': 607668903, + '4782969': -1182699775, + '10000000': -1830336757, + '19487171': -1603849305, + '35831808': -857013643, + '62748517': -1167431028, + '105413504': -381294639, + '170859375': -1658323481, + '100:48069': 1009543857, } diff --git a/src/producer/partitioners/defaultJava/index.js b/src/producer/partitioners/defaultJava/index.js deleted file mode 100644 index 57a7d9f05..000000000 --- a/src/producer/partitioners/defaultJava/index.js +++ /dev/null @@ -1,4 +0,0 @@ -const murmur2 = require('./murmur2') -const createDefaultPartitioner = require('../default/partitioner') - -module.exports = createDefaultPartitioner(murmur2) diff --git a/src/producer/partitioners/defaultJava/murmur2.spec.js b/src/producer/partitioners/defaultJava/murmur2.spec.js deleted file mode 100644 index 452b4908b..000000000 --- a/src/producer/partitioners/defaultJava/murmur2.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -const murmur2 = require('./murmur2') - -describe('Producer > Partitioner > DefaultJava > murmur2', () => { - test('it works', () => { - Object.keys(testData).forEach(key => { - expect(murmur2(key)).toEqual(testData[key]) - }) - }) - - test('it handles numeric input', () => { - expect(murmur2(0)).toEqual(971027396) - }) - - test('it handles buffer input', () => { - expect(murmur2(Buffer.from('1'))).toEqual(-1993445489) - }) -}) - -// Generated with src/producer/partitioners/defaultJava/Test.java -const testData = { - '0': 971027396, - '1': -1993445489, - '128': -326012175, - '2187': -1508407203, - '16384': -325739742, - '78125': -1654490814, - '279936': 1462227128, - '823543': -2014198330, - '2097152': 607668903, - '4782969': -1182699775, - '10000000': -1830336757, - '19487171': -1603849305, - '35831808': -857013643, - '62748517': -1167431028, - '105413504': -381294639, - '170859375': -1658323481, - '100:48069': 1009543857, -} diff --git a/src/producer/partitioners/index.js b/src/producer/partitioners/index.js index 6cb104902..44d8233bb 100644 --- a/src/producer/partitioners/index.js +++ b/src/producer/partitioners/index.js @@ -1,7 +1,7 @@ const DefaultPartitioner = require('./default') -const JavaCompatiblePartitioner = require('./defaultJava') +const LegacyPartitioner = require('./legacy') module.exports = { DefaultPartitioner, - JavaCompatiblePartitioner, + LegacyPartitioner, } diff --git a/src/producer/partitioners/legacy/index.js b/src/producer/partitioners/legacy/index.js new file mode 100644 index 000000000..be3ce76d6 --- /dev/null +++ b/src/producer/partitioners/legacy/index.js @@ -0,0 +1,4 @@ +const murmur2 = require('./murmur2') +const createLegacyPartitioner = require('./partitioner') + +module.exports = createLegacyPartitioner(murmur2) diff --git a/src/producer/partitioners/default/index.spec.js b/src/producer/partitioners/legacy/index.spec.js similarity index 98% rename from src/producer/partitioners/default/index.spec.js rename to src/producer/partitioners/legacy/index.spec.js index ca796f5eb..9d2a9b735 100644 --- a/src/producer/partitioners/default/index.spec.js +++ b/src/producer/partitioners/legacy/index.spec.js @@ -1,6 +1,6 @@ const createPartitioner = require('./index') -describe('Producer > Partitioner > Default', () => { +describe('Producer > Partitioner > Legacy', () => { let topic, partitioner, partitionMetadata beforeEach(() => { diff --git a/src/producer/partitioners/defaultJava/murmur2.js b/src/producer/partitioners/legacy/murmur2.js similarity index 55% rename from src/producer/partitioners/defaultJava/murmur2.js rename to src/producer/partitioners/legacy/murmur2.js index 02e531d5c..3b5661e21 100644 --- a/src/producer/partitioners/defaultJava/murmur2.js +++ b/src/producer/partitioners/legacy/murmur2.js @@ -1,23 +1,22 @@ /* eslint-disable */ -const Long = require('../../../utils/long') // Based on the kafka client 0.10.2 murmur2 implementation // https://github.com/apache/kafka/blob/0.10.2/clients/src/main/java/org/apache/kafka/common/utils/Utils.java#L364 -const SEED = Long.fromValue(0x9747b28c) +const SEED = 0x9747b28c // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. -const M = Long.fromValue(0x5bd1e995) -const R = Long.fromValue(24) +const M = 0x5bd1e995 +const R = 24 module.exports = key => { const data = Buffer.isBuffer(key) ? key : Buffer.from(String(key)) const length = data.length // Initialize the hash to a random value - let h = Long.fromValue(SEED.xor(length)) - let length4 = Math.floor(length / 4) + let h = SEED ^ length + let length4 = length / 4 for (let i = 0; i < length4; i++) { const i4 = i * 4 @@ -26,28 +25,27 @@ module.exports = key => { ((data[i4 + 1] & 0xff) << 8) + ((data[i4 + 2] & 0xff) << 16) + ((data[i4 + 3] & 0xff) << 24) - k = Long.fromValue(k) - k = k.multiply(M) - k = k.xor(k.toInt() >>> R) - k = Long.fromValue(k).multiply(M) - h = h.multiply(M) - h = h.xor(k) + k *= M + k ^= k >>> R + k *= M + h *= M + h ^= k } // Handle the last few bytes of the input array switch (length % 4) { case 3: - h = h.xor((data[(length & ~3) + 2] & 0xff) << 16) + h ^= (data[(length & ~3) + 2] & 0xff) << 16 case 2: - h = h.xor((data[(length & ~3) + 1] & 0xff) << 8) + h ^= (data[(length & ~3) + 1] & 0xff) << 8 case 1: - h = h.xor(data[length & ~3] & 0xff) - h = h.multiply(M) + h ^= data[length & ~3] & 0xff + h *= M } - h = h.xor(h.toInt() >>> 13) - h = h.multiply(M) - h = h.xor(h.toInt() >>> 15) + h ^= h >>> 13 + h *= M + h ^= h >>> 15 - return h.toInt() + return h } diff --git a/src/producer/partitioners/legacy/murmur2.spec.js b/src/producer/partitioners/legacy/murmur2.spec.js new file mode 100644 index 000000000..2a681578c --- /dev/null +++ b/src/producer/partitioners/legacy/murmur2.spec.js @@ -0,0 +1,36 @@ +const murmur2 = require('./murmur2') + +describe('Producer > Partitioner > Default > murmur2', () => { + test('it works', () => { + Object.keys(testData).forEach(key => { + expect(murmur2(key)).toEqual(testData[key]) + }) + }) + + test('it handles numeric input', () => { + expect(murmur2(0)).toEqual(272173970) + }) + + test('it handles buffer input', () => { + expect(murmur2(Buffer.from('1'))).toEqual(1311020360) + }) +}) + +const testData = { + '0': 272173970, + '1': 1311020360, + '128': 2053105854, + '2187': -2081355488, + '16384': 204404061, + '78125': -677491393, + '279936': -622460209, + '823543': 651276451, + '2097152': 944683677, + '4782969': -892695770, + '10000000': -1778616326, + '19487171': -518311627, + '35831808': 556972389, + '62748517': -233806557, + '105413504': -109398538, + '170859375': 102939717, +} diff --git a/src/producer/partitioners/default/partitioner.js b/src/producer/partitioners/legacy/partitioner.js similarity index 100% rename from src/producer/partitioners/default/partitioner.js rename to src/producer/partitioners/legacy/partitioner.js diff --git a/src/producer/partitioners/default/randomBytes.js b/src/producer/partitioners/legacy/randomBytes.js similarity index 100% rename from src/producer/partitioners/default/randomBytes.js rename to src/producer/partitioners/legacy/randomBytes.js diff --git a/src/producer/partitioners/default/randomBytes.spec.js b/src/producer/partitioners/legacy/randomBytes.spec.js similarity index 100% rename from src/producer/partitioners/default/randomBytes.spec.js rename to src/producer/partitioners/legacy/randomBytes.spec.js diff --git a/types/index.d.ts b/types/index.d.ts index db689f29b..788661b42 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -91,11 +91,11 @@ export interface PartitionerArgs { export type ICustomPartitioner = () => (args: PartitionerArgs) => number export type DefaultPartitioner = ICustomPartitioner -export type JavaCompatiblePartitioner = ICustomPartitioner +export type LegacyPartitioner = ICustomPartitioner export const Partitioners: { - DefaultPartitioner: DefaultPartitioner - JavaCompatiblePartitioner: JavaCompatiblePartitioner + DefaultPartitioner: DefaultPartitioner, + LegacyPartitioner: LegacyPartitioner, } export type PartitionMetadata = { From 6e0943f91bbb7350eec8e20338befc08d9eeb9f0 Mon Sep 17 00:00:00 2001 From: Tommy Brunn Date: Thu, 5 May 2022 12:49:02 +0200 Subject: [PATCH 2/4] Log one-time warning when not specifying a partitioner This is to hopefully avoid people mistakenly using the wrong partitioner because they're relying on the default. This warning will be removed in a future version. --- src/index.js | 15 +++++++++++++++ src/utils/once.js | 10 ++++++++++ src/utils/once.spec.js | 14 ++++++++++++++ src/utils/websiteUrl.js | 6 +++++- src/utils/websiteUrl.spec.js | 13 +++++++------ 5 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 src/utils/once.js create mode 100644 src/utils/once.spec.js diff --git a/src/index.js b/src/index.js index 006844195..ce94c5136 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,8 @@ const createConsumer = require('./consumer') const createAdmin = require('./admin') const ISOLATION_LEVEL = require('./protocol/isolationLevel') const defaultSocketFactory = require('./network/socketFactory') +const once = require('./utils/once') +const websiteUrl = require('./utils/websiteUrl') const PRIVATE = { CREATE_CLUSTER: Symbol('private:Kafka:createCluster'), @@ -20,6 +22,15 @@ const PRIVATE = { } const DEFAULT_METADATA_MAX_AGE = 300000 +const warnOfDefaultPartitioner = once(logger => { + if (process.env.KAFKAJS_NO_PARTITIONER_WARNING == null) { + logger.warn( + `KafkaJS v2.0.0 switched default partitioner. To retain the same partitioning behavior as in previous versions, create the producer with the option "createPartitioner: Partitioners.LegacyPartitioner". See ${websiteUrl( + '/docs/2.0.0/migration-guide-v2.0.0' + )} for details. Silence this warning by setting the environment variable "KAFKAJS_NO_PARTITIONER_WARNING=1"` + ) + } +}) module.exports = class Client { /** @@ -104,6 +115,10 @@ module.exports = class Client { instrumentationEmitter, }) + if (createPartitioner == null) { + warnOfDefaultPartitioner(this[PRIVATE.LOGGER]) + } + return createProducer({ retry: { ...this[PRIVATE.CLUSTER_RETRY], ...retry }, logger: this[PRIVATE.LOGGER], diff --git a/src/utils/once.js b/src/utils/once.js new file mode 100644 index 000000000..c29ba7ba8 --- /dev/null +++ b/src/utils/once.js @@ -0,0 +1,10 @@ +module.exports = fn => { + let called = false + + return (...args) => { + if (!called) { + called = true + return fn(...args) + } + } +} diff --git a/src/utils/once.spec.js b/src/utils/once.spec.js new file mode 100644 index 000000000..753b47063 --- /dev/null +++ b/src/utils/once.spec.js @@ -0,0 +1,14 @@ +const once = require('./once') + +describe('Utils > once', () => { + it('should call the wrapped function only once', () => { + const original = jest.fn().mockReturnValue('foo') + const wrapped = once(original) + + expect(wrapped('hello')).toEqual('foo') + expect(wrapped('hello')).toBeUndefined() + + expect(original).toHaveBeenCalledTimes(1) + expect(original).toHaveBeenCalledWith('hello') + }) +}) diff --git a/src/utils/websiteUrl.js b/src/utils/websiteUrl.js index 0e721d7b2..cb3744247 100644 --- a/src/utils/websiteUrl.js +++ b/src/utils/websiteUrl.js @@ -1,3 +1,7 @@ const BASE_URL = 'https://kafka.js.org' +const stripLeading = char => str => (str.charAt(0) === char ? str.substring(1) : str) +const stripLeadingSlash = stripLeading('/') +const stripLeadingHash = stripLeading('#') -module.exports = (path, hash) => `${BASE_URL}/${path}${hash ? '#' + hash : ''}` +module.exports = (path, hash) => + `${BASE_URL}/${stripLeadingSlash(path)}${hash ? '#' + stripLeadingHash(hash) : ''}` diff --git a/src/utils/websiteUrl.spec.js b/src/utils/websiteUrl.spec.js index 5dc0d8549..3eb461580 100644 --- a/src/utils/websiteUrl.spec.js +++ b/src/utils/websiteUrl.spec.js @@ -1,14 +1,15 @@ const websiteUrl = require('./websiteUrl') describe('Utils > websiteUrl', () => { - it('generates links to the website', () => { - expect(websiteUrl('docs/faq')).toEqual('https://kafka.js.org/docs/faq') + it.each([['docs/faq'], ['/docs/faq']])('generates links to the website', path => { + expect(websiteUrl(path)).toEqual('https://kafka.js.org/docs/faq') }) - it('allows specifying a hash', () => { - expect( - websiteUrl('docs/faq', 'why-am-i-receiving-messages-for-topics-i-m-not-subscribed-to') - ).toEqual( + it.each([ + ['why-am-i-receiving-messages-for-topics-i-m-not-subscribed-to'], + ['#why-am-i-receiving-messages-for-topics-i-m-not-subscribed-to'], + ])('allows specifying an anchor', anchor => { + expect(websiteUrl('docs/faq', anchor)).toEqual( 'https://kafka.js.org/docs/faq#why-am-i-receiving-messages-for-topics-i-m-not-subscribed-to' ) }) From 2c04d918ebb3196b0a43ecfbc5b0c1adcb2c6c3e Mon Sep 17 00:00:00 2001 From: Tommy Brunn Date: Thu, 5 May 2022 12:52:08 +0200 Subject: [PATCH 3/4] Temporarily point to producer docs in warning This will be replaced by a link to the migration guide once available --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index ce94c5136..ff01440b4 100644 --- a/src/index.js +++ b/src/index.js @@ -26,7 +26,8 @@ const warnOfDefaultPartitioner = once(logger => { if (process.env.KAFKAJS_NO_PARTITIONER_WARNING == null) { logger.warn( `KafkaJS v2.0.0 switched default partitioner. To retain the same partitioning behavior as in previous versions, create the producer with the option "createPartitioner: Partitioners.LegacyPartitioner". See ${websiteUrl( - '/docs/2.0.0/migration-guide-v2.0.0' + 'docs/producing', + 'default-partitioners' )} for details. Silence this warning by setting the environment variable "KAFKAJS_NO_PARTITIONER_WARNING=1"` ) } From fdde0ab579707909dad6ce95fe12ef2ff317b554 Mon Sep 17 00:00:00 2001 From: Tommy Brunn Date: Thu, 5 May 2022 13:16:29 +0200 Subject: [PATCH 4/4] Re-export default partitioner as JavaCompatiblePartitioner for backwards compatibility --- src/producer/partitioners/index.js | 7 +++++++ types/index.d.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/producer/partitioners/index.js b/src/producer/partitioners/index.js index 44d8233bb..9fbad60de 100644 --- a/src/producer/partitioners/index.js +++ b/src/producer/partitioners/index.js @@ -4,4 +4,11 @@ const LegacyPartitioner = require('./legacy') module.exports = { DefaultPartitioner, LegacyPartitioner, + /** + * @deprecated Use DefaultPartitioner instead + * + * The JavaCompatiblePartitioner was renamed DefaultPartitioner + * and made to be the default in 2.0.0. + */ + JavaCompatiblePartitioner: DefaultPartitioner, } diff --git a/types/index.d.ts b/types/index.d.ts index 0cfef7584..17c4fde90 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -96,6 +96,13 @@ export type LegacyPartitioner = ICustomPartitioner export const Partitioners: { DefaultPartitioner: DefaultPartitioner, LegacyPartitioner: LegacyPartitioner, + /** + * @deprecated Use DefaultPartitioner instead + * + * The JavaCompatiblePartitioner was renamed DefaultPartitioner + * and made to be the default in 2.0.0. + */ + JavaCompatiblePartitioner: DefaultPartitioner } export type PartitionMetadata = {