mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-5.0' into trunk
This commit is contained in:
commit
09c7a3eff0
|
|
@ -229,6 +229,7 @@
|
|||
* Add the ability to disable bulk loading of SSTables (CASSANDRA-18781)
|
||||
* Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787)
|
||||
Merged from 5.0:
|
||||
* Throw RTE instead of FSError when RTE is thrown from FileUtis.write in TOCComponent (CASSANDRA-20917)
|
||||
* Represent complex settings as JSON on system_views.settings table (CASSANDRA-20827)
|
||||
* Sort SSTable TOC entries for determinism (CASSANDRA-20494)
|
||||
* Do not source cassandra-env.sh unnecessarily in nodetool and other tooling (CASSANDRA-20745)
|
||||
|
|
|
|||
|
|
@ -105,35 +105,43 @@ public class TOCComponent
|
|||
{
|
||||
FileUtils.write(tocFile, new ArrayList<>(componentNames), CREATE, TRUNCATE_EXISTING, SYNC);
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
throw new FSWriteError(e, tocFile);
|
||||
throw new RuntimeException("Exception occurred while writing to " + tocFile,
|
||||
ex.getCause() != null ? ex.getCause() : ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads existing TOC file or creates a new one.
|
||||
*
|
||||
* @param descriptor descriptor to load TOC for
|
||||
* @return set of loaded or discovered components
|
||||
* @throws IOError when loading of a component is erroneous
|
||||
* @throws FSWriteError when creating of a new TOC file is erroneous
|
||||
*/
|
||||
public static Set<Component> loadOrCreate(Descriptor descriptor)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
return TOCComponent.loadTOC(descriptor);
|
||||
}
|
||||
catch (FileNotFoundException | NoSuchFileException e)
|
||||
{
|
||||
Set<Component> components = descriptor.discoverComponents();
|
||||
if (components.isEmpty())
|
||||
return components; // sstable doesn't exist yet
|
||||
|
||||
components.add(Components.TOC);
|
||||
TOCComponent.updateTOC(descriptor, components);
|
||||
return components;
|
||||
}
|
||||
return TOCComponent.loadTOC(descriptor);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (FileNotFoundException | NoSuchFileException e)
|
||||
{
|
||||
throw new IOError(e);
|
||||
// if TOC is missing, we might create a new one
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new IOError(ex);
|
||||
}
|
||||
|
||||
Set<Component> components = descriptor.discoverComponents();
|
||||
if (components.isEmpty())
|
||||
return components; // sstable doesn't exist yet
|
||||
|
||||
components.add(Components.TOC);
|
||||
TOCComponent.updateTOC(descriptor, components);
|
||||
return components;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue