You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Joshua McKenzie (JIRA)" <ji...@apache.org> on 2019/07/02 18:22:00 UTC
[jira] [Created] (CASSANDRA-15196) Refactor inheritance around
CommitLogSegment management and allocation
Joshua McKenzie created CASSANDRA-15196:
-------------------------------------------
Summary: Refactor inheritance around CommitLogSegment management and allocation
Key: CASSANDRA-15196
URL: https://issues.apache.org/jira/browse/CASSANDRA-15196
Project: Cassandra
Issue Type: Improvement
Components: Local/Commit Log
Reporter: Joshua McKenzie
Assignee: Joshua McKenzie
Back when I wrote CASSANDRA-8844 and CASSANDRA-12148, a few things about the CommitLog stood out to me that I wasn't in love with. At the time I was much more of the mind of "When in Rome..." regarding some of our structures, our naming, and specifically regarding our penchant for inheritance vs. composition. Turns out I have an itch here I need to scratch.
This patch refactors the CommitLog in a few key ways:
* Removes inheritence for CommitLogSegmentManagerX, instead has a single CommitLogSegmentManager and a CommitLogSegmentAllocator interface
** This interface is implemented by CommitLogSegmentAllocatorStandard and CommitLogSegmentAllocatorCDC
* Renames a few variables and methods within the segment manager to make their purpose and role more clear from names alone (hopefully):
** allocatingFrom --> activeSegment
** allocatingFrom() --> getActiveSegment()
** advanceAllocatingFrom() – switchToNewSegment()
** activeSegments --> unflushedSegments
** getActiveSegments --> getUnflushedSegments()
** awaitAvailableSegment(...) --> awaitSegmentAllocation(...)
** isStillAllocating() --> hasRoom()
* Reorders some of the "allocation-and-compare-in-while-loop-decl) to more idiomatic style
* Adds some comments to various under-documented methods, mostly related to CDC and timing
As far as we are in the 4.0 testing, I don't expect this to hit pre 4.0. Given it's a relatively minor refactor in well-tested code, doesn't change functionality, and doesn't impact any of the publicly exposed APIs in the CommitLog ecosystem, I'd be comfortable with it going in a minor release after 4.0 is out. But I'm open to alternative viewpoints.
Have run unit tests locally w/out issue on both regular and cdc-targets; need to get CI against the branch internally for full dtest run and I'll post when it's done. Just wanted to get visibility to this out there in case anyone was curious or thinking of working on the same thing.
[ Link to branch on github|https://github.com/apache/cassandra/compare/trunk...josh-mckenzie:clean_cl_comp]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org