Closed mhaley-tignis closed 2 years ago
I'm having the same problem. After a bit of digging I found that this happens because the changelog topic creation never happens and is performed automatically by Kafka Server. https://github.com/faust-streaming/faust/blob/71740a347af4d3aff5b7e8839e58b27e6fb2e2b5/faust/topics.py#L65-L70
and partitions=1
is your Kafka Server default.
This is because the method that creates changelog partitions for tables: https://github.com/faust-streaming/faust/blob/71740a347af4d3aff5b7e8839e58b27e6fb2e2b5/faust/tables/base.py#L210-L213
is never called for the key_index
table! I suppose this happens because the key_index
table is never added to app.tables
.
I think a more versatile temporary fix is to do this
table_avg = app.Table('order_average', default=int, partitions=2).tumbling(
timedelta(minutes=1),
expires=timedelta(hours=1),
key_index=True,
).relative_to_now()
app.tables.add(table_avg.key_index_table) # <-- add this line
which will follow the default partition configuration. Still agree with you that this should not be required and should be done automatically.
Checklist
master
branch of Faust.Steps to reproduce
I created a topic with 2 partitions and then tried to create a tumbling window over that topic like this:
With this configuration the application crashes. A workaround is to add the following after creating the tumbling window table:
Expected behavior
The application should create the key-index topic with the correct number of partitions.
Actual behavior
The application created the key-index topic without the correct number of partitions (it seems to always default to 1), causing the application to crash.
Full traceback
Versions
0.6.9
and withfaust-streaming @ git+https://github.com/faust-streaming/faust.git@c1a6b0e216f62fe01f898f7dca7054bb7622161f