Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(rocksdb): clean & reformat some code #2200

Merged
merged 10 commits into from
Dec 11, 2023
Merged

refact(rocksdb): clean & reformat some code #2200

merged 10 commits into from
Dec 11, 2023

Conversation

imbajin
Copy link
Member

@imbajin imbajin commented Apr 17, 2023

also mark TODO in some gists

split it for future dev

TODO:

  • fix the CodeQL build error problem (try to use our cmd to build)

also mark TODO in some gists
@@ -218,6 +218,7 @@ public IndexTable(String database, String table) {
}

@Override
// TODO: why this method is same as super.eliminate() in RocksDBTable, del it?
Copy link
Contributor

Choose a reason for hiding this comment

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

added the assert?

Copy link
Member Author

Choose a reason for hiding this comment

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

added the assert?

seems totally same in parent class?

public void eliminate(RocksDBSessions.Session session, BackendEntry entry) {

Copy link
Contributor

Choose a reason for hiding this comment

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

I checked and find out that delete() method is override by IndexTable, we want to call super.delete() instead of this.delete() here. we can add a NOTE here.

@@ -359,6 +358,7 @@ public long estimateNumKeys(RocksDBSessions.Session session) {

@Override
public byte[] position(String position) {
// TODO: START & END is same & be empty now? remove one?
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, but the meanings are different

E.checkArgument(snapshotPath.toFile().exists(),
"The snapshot path '%s' doesn't exist",
snapshotPath);
"The snapshot path '%s' doesn't exist", snapshotPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

it's more clear to keep 3 lines

Copy link
Member Author

Choose a reason for hiding this comment

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

it's more clear to keep 3 lines

seems one phrase for one line to read is better? like

// ① not split
throw new BackendException("Table '%s' is not opened", cfName);

// ② split, not necessary to break one line unless it's too long?
throw new BackendException("Table '%s' is not opened",
                           cfName);

private static Set<String> mergeOldCFs(String path, List<String> cfNames)
throws RocksDBException {
private static Set<String> mergeOldCFs(String path,
List<String> cfNames) throws RocksDBException {
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer the old style

Copy link
Member Author

@imbajin imbajin Apr 17, 2023

Choose a reason for hiding this comment

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

currently, the Exception keyword can't be auto formatted well, so prefer not to align it in a single line

otherwise, it will break the style while formatting the code (with plugin)

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@javeme
Copy link
Contributor

javeme commented Apr 19, 2023

compile error: https://github.com/apache/incubator-hugegraph/pull/2199/files#diff-3744a042d40e54198e87c7271da06363141165f2523541c71e81c820486ca87fR38

Update:
fetched from master code (Found a problem, if we disable "require latest code", we also loose the button to update from the master in GitHub's UI.. 😿 )

@codecov

This comment was marked as off-topic.

@imbajin
Copy link
Member Author

imbajin commented Apr 20, 2023

@zyxxoo more context about the DriverVersion & StoreVersion? CI alert error log

image

And why alert this (without any code logic change)

image

Comment on lines 151 to 152
// TODO: is the typo "EREUSING_ENABLED" right? or should be "REUSING_ENABLED"?
private static final boolean EREUSING_ENABLED = false;
Copy link
Member Author

Choose a reason for hiding this comment

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

need ensure

@javeme javeme added rocksdb RocksDB backend and removed inactive labels May 31, 2023
@javeme javeme removed the inactive label Jul 1, 2023
@javeme

This comment was marked as outdated.

private static Set<String> mergeOldCFs(String path, List<String> cfNames)
throws RocksDBException {
private static Set<String> mergeOldCFs(String path,
List<String> cfNames) throws RocksDBException {
Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@@ -774,7 +754,7 @@ public void resumeSnapshot(String snapshotPrefix, boolean deleteSnapshot) {
}

for (Map.Entry<String, RocksDBSessions> entry :
snapshotPaths.entrySet()) {
snapshotPaths.entrySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

keep in one line?

@@ -359,6 +353,7 @@ public long estimateNumKeys(RocksDBSessions.Session session) {

@Override
public byte[] position(String position) {
// TODO: START & END is same & be empty now? remove one?
Copy link
Contributor

Choose a reason for hiding this comment

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

the values are equaled, but the meanings are different, we can add NOTE for the const define

@@ -218,6 +218,7 @@ public IndexTable(String database, String table) {
}

@Override
// TODO: why this method is same as super.eliminate() in RocksDBTable, del it?
Copy link
Contributor

Choose a reason for hiding this comment

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

I checked and find out that delete() method is override by IndexTable, we want to call super.delete() instead of this.delete() here. we can add a NOTE here.

@github-actions github-actions bot removed the inactive label Sep 10, 2023
@javeme javeme removed the inactive label Oct 11, 2023
@imbajin imbajin added this to the 1.2.0 milestone Oct 27, 2023
@apache apache deleted a comment from github-actions bot Dec 11, 2023
@apache apache deleted a comment from github-actions bot Dec 11, 2023
@apache apache deleted a comment from github-actions bot Dec 11, 2023
for (Pair<byte[], byte[]> change : table.getValue()) {
sst.put(change.getKey(), change.getValue());
}
SstFileWriter sst = table(table.getKey());
Copy link
Contributor

Choose a reason for hiding this comment

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

FIX ME: 'SstFileWriter' used without 'try'-with-resources statement

@apache apache deleted a comment from github-actions bot Dec 11, 2023
@imbajin imbajin merged commit bd5d68f into master Dec 11, 2023
19 of 21 checks passed
@imbajin imbajin deleted the clean-rocksdb branch December 11, 2023 14:21
VGalaxies added a commit to VGalaxies/incubator-hugegraph that referenced this pull request Jan 12, 2024
* chore: merge master to clean-rocksdb for synchronization (apache#2383)

---------

Co-authored-by: V_Galaxy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rocksdb RocksDB backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants