Skip to content

STAR-894 Port Mockable FS from OSS#269

Merged
djatnieks merged 6 commits intods-trunkfrom
STAR-894-port-mockable-fs
Oct 29, 2021
Merged

STAR-894 Port Mockable FS from OSS#269
djatnieks merged 6 commits intods-trunkfrom
STAR-894-port-mockable-fs

Conversation

@djatnieks
Copy link
Copy Markdown
Member

Ports CASSANDRA-16926 from OSS

writeSnapshotManifest(filesJSONArr, snapshotName);
if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) && !SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace))
writeSnapshotSchema(snapshotName);
if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) && !SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated

* Directory where Cassandra persists logs from audit logging. If this property is not set, the audit log framework
* will set it automatically to {@link CassandraRelevantProperties#LOG_DIR} + "/audit".
*/
LOG_DIR_AUDIT("cassandra.logdir.audit"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not part of mockable FS

/**
* Directory where Cassandra puts its logs, defaults to "." which is current directory.
*/
LOG_DIR("cassandra.logdir", "."),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not part of mockable FS

* Otherwise recreate the bloom filter using the current FP chance.
*
* @param sstableMetadata the sstable metadata, for extracting and changing the FP chance
* @param InvalidateJmxPermissionsCacheTestsstableMetadata the sstable metadata, for extracting and changing the FP chance
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param mismatch

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was an inadvertent change on my part, as this file is only in CC ds-trunk and the only intended change was the import for org.apache.cassandra.io.util.File.

It looks like these javadoc params have been incorrect since this file was introduced; I could simply revert my change, but I think it should be ok to just remove these params.

}
} No newline at end of file

public static RoleOptions getLoginRoleOptions()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not part of mockable FS

Copy link
Copy Markdown

@jasonstack jasonstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djatnieks Thanks for the great work. Overall looks good to me, left some minor comments

@JeremiahDJordan
Copy link
Copy Markdown
Member

72.7% Coverage

I thought our coverage threshold was %80, is it only %70?

throw new ConfigurationException(String.format("Unable to check disk space available to '%s'. Perhaps the Cassandra user does not have the necessary permissions",
conf.commitlog_directory), e);
}
// use 1/4 of available space. See discussion on #10013 and #10199
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the references to? Since this repo is public, I guess it is only OK to refer to Apache ticket.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, use of # seems to be the convention for referencing apache cassandra tickets; I see it all over the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I experienced previously that notation of CASSANDRA-XXXXX was used. But now I see that there are files with the same notation as here.

throw new ConfigurationException(String.format("Unable to check disk space available to '%s'. Perhaps the Cassandra user does not have the necessary permissions",
conf.cdc_raw_directory), e);
}
// use 1/8th of available space. See discussion on #10013 and #10199 on the CL, taking half that for CDC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about referencing tickets.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous response, but yes, it is a C* ticket reference.

@djatnieks
Copy link
Copy Markdown
Member Author

72.7% Coverage

I thought our coverage threshold was %80, is it only %70?

I thought so too, and was (pleasantly) surprised it passed with just over 70% :) Assuming the intention is to maintain 80% then I'll work to add more test coverage here.

@djatnieks
Copy link
Copy Markdown
Member Author

@djatnieks Thanks for the great work. Overall looks good to me, left some minor comments

Thanks for the review @jasonstack, esp. for finding those changes not related to mockable FS - I tried to remove as many as I could spot myself and knew there could be more :)

Copy link
Copy Markdown
Member

@k-rus k-rus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed number of nits, which you see in my comments. I understand that this PR is a port of existing code, still it was discussed that the code standard can be improved and keeping as close as possible to original code is not a target.

I noticed that the patch expands generic imports into specific packages in some files, e.g., java.util.*, but in some files it is not. Is it something for consideration in this PR?

I have some code formatting comments on test code, as I believe the test code should be readable as any other code.

Comment thread src/java/org/apache/cassandra/gms/FailureDetector.java
Comment thread src/java/org/apache/cassandra/io/util/File.java
Comment thread src/java/org/apache/cassandra/io/util/File.java Outdated
Comment thread src/java/org/apache/cassandra/io/util/File.java
Comment thread src/java/org/apache/cassandra/io/util/PathUtils.java Outdated
Comment thread test/unit/org/apache/cassandra/io/util/FileTest.java
Comment thread test/unit/org/apache/cassandra/io/util/FileTest.java
Comment thread test/unit/org/apache/cassandra/io/util/FileTest.java
Comment thread test/unit/org/apache/cassandra/io/util/FileTest.java
Comment thread test/unit/org/apache/cassandra/io/util/FileTest.java
@JeremiahDJordan
Copy link
Copy Markdown
Member

One comment on this. Any changes made to the code to improve it we should make sure to keep track of for submission upstream to OSS C*. While improving the code is good, being close to OSS C* is also good, so we should try to do both as much as we can.

