Comments (7)
partition per line would still be issue, but I think a row per line would make this pretty doable so I am all for doing that here and will put it on list right after json2sstable that I'm working on currently.
That said there are streaming json libraries available, jackson, jsonsimple in javaland, and I've used ijson in python to read huge sstables with old sstable2json succesfully.
from sstable-tools.
I've heard about the streaming libraries, however they tend to be rather cumbersome to use, at least the python ones I've tried were. One row per line seems a bit of an issue also as the format you have outlined would not really help because the partition start and end would be on different lines, unless you want to output in a completely different format that duplicates the partition information on every row?.
The idea is to be able to parse with something simple like:
import sys, json
tombstones = 0
for line in sys.stdin:
partition = json.loads(line)
for row in partition['rows']:
if 'deletion_info' in row:
tombstones += 1
continue
for cell in row.get('cells'):
if 'deletion_time' in cell:
tombstones += 1
print str(tombstones) + " tombstones found"
the example above is a bit contrived and might even not work, but it demonstrates a valid and common use case for parsing SSTables, is to find tombstone where there may be clusters of tombstones that can cause issues in the cluster.
from sstable-tools.
also streaming json libraries tend to be rather slow as they sometimes rely on continually attempting to parse incomplete json and catching the exceptions
from sstable-tools.
I tend to worry about doing a partition per line when the concern is OOMing when reading at once. a >1gb partition is bad but far from unheard of - id say its seen a lot in time-seriesey applications. Adding the json overhead this would demolish systems as well. That said I dont know of a good solution short of a weird state machine/custom parsing so maybe a partition per line is best and people with wide rows have to use incremental parsers.
FWIW if you use this as a library instead of a tool its pretty easy. might be good idea for us to add to mvn or something if valuable
final AtomicInteger total = new AtomicInteger(0);
CassandraReader.fromSSTable(sstablePath).readSSTable(sstablePath, null)
.filter(p -> p.isLive())
.forEach(p -> {
p.rows().forEach(unfiltered -> {
if (unfiltered instanceof Row) {
for (Cell cell : ((Row) unfiltered).cells()){
if(!cell.isLive((int)(System.currentTimeMillis() / 1000))) {
total.incrementAndGet();
}...
from sstable-tools.
could always do a cell per line and include all partition key info and deletion info in the object. this will keep objects small and, since everything is sorted, the apps will know when the next partition/row happens because it will change. it will, however, drastically increase the file size if outputting to a file.
also, what about complex types and things like sets, lists. if a row has a 1gb set, this could also be problematic.
generally people doing exceptional things with their partitions are going to be the ones who need this tool the most. it makes most sense to optimize it for those who will need it, rather than for the majority of Cassandra users who will almost never need to use the tool.
from sstable-tools.
from sstable-tools.
Closing since this now exists as the -d
option in sstabledump (which is no longer part of sstable-tools but part of sstabledump in C*)
from sstable-tools.
Related Issues (20)
- Allow using commit log along with sstables HOT 1
- Remove toJson command
- Hinted Handoff dump HOT 1
- Update to support 3.4
- Use command does not do directory expansion, even though autocompletion works
- 3.7 updates HOT 1
- persist fails in new version
- Composite partition key issues HOT 2
- Updates for 3.9
- Offline compaction
- java -jar ~/sstable-tools-3.9.0-alpha9.jar cqlsh always return Tombstone count of 0. HOT 8
- Use github releases instead of bintray HOT 1
- Make build for cassandra 3.11 HOT 1
- Add --gc_grace_seconds option to describe
- Remove describe command when 4.0 release made HOT 2
- Exception when trying to load sstables HOT 1
- Print full stack trace in cqlsh when exceptions encountered
- Investigate aggregations / groupings with paging enabled
- support C* 2.1 version HOT 1
- Could not import schema error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sstable-tools.