Skip to content

Update existing code that expects relative file references - #6616

Open
dlmarion wants to merge 6 commits into
apache:mainfrom
dlmarion:remove-remaining-rel-paths
Open

dlmarion wants to merge 6 commits into
apache:mainfrom
dlmarion:remove-remaining-rel-paths

Conversation

@dlmarion

Copy link
Copy Markdown
Contributor

This change modifies the remaining code that allows for relative RFile and WAL references. The RFiles and WALs that are created today are done with absolute paths, but some of the existing code does not enforce or check that.

This change modifies the remaining code that allows for relative
RFile and WAL references. The RFiles and WALs that are created
today are done with absolute paths, but some of the existing
code does not enforce or check that.
@dlmarion dlmarion self-assigned this Oct 27, 2026
+ "Setting this to zero will make bloom filters load in the foreground.",
"1.3.5"),
TSERV_MEMDUMP_DIR("tserver.dir.memdump", "/tmp", PropertyType.PATH, """
TSERV_MEMDUMP_DIR("tserver.dir.memdump", "file:/tmp", PropertyType.ABSOLUTEPATH, """

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why make this have to be a URI? Its a local file system path and will always be file:/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ed94024

* hdfs://foo:6000/accumulo/tables/4/t0/F000.rf -> 4/t0/F000.rf.
*/
private String makeRelativeFileReference(String path) {
Path referencePath = new Path(path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Had a vague memory of performance problems w/ Path and did some digging and found #3509. So it seems calling getParent() on path is slow. Was wondering if the code below could use the path object and call getParent() instead of doing string parsing, but I guess it should not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A cheap string check would preserve the performance i think. but not sure if gc cpu is a concern

upgradeDataFileCF(key, value, update);
} else if (family.equals(LogColumnFamily.NAME)) {
try {
LogEntry.fromMetaWalEntry(entry);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like this is not actually changing anything in the metadata table, its only validating. There are many other columns in the metadata table that we do not validate on upgrade, so this seems like new functionality in upgrade. We could generalize this to upgrade the metadata table and then the upgrade could do a second scan creating tablet metadata object which would do this validation and more. Not something for this PR, but validating the metadata table on upgrade seems like an interesting concept.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that I want to leave this change here. This PR, and some others, are precursors to a pluggable WAL SPI. What I really want is a check that runs pre-upgrade that confirms that there are no tablets that need recovery. The check currently has to go here because the --prepare step is done after the instance is shut down. I guess another option would be to move this to the --prepare step in the 2.x or 3.1 version and modify the prepare step to check the root tablet, metadata tablet, and user tables to ensure that logs are not present in the tablet metadata.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#6623 includes the changes to the upgrade code that I was thinking about

String[] tokens = path.split("/");
String[] suffix = new String[4];
int suffixLen = 0;
for (int i = tokens.length - 1; i >= 0 && suffixLen < suffix.length; i--) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems much more efficient than the existing makeRelative method which uses a stream. The GC can burn a lot of CPU churning through file refs and in the past CPU has been a bottle neck.

@phrocker

Copy link
Copy Markdown
Contributor

The ITs still build relative paths no? Should those receive the same treatment? Unit tests were converted to relatives...

throw new IllegalArgumentException(badUuidMsg);
}

Path logPath = new Path(path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Logreader passes a user supplied path. A user passing a relative directory path would now get “The path must be an absolute URI” rather than it resolving against the working directory. Consider fs.makequalified(...) or if the caller change is acceptable then this is a non-issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ed94024


this.memDumpDir = config.get(Property.TSERV_MEMDUMP_DIR);
String memDumpDir = config.getPath(Property.TSERV_MEMDUMP_DIR);
Preconditions.checkArgument(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this already checked by SystemPropUtil or PropUtil ( i forget ).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dlmarion

Copy link
Copy Markdown
Contributor Author

The ITs still build relative paths no? Should those receive the same treatment? Unit tests were converted to relatives...

Address in ed94024

@dlmarion

Copy link
Copy Markdown
Contributor Author

Sunny ITs passed

@dlmarion
dlmarion marked this pull request as ready for review October 29, 2026 12:41
@dlmarion dlmarion added this to the 4.0.0 milestone Oct 29, 2026

@phrocker phrocker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look good.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants