[ 
https://issues.apache.org/jira/browse/CASSANDRA-18359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17704546#comment-17704546
 ] 

Stefan Miklosovic edited comment on CASSANDRA-18359 at 3/24/23 11:58 AM:
-------------------------------------------------------------------------

PR is here [https://github.com/apache/cassandra/pull/2243]

It also throws NPE if dir is e.g "/data" which makes this more serious. The 
workaround is to set data_file_directories like
{code:java}
data_file_directories:
    - /data/data
{code}
and move all tables data from /data to /data/data.

[~paulo] I think that we should make setting one of dirs to "/" illegal. It 
does not make sense. If we were to scan all dirs in / for snapshots, we would 
basically have to traverse whole filesystem. That is dangerous, time consuming, 
error prone on ownership etc etc.

Similar exception is thrown in case it is set to "/" already here (it has 
nothing to do with snapshots)

[https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/service/StartupChecks.java#L573]

 
{code:java}
spark_master_1  | Exception (java.lang.NullPointerException) encountered during 
startup: null
spark_master_1  | java.lang.NullPointerException
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:573)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:548)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2732)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12.execute(StartupChecks.java:586)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:174)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:502)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:256)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:751)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:875)
spark_master_1  | ERROR [main] 2023-03-24 11:37:56,843 CassandraDaemon.java:897 
- Exception encountered during startup
spark_master_1  | java.lang.NullPointerException: null
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:573)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:548)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2732)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12.execute(StartupChecks.java:586)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:174)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:502)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:256)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:751)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:875)
 {code}

EDIT: based on slack conversation, we should allow to set other dirs to "/", 
but we still need to fix the exception above. Setting it to "/" as of now does 
not work either.


was (Author: smiklosovic):
PR is here [https://github.com/apache/cassandra/pull/2243]

It also throws NPE if dir is e.g "/data" which makes this more serious. The 
workaround is to set data_file_directories like
{code:java}
data_file_directories:
    - /data/data
{code}
and move all tables data from /data to /data/data.

[~paulo] I think that we should make setting one of dirs to "/" illegal. It 
does not make sense. If we were to scan all dirs in / for snapshots, we would 
basically have to traverse whole filesystem. That is dangerous, time consuming, 
error prone on ownership etc etc.

Similar exception is thrown in case it is set to "/" already here (it has 
nothing to do with snapshots)

[https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/service/StartupChecks.java#L573]

 
{code:java}
spark_master_1  | Exception (java.lang.NullPointerException) encountered during 
startup: null
spark_master_1  | java.lang.NullPointerException
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:573)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:548)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2732)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12.execute(StartupChecks.java:586)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:174)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:502)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:256)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:751)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:875)
spark_master_1  | ERROR [main] 2023-03-24 11:37:56,843 CassandraDaemon.java:897 
- Exception encountered during startup
spark_master_1  | java.lang.NullPointerException: null
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:573)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12$1.preVisitDirectory(StartupChecks.java:548)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2732)
spark_master_1  |     at 
java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks$12.execute(StartupChecks.java:586)
spark_master_1  |     at 
org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:174)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:502)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:256)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:751)
spark_master_1  |     at 
org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:875)
 {code}

> NullPointerException on SnapshotLoader.loadSnapshots
> ----------------------------------------------------
>
>                 Key: CASSANDRA-18359
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18359
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Snapshots
>            Reporter: Paulo Motta
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Node startup fail with on 4.1.1:
> {noformat}
> INFO [main] 2023-03-23 18:13:13,585 MigrationCoordinator.java:257 - Starting 
> migration coordinator and scheduling pulling schema versions every PT1M
> ERROR [main] 2023-03-23 18:13:13,592 CassandraDaemon.java:898 - Exception 
> encountered during startup
> java.lang.NullPointerException: null
>       at 
> org.apache.cassandra.service.snapshot.SnapshotLoader$Visitor.preVisitDirectory(SnapshotLoader.java:106)
>       at 
> org.apache.cassandra.service.snapshot.SnapshotLoader$Visitor.preVisitDirectory(SnapshotLoader.java:77)
>       at java.base/java.nio.file.Files.walkFileTree(Files.java:2732)
>       at 
> org.apache.cassandra.service.snapshot.SnapshotLoader.loadSnapshots(SnapshotLoader.java:162)
>       at 
> org.apache.cassandra.service.snapshot.SnapshotManager.loadSnapshots(SnapshotManager.java:114)
>       at 
> org.apache.cassandra.service.snapshot.SnapshotManager.start(SnapshotManager.java:88)
>       at 
> org.apache.cassandra.service.StorageService.startSnapshotManager(StorageService.java:1050)
>       at 
> org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:1043)
>       at 
> org.apache.cassandra.service.StorageService.initServer(StorageService.java:842)
>       at 
> org.apache.cassandra.service.StorageService.initServer(StorageService.java:775)
>       at 
> org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:425)
>       at 
> org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:752)
>       at 
> org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:876)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to