Skip to content

Commit

Permalink
Run pgindent.
Browse files Browse the repository at this point in the history
FDW-83, Vaibhav Dalvi, reviewed by Suraj Kharage.
  • Loading branch information
jeevanchalke committed Jun 17, 2020
1 parent d509e4a commit a2967a9
Show file tree
Hide file tree
Showing 9 changed files with 1,525 additions and 1,426 deletions.
25 changes: 13 additions & 12 deletions connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ typedef struct ConnCacheKey

typedef struct ConnCacheEntry
{
ConnCacheKey key; /* hash key (must be first) */
MONGO_CONN *conn; /* connection to foreign server, or NULL */
ConnCacheKey key; /* hash key (must be first) */
MONGO_CONN *conn; /* connection to foreign server, or NULL */
bool invalidated; /* true if reconnect is pending */
uint32 server_hashvalue; /* hash value of foreign server OID */
uint32 mapping_hashvalue; /* hash value of user mapping OID */
Expand All @@ -69,26 +69,27 @@ static void mongo_inval_callback(Datum arg, int cacheid, uint32 hashvalue);
* the remote Mongo server with the user's authorization. A new connection
* is established if we don't already have a suitable one.
*/
MONGO_CONN*
MONGO_CONN *
mongo_get_connection(ForeignServer *server, UserMapping *user, MongoFdwOptions *opt)
{
bool found;
ConnCacheEntry *entry;
ConnCacheKey key;
bool found;
ConnCacheEntry *entry;
ConnCacheKey key;

/* First time through, initialize connection cache hashtable */
if (ConnectionHash == NULL)
{
HASHCTL ctl;
HASHCTL ctl;

MemSet(&ctl, 0, sizeof(ctl));
ctl.keysize = sizeof(ConnCacheKey);
ctl.entrysize = sizeof(ConnCacheEntry);
ctl.hash = tag_hash;
/* allocate ConnectionHash in the cache context */
ctl.hcxt = CacheMemoryContext;
ConnectionHash = hash_create("mongo_fdw connections", 8,
&ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
&ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);

/*
* Register some callback functions that manage connection cleanup.
Expand Down Expand Up @@ -131,8 +132,8 @@ mongo_get_connection(ForeignServer *server, UserMapping *user, MongoFdwOptions *

#ifdef META_DRIVER
entry->conn = MongoConnect(opt->svr_address, opt->svr_port, opt->svr_database, opt->svr_username, opt->svr_password,
opt->authenticationDatabase, opt->replicaSet, opt->readPreference,
opt->ssl, opt->pem_file, opt->pem_pwd, opt->ca_file, opt->ca_dir, opt->crl_file, opt->weak_cert_validation);
opt->authenticationDatabase, opt->replicaSet, opt->readPreference,
opt->ssl, opt->pem_file, opt->pem_pwd, opt->ca_file, opt->ca_dir, opt->crl_file, opt->weak_cert_validation);
#else
entry->conn = MongoConnect(opt->svr_address, opt->svr_port, opt->svr_database, opt->svr_username, opt->svr_password);
#endif
Expand Down Expand Up @@ -179,7 +180,7 @@ mongo_get_connection(ForeignServer *server, UserMapping *user, MongoFdwOptions *
void
mongo_cleanup_connection()
{
HASH_SEQ_STATUS scan;
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;

if (ConnectionHash == NULL)
Expand Down
Loading

0 comments on commit a2967a9

Please sign in to comment.