@k-rus
Copy link
Copy Markdown
Member

k-rus commented Oct 28, 2021

One comment on this. Any changes made to the code to improve it we should make sure to keep track of for submission upstream to OSS C*. While improving the code is good, being close to OSS C* is also good, so we should try to do both as much as we can.

@JeremiahDJordan I guess it is a reply to my comment :) The ported code comes from DSE if I don't mistake. My minor suggestions for improvement will likely to bring the ported code closer to OSS requirements.

@JeremiahDJordan
Copy link
Copy Markdown
Member

@k-rus Actually the code here comes from Cassandra trunk. We are porting it back to our 4.0 based branch

@djatnieks
Copy link
Copy Markdown
Member Author

@k-rus Thank you for the review!

As mentioned above, these changes are being ported from C* OSS trunk branch, which is unreleased C* 4.1 (presumably, anyway the next release).

I agree that as we have ported DSE code to CC, we've often taken the opportunity to improve code, however that's a one-time port. Since this is coming from a future OSS release branch, we do have to consider that at some point in the future we'll refresh our code again that may result in merge conflicts.

I applied some suggestions that are not purely formatting. There is an OSS C* code style along with IntelliJ and Eclipse files that can be imported. For instance, I do not believe the C* code style requires if/else to be on separate lines from single expressions. I did not (intentionally) reformat any code when porting the code.

I always find imports somewhat confusing with regard to the rules around when to use .* and when to list each import separately. I sometimes wonder if the import rules are contained in the code style file.

While I was porting I did notice places with unused imports and with out of order (alphabetically) imports and I did occasionally let IntelliJ rearrange them. I hope I did not introduce more imports inconsistency, but I think there is a certain amount always present. Also, I think that merge conflicts with imports are the easiest to handle, as it's possible to accept both changes and then rearrange if needed.

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug B 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 51 Code Smells

74.3% 74.3% Coverage
0.0% 0.0% Duplication

@k-rus
Copy link
Copy Markdown
Member

k-rus commented Oct 29, 2021

Sorry that I missed that it is port from OSS C*. It is described in the ticket but I somehow missed it.
I believe then there is no comments from me :)

@djatnieks djatnieks merged commit 477fda8 into ds-trunk Oct 29, 2021
@djatnieks djatnieks deleted the STAR-894-port-mockable-fs branch October 29, 2021 18:51
pkolaczk pushed a commit that referenced this pull request Nov 5, 2021
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
jacek-lewandowski pushed a commit that referenced this pull request May 26, 2022
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
jacek-lewandowski pushed a commit that referenced this pull request May 27, 2022
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
jacek-lewandowski pushed a commit that referenced this pull request Oct 17, 2022
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
jacek-lewandowski pushed a commit that referenced this pull request Oct 18, 2022
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
mfleming pushed a commit that referenced this pull request Jul 10, 2023
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
djatnieks added a commit that referenced this pull request Jul 24, 2023
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
djatnieks added a commit that referenced this pull request Aug 22, 2023
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)
djatnieks added a commit that referenced this pull request Sep 12, 2023
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
jacek-lewandowski pushed a commit that referenced this pull request Jan 28, 2024
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
djatnieks added a commit that referenced this pull request Mar 29, 2024
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
djatnieks added a commit that referenced this pull request Apr 1, 2024
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
djatnieks added a commit that referenced this pull request Apr 16, 2024
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
djatnieks added a commit that referenced this pull request Jan 30, 2025
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
djatnieks added a commit that referenced this pull request May 18, 2025
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
michaelsembwever pushed a commit that referenced this pull request Feb 6, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)
michaelsembwever pushed a commit that referenced this pull request Feb 10, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)

 (Rebase of commit 417b322)
michaelsembwever pushed a commit that referenced this pull request Feb 11, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)

 (Rebase of commit 417b322)
michaelsembwever pushed a commit that referenced this pull request Feb 12, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)

 (Rebase of commit 417b322)
michaelsembwever pushed a commit that referenced this pull request Feb 14, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)

 (Rebase of commit 417b322)
michaelsembwever pushed a commit that referenced this pull request Feb 16, 2026
* STAR-894 Port [CASSANDRA-16926] CEP-10 Phase 1: Mockable Filesystem

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Aleksey Yeschenko  <aleksey@apache.org>
(cherry picked from commit 477fda8)
(cherry picked from commit c459c65)
(cherry picked from commit 545c778)
(cherry picked from commit 7ae967f)
(cherry picked from commit 3528cd9)

STAR-894 Fix MockSchema missing import for DeletionTime

(cherry picked from commit 3f353a1)

STAR-894 Fix BinLog conflicts with CASSANDRA-17933

(cherry picked from commit e9aa46d)
(cherry picked from commit 5d20b49)

 (Rebase of commit 417b322)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants