Skip to content

Commit

Permalink
[TRAFODION-2654] Change the location of trafodion-site.xml from $TRAF…
Browse files Browse the repository at this point in the history
…_HOME/etc to config

[TRAFODION-2653] Sort operator loops at times

All HBase client connections from Trafodion uses Trafodion configuration
concept. Any client side property can now be set in trafodion-site.xml.

The scratch files are now open in blocking mode. Hence any scratch file
operation shouldn't return EAGAIN.

The internal table TDDL of table is now created without any table
coprocessors attached to it.
  • Loading branch information
selvaganesang committed Jun 23, 2017
1 parent 1083be3 commit e458290
Show file tree
Hide file tree
Showing 23 changed files with 233 additions and 143 deletions.
6 changes: 2 additions & 4 deletions core/sqf/conf/log4j.sql.config
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,5 @@ log4j.appender.hbaseclient.MaxBackupIndex=20

# Custom Logging levels

log4j.logger.org.apache.zookeeper=ERROR
log4j.logger.org.apache.hadoop.hbase=ERROR
log4j.logger.org.trafodion.sql=ERROR

log4j.logger.org.apache=ERROR
log4j.logger.org.trafodion.sql=INFO
File renamed without changes.
8 changes: 0 additions & 8 deletions core/sqf/sql/scripts/install_local_hadoop
Original file line number Diff line number Diff line change
Expand Up @@ -1627,16 +1627,8 @@ echo "$MY_LOCAL_SW_DIST/${HBASE_TAR}"
<name>hbase.snapshot.enabled</name>
<value>true</value>
</property>
<property>
<name>hbase.hregion.impl</name>
<value>org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion</value>
</property>
${HREGION_IMPL}
${MASTER_VISBILITY_COPROC}
<property>
<name>hbase.client.keyvalue.maxsize</name>
<value>0</value>
</property>
</configuration>
EOF

