-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rocksandra] support cassandra partition deletion
* add a merge operator for parition meta data (currently partition deletion info only) * read partition deletion in cassandra compaction filter and drop rows if it's partition has been deleted
- Loading branch information
Showing
18 changed files
with
512 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2017-present, Facebook, Inc. All rights reserved. | ||
// This source code is licensed under both the GPLv2 (found in the | ||
// COPYING file in the root directory) and Apache 2.0 License | ||
// (found in the LICENSE.Apache file in the root directory). | ||
|
||
#include <jni.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <memory> | ||
#include <string> | ||
|
||
#include "include/org_rocksdb_CassandraPartitionMetaMergeOperator.h" | ||
#include "rocksdb/db.h" | ||
#include "rocksdb/memtablerep.h" | ||
#include "rocksdb/merge_operator.h" | ||
#include "rocksdb/options.h" | ||
#include "rocksdb/slice_transform.h" | ||
#include "rocksdb/statistics.h" | ||
#include "rocksdb/table.h" | ||
#include "rocksjni/portal.h" | ||
#include "utilities/cassandra/merge_operator.h" | ||
|
||
/* | ||
* Class: org_rocksdb_CassandraPartitionMetaMergeOperator | ||
* Method: newCassandraPartitionMetaMergeOperator | ||
* Signature: ()J | ||
*/ | ||
jlong JNICALL | ||
Java_org_rocksdb_CassandraPartitionMetaMergeOperator_newCassandraPartitionMetaMergeOperator( | ||
JNIEnv* /*env*/, jclass /*jclazz*/) { | ||
auto* op = new std::shared_ptr<rocksdb::MergeOperator>( | ||
new rocksdb::cassandra::CassandraPartitionMetaMergeOperator()); | ||
return reinterpret_cast<jlong>(op); | ||
} | ||
|
||
/* | ||
* Class: org_rocksdb_CassandraPartitionMetaMergeOperator | ||
* Method: disposeInternal | ||
* Signature: (J)V | ||
*/ | ||
void JNICALL | ||
Java_org_rocksdb_CassandraPartitionMetaMergeOperator_disposeInternal( | ||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { | ||
auto* op = | ||
reinterpret_cast<std::shared_ptr<rocksdb::MergeOperator>*>(jhandle); | ||
delete op; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
java/src/main/java/org/rocksdb/CassandraPartitionMetaMergeOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2017-present, Facebook, Inc. All rights reserved. | ||
// This source code is licensed under both the GPLv2 (found in the | ||
// COPYING file in the root directory) and Apache 2.0 License | ||
// (found in the LICENSE.Apache file in the root directory). | ||
|
||
package org.rocksdb; | ||
|
||
/** | ||
* merge operator that merges cassandra partition meta data such as | ||
*/ | ||
public class CassandraPartitionMetaMergeOperator extends MergeOperator { | ||
public CassandraPartitionMetaMergeOperator() { | ||
super(newCassandraPartitionMetaMergeOperator()); | ||
} | ||
|
||
private native static long newCassandraPartitionMetaMergeOperator(); | ||
@Override protected final native void disposeInternal(final long handle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.