Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-hmadan committed Sep 13, 2024
1 parent 17489c0 commit d02e5ee
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
package net.snowflake.ingest.streaming.internal;

/**
* Class to manage blob path strings that might have an embedded security token if its a presigned url
* Class to manage blob path strings that might have an embedded security token if its a presigned
* url
*/
public class BlobPath {
public final String blobPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package net.snowflake.ingest.streaming.internal;

/**
* Handles uploading files to the Iceberg Table's external volume's table data path
*/
/** Handles uploading files to the Iceberg Table's external volume's table data path */
class ExternalVolume implements IStorage {
@Override
public void put(BlobPath blobPath, byte[] blob) {
throw new RuntimeException("not implemented");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import net.snowflake.ingest.connection.IngestResponseException;
import net.snowflake.ingest.utils.ErrorCode;
import net.snowflake.ingest.utils.Logging;
import net.snowflake.ingest.utils.SFException;

/**
* Class to manage multiple external volumes
*/
/** Class to manage multiple external volumes */
class ExternalVolumeManager implements IStorageManager {
// TODO: Rename all logger members to LOGGER and checkin code formatting rules
private static final Logging logger = new Logging(ExternalVolumeManager.class);
Expand All @@ -34,16 +31,17 @@ class ExternalVolumeManager implements IStorageManager {
// Client prefix generated by the Snowflake server
private final String clientPrefix;

// concurrency control to avoid creating multiple ExternalVolume objects for the same table (if openChannel is called
// concurrency control to avoid creating multiple ExternalVolume objects for the same table (if
// openChannel is called
// multiple times concurrently)
private final Object registerTableLock = new Object();

/**
* Constructor for ExternalVolumeManager
*
* @param isTestMode whether the manager in test mode
* @param role the role of the client
* @param clientName the name of the client
* @param isTestMode whether the manager in test mode
* @param role the role of the client
* @param clientName the name of the client
* @param snowflakeServiceClient the Snowflake service client used for configure calls
*/
ExternalVolumeManager(
Expand All @@ -60,13 +58,15 @@ class ExternalVolumeManager implements IStorageManager {
isTestMode
? "testPrefix"
: this.serviceClient
.clientConfigure(new ClientConfigureRequest(role))
.getClientPrefix();
.clientConfigure(new ClientConfigureRequest(role))
.getClientPrefix();
} catch (IngestResponseException | IOException e) {
throw new SFException(e, ErrorCode.CLIENT_CONFIGURE_FAILURE, e.getMessage());
}

logger.logDebug("Created ExternalVolumeManager with clientName=%s and clientPrefix=%s", clientName, clientPrefix);
logger.logDebug(
"Created ExternalVolumeManager with clientName=%s and clientPrefix=%s",
clientName, clientPrefix);
}

/**
Expand All @@ -81,32 +81,38 @@ public IStorage getStorage(String fullyQualifiedTableName) {
return getVolumeSafe(fullyQualifiedTableName);
}

/**
* Informs the storage manager about a new table that's being ingested into by the client.
*/
/** Informs the storage manager about a new table that's being ingested into by the client. */
@Override
public void registerTable(TableRef tableRef, FileLocationInfo locationInfo) {
if (this.externalVolumeMap.containsKey(tableRef.fullyQualifiedName)) {
logger.logInfo("Skip registering table since its already been registered with the VolumeManager. tableRef=%s", tableRef);
logger.logInfo(
"Skip registering table since its already been registered with the VolumeManager."
+ " tableRef=%s",
tableRef);
return;
}

// future enhancement - per table locks instead of per-client lock
synchronized (registerTableLock) {
if (this.externalVolumeMap.containsKey(tableRef.fullyQualifiedName)) {
logger.logInfo("Skip registering table since its already been registered with the VolumeManager. tableRef=%s", tableRef);
logger.logInfo(
"Skip registering table since its already been registered with the VolumeManager."
+ " tableRef=%s",
tableRef);
return;
}

try {
ExternalVolume externalVolume = new ExternalVolume();
this.externalVolumeMap.put(tableRef.fullyQualifiedName, externalVolume);
} catch (SFException ex) {
logger.logError("ExtVolManager.registerTable for tableRef=% failed with exception=%s", tableRef, ex);
logger.logError(
"ExtVolManager.registerTable for tableRef=% failed with exception=%s", tableRef, ex);
// allow external volume ctor's SFExceptions to bubble up directly
throw ex;
} catch (Exception err) {
logger.logError("ExtVolManager.registerTable for tableRef=% failed with exception=%s", tableRef, err);
logger.logError(
"ExtVolManager.registerTable for tableRef=% failed with exception=%s", tableRef, err);

throw new SFException(
err,
Expand Down
Loading

0 comments on commit d02e5ee

Please sign in to comment.