Expand Down
80 changes: 23 additions & 57 deletions core/sqf/sql/scripts/sqgen
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ function Usage {
echo
echo $script_name generates various Trafodion files in the $TRAF_HOME/sql/scripts directory.
echo
echo "Usage: $script_name [ -? | -h ] [<sqconfig_filename>]"
echo " -? Help"
echo "Usage: $script_name {-ft | -perf | [sqconfig_filename] | -h}"
echo " -h Help"
echo " <sqconfig_filename> Name of the SQ config file (in $TRAF_HOME/sql/scripts directory)(defaults to 'sqconfig')"
echo " [sqconfig_filename] Name of the SQ config file (in $TRAF_HOME/sql/scripts directory)(defaults to 'sqconfig')"
echo
exit 1;
}
Expand Down Expand Up @@ -75,7 +74,6 @@ function GetSQcnfg {
FT_FLAG=1
PERF_FLAG=0
SQCONFIG_FILE=sqconfig
SQCONFIG_DB_FILE=sqconfig.db

if [ -z $TRAF_HOME ]; then
echo
Expand Down Expand Up @@ -121,38 +119,15 @@ cd $TRAF_HOME/sql/scripts

# Check to make sure this is a real cluster
if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
# The configuration database can only be created the first time.
# Since nodes can be added and deleted through the 'shell node add/delete'
# commands, the 'sqconfig' node section may not reflect the current node
# configured. The 'sqregen' script can be used to update the SQCONFIG_FILE
# node section to reflect the current node configuration stored in
# the SQCONFIG_DB_FILE.
echo "Checking for the configuration file ($SQCONFIG_DB_FILE)."
if [ -f $SQCONFIG_DB_FILE ]; then
echo
echo "The configuration file ($SQCONFIG_DB_FILE) exists."
echo "Use the 'sqshell node add/delete' commands to change the node membership in the configuration database."
echo "Use the 'sqshell persist add/delete' commands to change the persist object configuration in the configuration database."
echo "Use the 'sqregen -node' script to update the $SQCONFIG_FILE 'node' section with the"
echo "current node membership in the configuration database."
echo "Use the 'sqregen -persist' script to update the $SQCONFIG_FILE 'persist' section with the"
echo "current persist configuration stored in the configuration database."
exit 1
fi

GetSQcnfg

else
echo
echo "Workstation environment - Not a clustered environment"
if [ -f $SQCONFIG_DB_FILE ]; then
echo
echo "The configuration file ($SQCONFIG_DB_FILE) was previously created."
echo "Removing and re-creating $SQCONFIG_DB_FILE!"
rm -f $SQCONFIG_DB_FILE
fi
echo "Workstation environment - Not a clustered environment"
fi

# Assume option is SQCONFIG_FILE
# -ft command line option indicates fault tolerance,
# otherwise we assume option is SQCONFIG_FILE
while [ $# != 0 ]
do
flag="$1"
Expand All @@ -172,6 +147,7 @@ mkdir -p $MPI_TMPDIR
# mkdir a dir for CBF data used by SQL IUS feature
mkdir -p $HOME/cbfs

#If pdsh exists
if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
echo
echo "Creating directories on cluster nodes"
Expand All @@ -191,6 +167,7 @@ if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
fi

SQSCRIPT_FILE=./gomon
SQCLUSTERCONF_FILE=$MPI_TMPDIR/cluster.conf
SQESPENV_FILE=$TRAF_HOME/sql/scripts/tdm_arkesp.env

echo
Expand All @@ -204,34 +181,20 @@ else
./genms > $SQETC_DIR/ms.env
lv_retcode=$?
if [[ $lv_retcode != 0 ]]; then
echo "Error $lv_retcode while executing genms. Exiting..."
exit $lv_retcode
echo "Error $lv_retcode while executing genms. Exiting..."
exit $lv_retcode
fi
fi

./gensqstatem2lenv > $SQETC_DIR/sqstatem2l.env

if [ -f $SQETC_DIR/trafodion-site.xml ]; then
echo "Trafodion customization file $SQETC_DIR/trafodion-site.xml exists."
echo "The file will not be copied."
echo
else
echo "Copying Trafodion customization file: $SQETC_DIR/trafodion-site.xml"
echo
cp ./trafodion-site.xml $SQETC_DIR
lv_retcode=$?
if [[ $lv_retcode != 0 ]]; then
echo "Error $lv_retcode while copying Exiting..."
exit $lv_retcode
fi
fi

# Create configuration database tables
sqlite3 -init createConfigDb $SQCONFIG_DB_FILE <<eof
rm -f sqconfig.db
sqlite3 -init createConfigDb sqconfig.db <<eof
.quit
eof

./gensq.pl $SQSCRIPT_FILE `hostname` $FT_FLAG $PERF_FLAG $SQCONFIG_FILE $TRAF_HOME/sql/scripts/sqconfig.persist
./gensq.pl $SQCONFIG_FILE $SQSCRIPT_FILE $SQCLUSTERCONF_FILE `hostname` $FT_FLAG $PERF_FLAG
sq_stat=$?
if [[ $sq_stat != 0 ]]; then
exit $sq_stat;
Expand Down Expand Up @@ -266,14 +229,17 @@ if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
echo
echo
echo "Copying the generated files to all the nodes in the cluster"
echo
echo "Copying $SQCLUSTERCONF_FILE to $MPI_TMPDIR of all the nodes"
echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCLUSTERCONF_FILE $MPI_TMPDIR"
$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCLUSTERCONF_FILE $MPI_TMPDIR


echo
echo "Copying $SQETC_DIR/ms.env to $SQETC_DIR of all the nodes"
echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env $SQETC_DIR "
$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env $SQETC_DIR

echo "Copying $SQETC_DIR/traf_coprocessor.properties to $SQETC_DIR of all the nodes"
echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/traf_coprocessor.properties $SQETC_DIR "
$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/traf_coprocessor.properties $SQETC_DIR

echo
echo "Copying $SQETC_DIR/seamonster.env to $SQETC_DIR of all the nodes"
Expand All @@ -292,11 +258,11 @@ if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
echo
echo "Copying rest of the generated files to $PWD"

echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD"
$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD
echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold gomon.warm rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD"
$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold gomon.warm rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD

echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD "
$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD
echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE sqconfig.db $PWD "
$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE sqconfig.db $PWD


echo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ CoprocessorService, Coprocessor {
switch(regionState) {
case REGION_STATE_RECOVERING: // RECOVERING, already create a list of in-doubt txn, but still in the state of resolving them,
// retrieve all in-doubt txn from rmid and return them into a long a
if (LOG.isInfoEnabled()) LOG.info("TRAF RCOV:recoveryRequest in region starting" + regionInfo.getEncodedName() + " has in-doubt transaction " + indoubtTransactionsById.size());
if (LOG.isInfoEnabled()) LOG.info("TRAF RCOV:recoveryRequest in region starting " + regionInfo.getEncodedName() + " has in-doubt transaction " + indoubtTransactionsById.size());
for (Entry<Long, List<WALEdit>> entry : indoubtTransactionsById.entrySet()) {
long tid = entry.getKey();
int nodeid = (int) TransactionState.getNodeId(tid);
Expand Down Expand Up @@ -4015,6 +4015,25 @@ CoprocessorService, Coprocessor {
if (LOG.isTraceEnabled()) LOG.trace("Trafodion Recovery: region " + m_regionDetails + " is STARTED.");
}

public static void WALSync(WAL wal, long transactionId, long txid) throws IOException
{
try {
if (txid == 0)
wal.sync();
else
wal.sync(txid);
} catch (IOException wale) {
wale.fillInStackTrace();
LOG.error("commitRequest txId: " + transactionId + " HLog seq " + txid + " Caught IOException in HLOG sync ", wale );
try {
Thread.sleep(1000); ///1000 milliseconds is one second.
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
throw wale;
}
}

/**
* Commits the transaction
* @param TrxTransactionState state
Expand Down Expand Up @@ -4435,7 +4454,7 @@ CoprocessorService, Coprocessor {
false,
null);
#endif
this.tHLog.sync(txid);
WALSync(tHLog, transactionId, txid);

#ifdef CDH5.7 APACHE1.2
if (writeEntry != null) {
Expand Down Expand Up @@ -5507,7 +5526,7 @@ CoprocessorService, Coprocessor {
+ " HLog seq "
+ txid
);
this.tHLog.sync(txid);
WALSync(tHLog, transactionId, txid);
#ifdef CDH5.7 APACHE1.2
if (writeEntry != null) {
this.t_Region.getMVCC().completeAndWait(writeEntry);
Expand Down Expand Up @@ -6020,6 +6039,7 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)
else {
state.prepareEditSize = state.getEdit().getCells().size();
}


/*
ArrayList<Cell> wkvs = state.getEdit().getCells();
Expand All @@ -6036,7 +6056,6 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)

#ifdef CDH5.7 APACHE1.2
txid = this.tHLog.append(this.m_Region.getTableDesc(), this.regionInfo, wk, state.getEdit(), false);

writeEntry = wk.getWriteEntry();
mvccNum = writeEntry.getWriteNumber();

Expand Down Expand Up @@ -6070,11 +6089,10 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)
+ " flushHLOG: " + flushHLOG
);
#endif
if (flushHLOG) this.tHLog.sync(txid);
if (flushHLOG) WALSync(tHLog, transactionId, txid);
}
else {
//if (LOG.isDebugEnabled()) LOG.debug("YYY0 commitRequest just SYNC -- EXIT txId: " + transactionId + " MAX HLog seq " + state.getFlushTxId());
if (flushHLOG) this.tHLog.sync(state.getFlushTxId());
if (flushHLOG) WALSync(tHLog, transactionId, state.getFlushTxId());
}

#ifdef CDH5.7 APACHE1.2
Expand All @@ -6092,7 +6110,8 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)
//if (LOG.isTraceEnabled()) LOG.trace("TrxRegionEndpoint coprocessor:commitRequest COMMIT_OK -- EXIT txId: "
// + transactionId + " regionTx: " + state.getIsRegionTx() + " HLog seq " + txid);
} catch (IOException exp) {
LOG.error("commitRequest txId: " + transactionId + " HLog seq " + txid + " Caught IOException in HLOG appendNoSync ", exp );
exp.fillInStackTrace();
LOG.error("commitRequest txId: " + transactionId + " HLog seq " + txid + " Caught IOException in HLOG operations", exp );
throw exp;
}

Expand Down Expand Up @@ -6362,7 +6381,7 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)
false,
null);
#endif
this.tHLog.sync(txid);
WALSync(tHLog, transactionId, txid);

#ifdef CDH5.7 APACHE1.2
if (writeEntry != null) {
Expand Down Expand Up @@ -6780,12 +6799,12 @@ TrxTransactionState isTransactionOnCommittedList(final long transactionId)
if (minStartSeqNumber == null) {
minStartSeqNumber = Long.MAX_VALUE;
}

synchronized (commitedTransactionsBySequenceNumber) {
choreCount++;
try{
this.tHLog.sync();
}catch (IOException ioe){
try {
WALSync(tHLog, -1, 0);
} catch (IOException ioe) {
LOG.error("chore removeUnNeededCommitedTransactions Cleanup " + m_regionDetails + " exception: ", ioe);
}
if ((commitedTransactionsBySequenceNumber.size() != 0) && ((choreCount % 20) == 1)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,6 @@ public class TrxTransactionState extends TransactionState {
}
}
}

#ifdef CDH5.7 APACHE1.2
public Configuration getConfig() {
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public boolean init(String hBasePath, String zkServers, String zkPort) throws IO
if (LOG.isDebugEnabled()) LOG.debug("Enter init, hBasePath:" + hBasePath);
if (LOG.isTraceEnabled()) LOG.trace("mapTransactionStates " + mapTransactionStates + " entries " + mapTransactionStates.size());
if (config == null) {
config = TrafConfiguration.create();
config = TrafConfiguration.create(TrafConfiguration.HBASE_CONF);
connection = ConnectionFactory.createConnection(config);
}
config.set("hbase.zookeeper.quorum", zkServers);
Expand Down Expand Up @@ -206,7 +206,7 @@ public boolean init(short dtmid) throws IOException {
setupLog4j();
if (LOG.isDebugEnabled()) LOG.debug("Enter init(" + dtmid + ")");
if (config == null) {
config = TrafConfiguration.create();
config = TrafConfiguration.create(TrafConfiguration.HBASE_CONF);
connection = ConnectionFactory.createConnection(config);
}
config.set("hbase.hregion.impl", "org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public TrafInfo() throws IOException {
}

public void init() throws IOException {
this.config = TrafConfiguration.create();
this.config = TrafConfiguration.create(TrafConfiguration.HBASE_CONF);
this.connection = ConnectionFactory.createConnection(config);
}

Expand Down
2 changes: 1 addition & 1 deletion core/sql/common/Ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3209,7 +3209,7 @@ class IpcAllConnections : public ARRAY(IpcConnection *)
// we need to be able to send 2 messages simultaneously. There are two
// constants: an initial one to save resources, and a second one for
// large queries to keep the number of ESPs low. See logic on IpcEnvironment
// constructor that allows these to be overridden with DEFINEs.
// constructor that allows these to be overridden with environment variables.

const Int32 InitialNowaitRequestsPerEsp = 15;
const Int32 HighLoadNowaitRequestsPerEsp = 15;
Expand Down
Empty file modified core/sql/executor/ExExeUtil.h
100755 → 100644
Empty file.

0 comments on commit e458290

Please sign in to comment.