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

SNOW-348856 XP regression revert to last known working commit #311

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ set (SOURCE_FILES_PUT_GET
cpp/logger/SFAwsLogger.hpp
cpp/logger/SFLogger.cpp
cpp/logger/SFLogger.hpp
cpp/logger/SecretDetector.cpp
cpp/logger/SecretDetector.hpp
include/snowflake/IFileTransferAgent.hpp
include/snowflake/ISFLogger.hpp
include/snowflake/IStatementPutGet.hpp
Expand Down
24 changes: 24 additions & 0 deletions ci/dev/CentOS-Base.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# yum repo file for snowflake internal backup yum repo
# Used as a temporary fix for ODBC docker before moving docker
# maintenace to Engineer Infra Team

[base]
name=CentOS-$releasever - Base
baseurl=http://repo.int.snowflakecomputing.com:81/repos/base
gpgcheck=1
priority=10
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-$releasever - Updates
baseurl=http://repo.int.snowflakecomputing.com:81/repos/updates
gpgcheck=1
priority=10
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-$releasever - Extras
baseurl=http://repo.int.snowflakecomputing.com:81/repos/extras
gpgcheck=1
priority=10
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
13 changes: 13 additions & 0 deletions ci/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
ARG BASE_IMAGE_NAME
FROM $BASE_IMAGE_NAME
ARG LOCAL_USER_ID

# replace outdated yum repo link with snowflake internal links
COPY CentOS-Base.repo /etc/yum.repos.d/
CMD chmod 644 /etc/yum.repos.d/CentOS-Base.repo
RUN yum-config-manager --disable centos*
RUN yum-config-manager --disable WANdisco-git
RUN yum-config-manager --disable okay
RUN yum-config-manager --disable base
RUN yum-config-manager --disable updates
RUN yum-config-manager --enable base
RUN yum-config-manager --enable updates
RUN yum-config-manager --enable extras

# setup ssh server for debugging
RUN yum install -y openssh-server

Expand Down
2 changes: 2 additions & 0 deletions ci/dev/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Setup

.. code-block:: bash

$ export NEXUS_PASSWORD='your LDAP password'
$ ./ci/dev/start.sh

Type `pwd` if the password is asked.
Expand Down Expand Up @@ -87,6 +88,7 @@ Setup
.. code-block:: bash

cd /home/debugger/libsnowflakeclient
export BUILD_TYPE='Debug' # or 'Release' for release build
source ./ci/dev/docker_init.sh
./ci/build/build.sh

Expand Down
44 changes: 0 additions & 44 deletions cpp/logger/SFLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

#include "SFLogger.hpp"
#include "SecretDetector.hpp"

Snowflake::Client::ISFLogger *
Snowflake::Client::SFLogger::m_externalLogger = nullptr;
Expand All @@ -17,46 +16,3 @@ Snowflake::Client::ISFLogger * Snowflake::Client::SFLogger::getExternalLogger()
{
return m_externalLogger;
}

void log_masked_va_list(FILE* fp, const char *fmt, va_list args)
{
std::string maskedMsg = Snowflake::Client::SFLogger::getMaskedMsgVA(fmt, args);
fprintf(fp, "%s", maskedMsg.c_str());
}

std::string Snowflake::Client::SFLogger::getMaskedMsg(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
std::string maskedMsg = getMaskedMsgVA(fmt, args);
va_end(args);

return maskedMsg;
}

std::string Snowflake::Client::SFLogger::getMaskedMsgVA(const char* fmt, va_list args)
{
size_t bufLen = 4096;
// Just in case not to fall into dead loop. 8MB would be large enough for
// single log.
const int MAX_LOG_LEN = 8 * 1024 * 1024;
std::vector<char> buf(bufLen);

int ret = -1;
while ((ret < 0) && (bufLen <= MAX_LOG_LEN))
{
// va_list can only be consumed once. Make a copy here in case need to retry
// with larger buffer size.
va_list copy;
va_copy(copy, args);
ret = sb_vsnprintf(buf.data(), bufLen, bufLen - 1, fmt, copy);
va_end(copy);
if (ret < 0)
{
bufLen *= 2;
buf.resize(bufLen);
}
}

return SecretDetector::maskSecrets(std::string(buf.data()));
}
23 changes: 6 additions & 17 deletions cpp/logger/SFLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "snowflake/ISFLogger.hpp"
#include "snowflake/logger.h"
#include <string>

namespace Snowflake
{
Expand All @@ -21,63 +20,53 @@ class SFLogger

static ISFLogger * getExternalLogger();

static std::string getMaskedMsg(const char* fmt, ...);

static std::string getMaskedMsgVA(const char* fmt, va_list args);

private:
static ISFLogger * m_externalLogger;

#define CXX_LOG_FATAL(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_FATAL, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_FATAL, __FILE__, __VA_ARGS__); \
} else { \
sf_log_fatal(CXX_LOG_NS, __VA_ARGS__); \
} \

#define CXX_LOG_ERROR(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_ERROR, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_ERROR, __FILE__, __VA_ARGS__); \
} else { \
sf_log_error(CXX_LOG_NS, __VA_ARGS__); \
} \

#define CXX_LOG_WARN(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_WARN, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_WARN, __FILE__, __VA_ARGS__); \
} else { \
sf_log_warn(CXX_LOG_NS, __VA_ARGS__); \
} \

#define CXX_LOG_INFO(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_INFO, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_INFO, __FILE__, __VA_ARGS__); \
} else { \
sf_log_info(CXX_LOG_NS, __VA_ARGS__); \
} \

#define CXX_LOG_DEBUG(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_DEBUG, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_DEBUG, __FILE__, __VA_ARGS__); \
} else { \
sf_log_debug(CXX_LOG_NS, __VA_ARGS__); \
} \

#define CXX_LOG_TRACE(...) \
if (SFLogger::getExternalLogger() != NULL) \
{ \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_TRACE, __FILE__, \
SFLogger::getMaskedMsg(__VA_ARGS__).c_str()); \
SFLogger::getExternalLogger()->logLine(SF_LOG_LEVEL::SF_LOG_TRACE, __FILE__, __VA_ARGS__); \
} else { \
sf_log_trace(CXX_LOG_NS, __VA_ARGS__); \
} \
Expand Down
90 changes: 0 additions & 90 deletions cpp/logger/SecretDetector.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions cpp/logger/SecretDetector.hpp

This file was deleted.

2 changes: 0 additions & 2 deletions include/snowflake/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ void
log_log_va_list(int level, const char *file, int line, const char *ns,
const char *fmt, va_list args);

void log_masked_va_list(FILE* fp, const char *fmt, va_list args);

SF_LOG_LEVEL log_from_str_to_level(const char *level_in_str);

void log_set_path(const char* path);
Expand Down
Loading
Loading